Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TWI - Two-Wire Slave Interface

Driver for the TWIS (Two-Wire Slave Interface).

This driver provides access to the main features of the TWIS controller. The TWIS interconnects a TWI slave on a unique two-wire bus. The TWIS is programmable as a slave with sequential or single-byte access. Internal Address access and Ten bit addressing mode is supported.

Modules

 

Data Structures

struct  twis_options_t
 Input parameters when initializing the twi module mode. More...
 
struct  twis_package_t
 Information concerning the data transmission. More...
 
struct  twis_slave_fct_t
 Pointer on TWI slave user specific application routines. More...
 

Functions

void twis_send_data_ack (volatile avr32_twis_t *twis)
 Enable ACK transfer in Slave Receiver Mode. More...
 
void twis_send_data_nack (volatile avr32_twis_t *twis, bool stop_callback)
 Enable NACK transfer in Slave Receive Mode. More...
 
status_code_t twis_slave_init (volatile avr32_twis_t *twis, const twis_options_t *opt, const twis_slave_fct_t *slave_fct)
 Initialize the TWI Slave Module. More...
 

TWI Driver Compatibility

Codes for UC3 devices using TWI modules can easily be ported to UC3 devices with TWIM module

#define avr32_twi_t   avr32_twis_t
 
#define twi_options_t   twis_options_t
 
#define twi_package_t   twis_package_t
 
#define twi_slave_fct_t   twis_slave_fct_t
 
#define twi_slave_init   twis_slave_init
 

#define avr32_twi_t   avr32_twis_t
#define twi_options_t   twis_options_t
#define twi_package_t   twis_package_t
#define twi_slave_fct_t   twis_slave_fct_t
#define twi_slave_init   twis_slave_init

void twis_send_data_ack ( volatile avr32_twis_t *  twis)

Enable ACK transfer in Slave Receiver Mode.

Parameters
twisBase address of the TWI (i.e. &AVR32_TWIS).
void twis_send_data_nack ( volatile avr32_twis_t *  twis,
bool  stop_callback 
)

Enable NACK transfer in Slave Receive Mode.

Parameters
twisBase address of the TWI (i.e. &AVR32_TWIS).
stop_callbackSet true to use Stop condition Callback function

References twis_slave_fct_t::stop.

status_code_t twis_slave_init ( volatile avr32_twis_t *  twis,
const twis_options_t opt,
const twis_slave_fct_t slave_fct 
)

Initialize the TWI Slave Module.

Parameters
twisBase address of the TWI (i.e. &AVR32_TWIS).
*optOptions for initializing the TWI module (see twis_options_t)
*slave_fctPointer on application functions

References twis_options_t::chip, cpu_irq_disable, cpu_irq_restore(), cpu_irq_save(), irq_register_handler, twis_options_t::pba_hz, twis_options_t::smbus, twis_options_t::speed, STATUS_OK, twis_options_t::tenbit, and twis_inst_slave.