Macros | |
#define | CONF_TWI_IRQ_GROUP AVR32_TWI_IRQ_GROUP |
#define | CONF_TWI_IRQ_LINE AVR32_TWI_IRQ |
Functions | |
ISR (twi_master_interrupt_handler, CONF_TWI_IRQ_GROUP, CONF_TWI_IRQ_LEVEL) | |
TWI interrupt handler. More... | |
ISR (twi_slave_interrupt_handler, AVR32_TWI_IRQ_GROUP, CONF_TWI_IRQ_LEVEL) | |
TWI interrupt handler. More... | |
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... | |
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) |
This function is not blocking. More... | |
static uint32_t | twi_mk_addr (const uint8_t *addr, int len) |
Construct the TWI module address register field. More... | |
int | twi_probe (volatile avr32_twi_t *twi, char chip_addr) |
Test if a chip answers for a given twi address. More... | |
static int | twi_set_speed (volatile avr32_twi_t *twi, unsigned int speed, unsigned long pba_hz) |
Set the twi bus speed in conjunction with the clock frequency. 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... | |
Variables | |
static volatile bool | twi_busy = false |
Signal end of transaction. More... | |
static volatile avr32_twi_t * | twi_inst |
Pointer to the instance of the TWI registers for IT. More... | |
static volatile unsigned long | twi_it_mask |
IT mask. More... | |
static volatile bool | twi_nack = false |
Add NACK boolean. More... | |
static volatile unsigned char *volatile | twi_rx_data = NULL |
Pointer to the applicative TWI receive buffer. More... | |
static volatile int | twi_rx_nb_bytes = 0 |
Remaining number of bytes to receive. More... | |
static twi_slave_fct_t | twi_slave_fct |
Pointer on TWI slave application routines. More... | |
static const unsigned char *volatile | twi_tx_data = NULL |
Pointer to the applicative TWI transmit buffer. More... | |
static volatile int | twi_tx_nb_bytes = 0 |
Remaining number of bytes to transmit. More... | |
#define CONF_TWI_IRQ_GROUP AVR32_TWI_IRQ_GROUP |
#define CONF_TWI_IRQ_LINE AVR32_TWI_IRQ |
Referenced by twi_master_init(), and twi_slave_init().
ISR | ( | twi_master_interrupt_handler | , |
CONF_TWI_IRQ_GROUP | , | ||
CONF_TWI_IRQ_LEVEL | |||
) |
TWI interrupt handler.
References twi_busy, twi_inst, twi_it_mask, twi_nack, twi_rx_data, twi_rx_nb_bytes, twi_tx_data, and twi_tx_nb_bytes.
ISR | ( | twi_slave_interrupt_handler | , |
AVR32_TWI_IRQ_GROUP | , | ||
CONF_TWI_IRQ_LEVEL | |||
) |
TWI interrupt handler.
References twi_slave_fct_t::rx, twi_slave_fct_t::stop, twi_inst, twi_it_mask, and twi_slave_fct_t::tx.
|
static |
Construct the TWI module address register field.
The TWI module address register is sent out MSB first. And the size controls which byte is the MSB to start with.
Please see the device datasheet for details on this.
Referenced by twi_master_read(), twi_master_write(), and twi_master_write_ex().
|
static |
Set the twi bus speed in conjunction with the clock frequency.
twi | Base address of the TWI (i.e. &AVR32_TWI). |
speed | The desired twi bus speed |
pba_hz | The current running PBA clock frequency |
References TWI_SUCCESS.
Referenced by twi_master_init().
Signal end of transaction.
Referenced by ISR(), twi_is_busy(), twi_master_read(), and twi_master_write().
|
static |
Pointer to the instance of the TWI registers for IT.
Referenced by ISR(), twi_master_init(), twi_master_read(), twi_master_write(), twi_master_write_ex(), and twi_slave_init().
|
static |
IT mask.
Referenced by ISR(), twi_master_read(), twi_master_write(), twi_master_write_ex(), and twi_slave_init().
Add NACK boolean.
Referenced by ISR(), twi_master_read(), twi_master_write(), and twi_master_write_ex().
|
static |
Pointer to the applicative TWI receive buffer.
Referenced by ISR(), and twi_master_read().
|
static |
Remaining number of bytes to receive.
Referenced by ISR(), and twi_master_read().
|
static |
Pointer on TWI slave application routines.
Referenced by main().
|
static |
Pointer to the applicative TWI transmit buffer.
Referenced by ISR(), twi_master_write(), and twi_master_write_ex().
|
static |
Remaining number of bytes to transmit.
Referenced by ISR(), twi_master_write(), and twi_master_write_ex().