Modules | Enumerations | Functions
Basic functions

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...
 

Detailed Description

Functions which handle basics.

Enumeration Type Documentation

◆ eRequestType

enum used to cluster the different request types to a single module

See also
Enumerator
kRequestClear 

constant (0): clear all requests

kRequestSingle 

constant (1): request a single update

kRequestWait 

constant (2): request a single update and wait until it is done

kRequestContinuous 

constant (3): request continuous updates

Function Documentation

◆ crc_calculate()

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.

Parameters
[in]dataPointer to data structure.
[in]cntSize of data structure.

◆ crc_update()

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.

Parameters
[in]crcValue of CRC after last iteration.
[in]dataCurrent char/byte, which is will be added to the CRC.

◆ init_tucbot()

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().

Note
: This function must only be called once. If it is called a second time the function reset_tucbot() is automatically executed.
: If enable_interrupts is set to false (0x00), the IMU is not initialized.
Parameters
enable_interrupts8-bit unsigned integer which is a boolean value
See also
reset_tucbot() and tucbot_imu_reset()
Examples
battery.c, beeper.c, bumper.c, button.c, cyclic.c, driveAdjust.pupil.c, driveAngle.pupil.c, driveArc.pupil.c, driveDist.pupil.c, encoderComplex.c, encoderSimple.c, imu.c, lausTracker.c, led.c, lineComplex.c, lineSimple.c, mode.c, motorComplex.c, motorSimple.c, packedCom.c, remoteControl.c, servo.c, sharp.c, tsop.c, twi.c, and uart.c.

◆ int16tostr()

void int16tostr ( void *  out,
int16_t  number,
uint8_t  digits 
)

Converts an integer to a string and passes it to an output function.

Parameters
[in]outoutput function of type "void out(uint8_t)"
The resulting string is passed character by character to the output function.
[in]number16-bit integer
[in]digits8-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.
See also
serout0(), serout1() and lcdout()
Examples
battery.c, beeper.c, driveAdjust.pupil.c, driveAngle.pupil.c, driveArc.pupil.c, driveDist.pupil.c, encoderComplex.c, encoderSimple.c, imu.c, motorComplex.c, motorSimple.c, remoteControl.c, servo.c, and sharp.c.

◆ reset_tucbot()

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.

Note
: This effects only the sensor module. The driving module and the IMU will be uneffected, except for general initialisation.
See also
init_tucbot()

◆ uint16tostr()

void uint16tostr ( void *  out,
uint16_t  number,
uint8_t  digits 
)

Converts an unsigned integer to a string and passes it to an output function.

Parameters
[in]outoutput function of type "void out(uint8_t)"
The resulting string is passed character by character to the output function.
[in]number16-bit unsigned integer
[in]digits8-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.
See also
serout0(), serout1() and lcdout()
Examples
lausTracker.c, lineComplex.c, lineSimple.c, packedCom.c, and remoteControl.c.