|
SAM4SD32 (SAM4S-EK2)
|
Two-Wire Interface (TWI) driver for SAM. More...
#include "compiler.h"Go to the source code of this file.
Data Structures | |
| struct | twi_options |
| Input parameters when initializing the TWI module mode. More... | |
| struct | twi_packet |
| Information concerning the data transmission. More... | |
Macros | |
| #define | TWI_TIMEOUT 30000 |
| Time-out value (number of attempts). | |
| #define | TWI_ARBITRATION_LOST 2 |
| #define | TWI_BUSY 8 |
| #define | TWI_ERROR_TIMEOUT 9 |
| #define | TWI_INVALID_ARGUMENT 1 |
| #define | TWI_NO_CHIP_FOUND 3 |
| #define | TWI_RECEIVE_NACK 5 |
| #define | TWI_RECEIVE_OVERRUN 4 |
| #define | TWI_SEND_NACK 7 |
| #define | TWI_SEND_OVERRUN 6 |
| #define | TWI_SUCCESS 0 |
| Return codes for TWI APIs. | |
Typedefs | |
| typedef struct twi_options | twi_options_t |
| Input parameters when initializing the TWI module mode. | |
| typedef struct twi_packet | twi_packet_t |
| Information concerning the data transmission. | |
Functions | |
| void | twi_disable_interrupt (Twi *p_twi, uint32_t ul_sources) |
| Disable TWI interrupts. | |
| void | twi_disable_master_mode (Twi *p_twi) |
| Disable TWI master mode. | |
| void | twi_disable_slave_mode (Twi *p_twi) |
| Disable TWI slave mode. | |
| void | twi_enable_interrupt (Twi *p_twi, uint32_t ul_sources) |
| Enable TWI interrupts. | |
| void | twi_enable_master_mode (Twi *p_twi) |
| Enable TWI master mode. | |
| void | twi_enable_slave_mode (Twi *p_twi) |
| Enable TWI slave mode. | |
| uint32_t | twi_get_interrupt_mask (Twi *p_twi) |
| Read TWI interrupt mask. | |
| uint32_t | twi_get_interrupt_status (Twi *p_twi) |
| Get TWI interrupt status. | |
| Pdc * | twi_get_pdc_base (Twi *p_twi) |
| Get TWI PDC base address. | |
| uint32_t | twi_master_init (Twi *p_twi, const twi_options_t *p_opt) |
| Initialize TWI master mode. | |
| uint32_t | twi_master_read (Twi *p_twi, twi_packet_t *p_packet) |
| Read multiple bytes from a TWI compatible slave device. | |
| uint32_t | twi_master_write (Twi *p_twi, twi_packet_t *p_packet) |
| Write multiple bytes to a TWI compatible slave device. | |
| uint32_t | twi_mk_addr (const uint8_t *addr, int len) |
| Construct the TWI module address register field. | |
| uint32_t | twi_probe (Twi *p_twi, uint8_t uc_slave_addr) |
| Test if a chip answers a given I2C address. | |
| uint8_t | twi_read_byte (Twi *p_twi) |
| Reads a byte from the TWI bus. | |
| void | twi_reset (Twi *p_twi) |
| Reset TWI. | |
| void | twi_set_slave_addr (Twi *p_twi, uint32_t ul_device_addr) |
| Set TWI slave address. | |
| uint32_t | twi_set_speed (Twi *p_twi, uint32_t ul_speed, uint32_t ul_mck) |
| Set the I2C bus speed in conjunction with the clock frequency. | |
| void | twi_slave_init (Twi *p_twi, uint32_t ul_device_addr) |
| Initialize TWI slave mode. | |
| uint32_t | twi_slave_read (Twi *p_twi, uint8_t *p_data) |
| Read data from master. | |
| uint32_t | twi_slave_write (Twi *p_twi, uint8_t *p_data) |
| Write data to TWI bus. | |
| void | twi_write_byte (Twi *p_twi, uint8_t uc_byte) |
| Sends a byte of data to one of the TWI slaves on the bus. | |
Two-Wire Interface (TWI) driver for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
\cond ASF_LICENSE
Definition in file twi.h.
| #define TWI_ERROR_TIMEOUT 9 |
Definition at line 66 of file twi.h.
Referenced by twi_master_read().
| #define TWI_INVALID_ARGUMENT 1 |
Definition at line 58 of file twi.h.
Referenced by twi_master_init(), twi_master_read(), and twi_master_write().
| #define TWI_RECEIVE_NACK 5 |
Definition at line 62 of file twi.h.
Referenced by twi_master_read(), and twi_master_write().
| #define TWI_SUCCESS 0 |
Return codes for TWI APIs.
Definition at line 57 of file twi.h.
Referenced by twi_master_init(), twi_master_read(), and twi_master_write().
| #define TWI_TIMEOUT 30000 |
Time-out value (number of attempts).
Definition at line 51 of file twi.h.
Referenced by twi_master_read().
| typedef struct twi_options twi_options_t |
Input parameters when initializing the TWI module mode.
| typedef struct twi_packet twi_packet_t |
Information concerning the data transmission.