Functions

Series U4, U6 and U7 Model TWI Driver
[TWI Driver - LUFA/Drivers/Peripheral/TWI.h]

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)

Detailed Description

Master mode TWI driver for the AT90USB1287, AT90USB1286, AT90USB647, AT90USB646, ATMEGA16U4 and ATMEGA32U4 AVRs.

Note:
This file should not be included directly. It is automatically included as needed by the TWI driver dispatch header located in LUFA/Drivers/Peripheral/TWI.h.

Function Documentation

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.

Parameters:
[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
Returns:
Boolean true if the byte reception successfully completed, false otherwise
static bool TWI_SendByte ( const uint8_t  Byte  )  [inline, static]

Sends a byte to the currently addressed device on the TWI bus.

Parameters:
[in] Byte Byte to send to the currently addressed device
Returns:
Boolean true if the recipient ACKed the byte, false otherwise
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.

Parameters:
[in] SlaveAddress Address of the slave TWI device to communicate with
[in] TimeoutMS Timeout period within which the slave must respond, in milliseconds
Returns:
Boolean true if the device is ready for data, false otherwise
static void TWI_StopTransmission ( void   )  [inline, static]

Sends a TWI STOP onto the TWI bus, terminating communication with the currently addressed device.