#include <avr32/io.h>
#include <stdint.h>
#include "compiler.h"
#include "status_codes.h"
#include "conf_twim.h"
Data Structures | |
struct | twim_options_t |
Input parameters when initializing the twim module mode. More... | |
struct | twim_package_t |
Information concerning the data transmission. More... | |
struct | twim_transfer_t |
Information concerning the data transmission. More... | |
Macros | |
#define | AVR32_TWIM_IER_NAK_MASK |
Interrupt Enable Register Mask for No Acknowledgements. More... | |
#define | AVR32_TWIM_IER_STD_MASK |
Frequently used Interrupt Enable Register Mask. More... | |
#define | AVR32_TWIM_SCR_NAK_MASK |
Status Clear Register Mask for No Acknowledgements. More... | |
#define | AVR32_TWIM_SR_NAK_MASK |
Status Register Mask for No Acknowledgements. More... | |
#define | AVR32_TWIM_SR_STD_MASK |
Frequently used Status Clear Register Mask. More... | |
#define | TWI_FAST_MODE_SPEED (400000 /* kbit/s */) |
TWI Fast Mode. More... | |
#define | TWI_STD_MODE_SPEED (100000 /* kbit/s */) |
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_twim_t |
#define | twi_options_t twim_options_t |
#define | twi_package_t twim_package_t |
#define | twi_master_init twim_master_init |
#define | twi_probe twim_probe |
Functions | |
static status_code_t | twi_master_read (volatile avr32_twi_t *twim, const twi_package_t *package) |
Compatibility with TWI Module driver for read operation. More... | |
static status_code_t | twi_master_write (volatile avr32_twi_t *twim, const twi_package_t *package) |
Compatibility with TWI Module drivers for write operation. More... | |
status_code_t | twim_chained_transfer (volatile avr32_twim_t *twim, volatile twim_transfer_t *first, volatile twim_transfer_t *second, bool tenbit) |
Perform Chained transfers to a TWI compatible slave device. More... | |
void | twim_disable_interrupt (volatile avr32_twim_t *twim) |
Disable the TWI interrupts and clear its status register. More... | |
static void | twim_master_disable (volatile avr32_twim_t *twim) |
Disable Master Mode of the TWI. More... | |
static void | twim_master_enable (volatile avr32_twim_t *twim) |
Enable Master Mode of the TWI. More... | |
status_code_t | twim_master_init (volatile avr32_twim_t *twim, const twim_options_t *opt) |
Initialize the twi master module. More... | |
status_code_t | twim_probe (volatile avr32_twim_t *twim, uint32_t chip_addr) |
Test if a chip answers for a given twi address. More... | |
status_code_t | twim_read (volatile avr32_twim_t *twim, uint8_t *buffer, uint32_t nbytes, uint32_t saddr, bool tenbit) |
Read multiple bytes from a TWI compatible slave device. More... | |
status_code_t | twim_read_packet (volatile avr32_twim_t *twim, const twim_package_t *package) |
Read multiple bytes from a TWI compatible slave device. More... | |
status_code_t | twim_set_speed (volatile avr32_twim_t *twim, uint32_t speed, uint32_t pba_hz) |
Set the twim bus speed in conjunction with the clock frequency. More... | |
uint8_t | twim_status (void) |
Information about the current status of the TWI Bus. More... | |
status_code_t | twim_write (volatile avr32_twim_t *twim, const uint8_t *buffer, uint32_t nbytes, uint32_t saddr, bool tenbit) |
Write multiple bytes to a TWI compatible slave device. More... | |
status_code_t | twim_write_packet (volatile avr32_twim_t *twim, const twim_package_t *package) |
Write multiple bytes to a TWI compatible slave device. More... | |
enum | twim_transfer_status { TWI_SUCCESS = 0, TWI_INVALID_ARGUMENT = -1, TWI_ARBITRATION_LOST = -2, TWI_NO_CHIP_FOUND = -3, TWI_RECEIVE_NACK = -4, TWI_SEND_NACK = -5, TWI_INVALID_CLOCK_DIV = -6 } |
Status Codes for TWI Transfer. More... | |
typedef enum twim_transfer_status | twim_transfer_status_t |