Macros | Functions

advanced functions More...

Macros

#define tucbot_twi_lockLib()
 function: locks the TWI for internal use
 
#define tucbot_twi_unlockLib()
 function: unlocks the TWI from internal use
 
#define tucbot_twi_lockLibGet()
 function: gets if the TWI is locked for internal use
 
#define tucbot_twi_lockWrapper()
 function: locks the TWI-Wrapper
 
#define tucbot_twi_unlockWrapper()
 function: unlocks the TWI-Wrapper
 
#define tucbot_twi_lockWrapperGet()
 function: gets if the TWI-Wrapper is locked
 
#define tucbot_twi_lockUserGet()
 function: gets if the TWI is locked by user
 

Functions

void tucbot_twi_reset (void)
 Resets the TWI hardware. More...
 
void tucbot_twi_resetHard (void)
 Disables the TWI hardware. More...
 
void tucbot_twi_next (eTwiStructId id)
 The indexed data block is send or received next over the TWI. More...
 
uint8_t tucbot_twi_checkId (eTwiStructId id)
 Internal helper function for checking the data block id. More...
 
eTwiStructId tucbot_twi_incrementId (eTwiStructId id)
 Internal helper function for increasing the data block id. More...
 
eTwiStructId tucbot_twi_validId (eTwiStructId id)
 Internal helper function for creating an valid data block id. More...
 
uint8_t tucbot_twi_getAddress (eTwiStructId id)
 Internal helper function for returning the twi address of the data block id. More...
 

Detailed Description

advanced functions

Function Documentation

◆ tucbot_twi_checkId()

uint8_t tucbot_twi_checkId ( eTwiStructId  id)

Internal helper function for checking the data block id.

Parameters
idvalue of the selected struct - see also eTwiStructId
Returns
8-bit unsigned integer which is a boolean value
See also
tucbot_twi_incrementId() and tucbot_twi_validId()

◆ tucbot_twi_getAddress()

uint8_t tucbot_twi_getAddress ( eTwiStructId  id)

Internal helper function for returning the twi address of the data block id.

Parameters
idvalue of the selected struct - see also eTwiStructId
Returns
twi address
See also
twi_sendTo()

◆ tucbot_twi_incrementId()

eTwiStructId tucbot_twi_incrementId ( eTwiStructId  id)

Internal helper function for increasing the data block id.

The result will always be the next valid data block id.

Parameters
idvalue of the selected struct - see also eTwiStructId
Returns
8-bit unsigned integer which is a boolean value
See also
tucbot_twi_checkId() and tucbot_twi_validId()

◆ tucbot_twi_next()

void tucbot_twi_next ( eTwiStructId  id)

The indexed data block is send or received next over the TWI.

It's not enqueued like the other data blocks, but handled as soon as possible.

There exists only one flag for this fast single tranfer. If it is already set, it will not be overriden. To ensure tranfer as soon as possible this function might be called in a loop until the received or transmitted flags are set.

Parameters
idvalue of the selected struct - see also eTwiStructId

◆ tucbot_twi_reset()

void tucbot_twi_reset ( void  )

Resets the TWI hardware.

Resets the TWI to idle-mode by transmitting a stop-condition. This also flushes the internal buffers of the TWI and resets the error state.

Note
This function does not wait until the TWI bus is idle. You should wait some time for the hardware or call twi_wait().
If the twi is stucked in a hardware deadlock, you may call tucbot_twi_resetHard().
See also
twi_wait(), twi_reset() and tucbot_twi_resetHard()

◆ tucbot_twi_resetHard()

void tucbot_twi_resetHard ( void  )

Disables the TWI hardware.

Like twi_reset() and tucbot_twi_reset(), this function flushes all software buffers and clears the last error code. Additionally, this function turns the TWI immediately off!

There is a dedicated reset counter in tucbot_twi to recognize all hard resets.

Note
This function should only be called, if there is a hardware deadlock.
See also
twi_reset() and tucbot_twi_reset()

◆ tucbot_twi_validId()

eTwiStructId tucbot_twi_validId ( eTwiStructId  id)

Internal helper function for creating an valid data block id.

This function first calls tucbot_twi_checkId(). If the id is valid, it will be returned as is. Otherwise tucbot_twi_incrementId() will be called and returned.

Parameters
idvalue of the selected struct - see also eTwiStructId
Returns
value of the selected struct - see also eTwiStructId
See also
tucbot_twi_checkId() and tucbot_twi_incrementId()