| LUFA Library 140302 |

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
TWI_XMEGA.h File Reference

TWI Peripheral Driver (XMEGA) More...

`#include "../../../Common/Common.h"`
`#include <stdio.h>`

## Macros
#define | TWI_ADDRESS_READ 0x01
#define | TWI_ADDRESS_WRITE 0x00
#define | TWI_BAUD_FROM_FREQ(Frequency) ((F_CPU / (2 * Frequency)) - 5)
#define | TWI_DEVICE_ADDRESS_MASK 0xFE

## Enumerations
enum | TWI_ErrorCodes_t { TWI_ERROR_NoError = 0, TWI_ERROR_BusFault = 1, TWI_ERROR_BusCaptureTimeout = 2, TWI_ERROR_SlaveResponseTimeout = 3, TWI_ERROR_SlaveNotReady = 4, TWI_ERROR_SlaveNAK = 5, TWI_ERROR_NoError = 0, TWI_ERROR_BusFault = 1, TWI_ERROR_BusCaptureTimeout = 2, TWI_ERROR_SlaveResponseTimeout = 3, TWI_ERROR_SlaveNotReady = 4, TWI_ERROR_SlaveNAK = 5 }

## Functions
static void | TWI_Disable (TWI_t *const TWI) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1)
static void | TWI_Init (TWI_t *const TWI, const uint8_t Baud) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1)
uint8_t | TWI_ReadPacket (TWI_t *const TWI, const uint8_t SlaveAddress, const uint8_t TimeoutMS, const uint8_t *InternalAddress, uint8_t InternalAddressLen, uint8_t *Buffer, uint8_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4)
bool | TWI_ReceiveByte (TWI_t *const TWI, uint8_t *const Byte, const bool LastByte) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
bool | TWI_SendByte (TWI_t *const TWI, const uint8_t Byte) ATTR_NON_NULL_PTR_ARG(1)
uint8_t | TWI_StartTransmission (TWI_t *const TWI, const uint8_t SlaveAddress, const uint8_t TimeoutMS) ATTR_NON_NULL_PTR_ARG(1)
static void | TWI_StopTransmission (TWI_t *const TWI) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1)
uint8_t | TWI_WritePacket (TWI_t *const TWI, const uint8_t SlaveAddress, const uint8_t TimeoutMS, const uint8_t *InternalAddress, uint8_t InternalAddressLen, const uint8_t *Buffer, uint8_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4)

## Detailed Description

On-chip TWI driver for the XMEGA Family of AVR microcontrollers.

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.