Functions | |
static void | TWI_Init (void) ATTR_ALWAYS_INLINE |
static void | TWI_ShutDown (void) ATTR_ALWAYS_INLINE |
static void | TWI_StopTransmission (void) ATTR_ALWAYS_INLINE |
static bool | TWI_SendByte (const uint8_t Byte) |
static bool | TWI_ReceiveByte (uint8_t *const Byte, const bool LastByte) |
bool | TWI_StartTransmission (const uint8_t SlaveAddress, const uint8_t TimeoutMS) |
Master mode TWI driver for the AT90USB1287, AT90USB1286, AT90USB647, AT90USB646, ATMEGA16U4 and ATMEGA32U4 AVRs.
static void TWI_Init | ( | void | ) | [inline, static] |
Initialises the TWI hardware into master mode, ready for data transmission and reception. This must be before any other TWI operations.
static bool TWI_ReceiveByte | ( | uint8_t *const | Byte, |
const bool | LastByte | ||
) | [inline, static] |
Receives a byte from the currently addressed device on the TWI bus.
[in] | Byte | Location where the read byte is to be stored |
[in] | LastByte | Indicates if the byte should be ACKed if false, NAKed if true |
static bool TWI_SendByte | ( | const uint8_t | Byte ) | [inline, static] |
Sends a byte to the currently addressed device on the TWI bus.
[in] | Byte | Byte to send to the currently addressed device |
static void TWI_ShutDown | ( | void | ) | [inline, static] |
Turns off the TWI driver hardware. If this is called, any further TWI operations will require a call to TWI_Init() before the TWI can be used again.
bool TWI_StartTransmission | ( | const uint8_t | SlaveAddress, |
const uint8_t | TimeoutMS | ||
) |
Begins a master mode TWI bus communication with the given slave device address.
[in] | SlaveAddress | Address of the slave TWI device to communicate with |
[in] | TimeoutMS | Timeout period within which the slave must respond, in milliseconds |
static void TWI_StopTransmission | ( | void | ) | [inline, static] |
Sends a TWI STOP onto the TWI bus, terminating communication with the currently addressed device.