Functions which handle basics. More...
Modules | |
Advanced informations | |
Enumerations | |
enum | eRequestType |
enum used to cluster the different request types to a single module More... | |
Functions | |
void | uint16tostr (void *out, uint16_t number, uint8_t digits) |
Converts an unsigned integer to a string and passes it to an output function. More... | |
void | int16tostr (void *out, int16_t number, uint8_t digits) |
Converts an integer to a string and passes it to an output function. More... | |
void | init_tucbot (uint8_t enable_interrupts) |
Initiates the TUC-Bot. More... | |
void | reset_tucbot (void) |
Restarting the TUC-Bot. More... | |
CRC-Functions | |
uint16_t | crc_calculate (void *data, uint16_t cnt) |
Calculates crc16 hash of the given data. More... | |
uint16_t | crc_update (uint16_t crc, uint8_t data) |
Internal function for incrementally calculating crc16. More... | |
Functions which handle basics.
enum eRequestType |
enum used to cluster the different request types to a single module
uint16_t crc_calculate | ( | void * | data, |
uint16_t | cnt | ||
) |
Calculates crc16 hash of the given data.
To use this function, include tucbot_additionals/crc.h
into your code.
[in] | data | Pointer to data structure. |
[in] | cnt | Size of data structure. |
uint16_t crc_update | ( | uint16_t | crc, |
uint8_t | data | ||
) |
Internal function for incrementally calculating crc16.
To use this function, include tucbot_additionals/crc.h
into your code.
[in] | crc | Value of CRC after last iteration. |
[in] | data | Current char/byte, which is will be added to the CRC. |
void init_tucbot | ( | uint8_t | enable_interrupts | ) |
Initiates the TUC-Bot.
This function must be called within the main function.
It initiates the hardware, the system and all internal variables. The IMU is a somewhat special case. It will only be initiated, if the interrupts are enabled. Otherwise the function tucbot_imu_reset() needs to be called.
If the enable_interrupts parameter is set to true (!= 0) all interrupts will be activated at the end of initialization. Otherwise the user has to call sei().
enable_interrupts | 8-bit unsigned integer which is a boolean value |
void int16tostr | ( | void * | out, |
int16_t | number, | ||
uint8_t | digits | ||
) |
Converts an integer to a string and passes it to an output function.
[in] | out | output function of type "void out(uint8_t)" The resulting string is passed character by character to the output function. |
[in] | number | 16-bit integer |
[in] | digits | 8-bit unsigned integer (0..5) The maximum possible number of digits is 5. While the resulting string has less characters then described by digits the string is filled with spaces on the left side. The "-" is put out before any additional spaces. |
void reset_tucbot | ( | void | ) |
Restarting the TUC-Bot.
This function simulates a hardware reset and restarts the sensor module of the TUC-Bot. Therefore, execution will start with a full software reset, followed by execution of the bootloader. Finally the main function is executed.
void uint16tostr | ( | void * | out, |
uint16_t | number, | ||
uint8_t | digits | ||
) |
Converts an unsigned integer to a string and passes it to an output function.
[in] | out | output function of type "void out(uint8_t)" The resulting string is passed character by character to the output function. |
[in] | number | 16-bit unsigned integer |
[in] | digits | 8-bit unsigned integer (0..5) The maximum possible number of digits is 5. While the resulting string has less characters then described by digits the string is filled with spaces on the left side. |