Microchip® Advanced Software Framework

twi.h File Reference
#include <avr32/io.h>
#include "compiler.h"
#include "conf_twi.h"

Data Structures

struct  twi_options_t
 Input parameters when initializing the twi module mode. More...
 
struct  twi_package_t
 Information concerning the data transmission. More...
 
struct  twi_slave_fct_t
 Pointer on TWI slave application routines. More...
 

Macros

Error Codes for the Module
#define TWI_SUCCESS   0
 
#define TWI_INVALID_ARGUMENT   -1
 
#define TWI_ARBITRATION_LOST   -2
 
#define TWI_NO_CHIP_FOUND   -3
 
#define TWI_RECEIVE_OVERRUN   -4
 
#define TWI_RECEIVE_NACK   -5
 
#define TWI_SEND_OVERRUN   -6
 
#define TWI_SEND_NACK   -7
 
#define TWI_BUSY   -8
 

Functions

void twi_disable_interrupt (volatile avr32_twi_t *twi)
 Disable all TWI interrupts. More...
 
bool twi_is_busy (void)
 Test if a TWI read/write is pending. More...
 
static void twi_master_disable (volatile avr32_twi_t *twi)
 Disable Master Mode of the TWI. More...
 
static void twi_master_enable (volatile avr32_twi_t *twi)
 Enable Master Mode of the TWI. More...
 
int twi_master_init (volatile avr32_twi_t *twi, const twi_options_t *opt)
 Initialize the twi master module. More...
 
int twi_master_read (volatile avr32_twi_t *twi, const twi_package_t *package)
 Read multiple bytes from a TWI compatible slave device. More...
 
int twi_master_write (volatile avr32_twi_t *twi, const twi_package_t *package)
 Write multiple bytes to a TWI compatible slave device. More...
 
int twi_master_write_ex (volatile avr32_twi_t *twi, const twi_package_t *package)
 Write multiple bytes to a TWI compatible slave device. This function is not blocking. More...
 
int twi_probe (volatile avr32_twi_t *twi, char chip_addr)
 Test if a chip answers for a given twi address. More...
 
int twi_slave_init (volatile avr32_twi_t *twi, const twi_options_t *opt, const twi_slave_fct_t *slave_fct)
 Initialize the twi slave module. More...