SAM SERCOM I2C Slave Driver.
Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | i2c_slave_config |
Configuration structure for the I2C slave device. More... | |
struct | i2c_slave_module |
SERCOM I2C slave driver software device instance structure. More... | |
struct | i2c_slave_packet |
I2C slave packet for read/write. More... | |
Macros | |
#define | PINMUX_DEFAULT 0 |
I2C Slave Status Flags | |
I2C slave status flags, returned by i2c_slave_get_status() and cleared by i2c_slave_clear_status(). | |
#define | I2C_SLAVE_STATUS_ADDRESS_MATCH (1UL << 0) |
Address Match. More... | |
#define | I2C_SLAVE_STATUS_DATA_READY (1UL << 1) |
Data Ready. More... | |
#define | I2C_SLAVE_STATUS_STOP_RECEIVED (1UL << 2) |
Stop Received. More... | |
#define | I2C_SLAVE_STATUS_CLOCK_HOLD (1UL << 3) |
Clock Hold. More... | |
#define | I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT (1UL << 4) |
SCL Low Timeout. More... | |
#define | I2C_SLAVE_STATUS_REPEATED_START (1UL << 5) |
Repeated Start. More... | |
#define | I2C_SLAVE_STATUS_RECEIVED_NACK (1UL << 6) |
Received not acknowledge. More... | |
#define | I2C_SLAVE_STATUS_COLLISION (1UL << 7) |
Transmit Collision. More... | |
#define | I2C_SLAVE_STATUS_BUS_ERROR (1UL << 8) |
Bus error. More... | |
Functions | |
Lock/Unlock | |
static enum status_code | i2c_slave_lock (struct i2c_slave_module *const module) |
Attempt to get lock on driver instance. More... | |
static void | i2c_slave_unlock (struct i2c_slave_module *const module) |
Unlock driver instance. More... | |
Configuration and Initialization | |
static bool | i2c_slave_is_syncing (const struct i2c_slave_module *const module) |
Returns the synchronization status of the module. More... | |
static void | i2c_slave_get_config_defaults (struct i2c_slave_config *const config) |
Gets the I2C slave default configurations. More... | |
enum status_code | i2c_slave_init (struct i2c_slave_module *const module, Sercom *const hw, const struct i2c_slave_config *const config) |
Initializes the requested I2C hardware module. More... | |
static void | i2c_slave_enable (const struct i2c_slave_module *const module) |
Enables the I2C module. More... | |
static void | i2c_slave_disable (const struct i2c_slave_module *const module) |
Disables the I2C module. More... | |
void | i2c_slave_reset (struct i2c_slave_module *const module) |
Resets the hardware module. More... | |
Read and Write | |
enum status_code | i2c_slave_write_packet_wait (struct i2c_slave_module *const module, struct i2c_slave_packet *const packet) |
Writes a packet to the master. More... | |
enum status_code | i2c_slave_read_packet_wait (struct i2c_slave_module *const module, struct i2c_slave_packet *const packet) |
Reads a packet from the master. More... | |
enum i2c_slave_direction | i2c_slave_get_direction_wait (struct i2c_slave_module *const module) |
Waits for a start condition on the bus. More... | |
Status Management | |
uint32_t | i2c_slave_get_status (struct i2c_slave_module *const module) |
Retrieves the current module status. More... | |
void | i2c_slave_clear_status (struct i2c_slave_module *const module, uint32_t status_flags) |
Clears a module status flag. More... | |
SERCOM I2C slave with DMA Interfaces | |
static uint8_t | i2c_slave_dma_read_interrupt_status (struct i2c_slave_module *const module) |
Read SERCOM I2C interrupt status. More... | |
static void | i2c_slave_dma_write_interrupt_status (struct i2c_slave_module *const module, uint8_t flag) |
Write SERCOM I2C interrupt status. More... | |
#define PINMUX_DEFAULT 0 |
Referenced by i2c_slave_get_config_defaults().