SAM I2C Slave Driver.
Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.
Functions | |
static enum status_code | _i2c_slave_set_config (struct i2c_slave_module *const module, const struct i2c_slave_config *const config) |
static enum status_code | _i2c_slave_wait_for_bus (struct i2c_slave_module *const module) |
void | i2c_slave_clear_status (struct i2c_slave_module *const module, uint32_t status_flags) |
Clears a module status flag. 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... | |
uint32_t | i2c_slave_get_status (struct i2c_slave_module *const module) |
Retrieves the current module status. 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... | |
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... | |
void | i2c_slave_reset (struct i2c_slave_module *const module) |
Resets the hardware module. More... | |
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... | |
|
static |
Sets configuration to module
[out] | module | Pointer to software module structure |
[in] | config | Configuration structure with configurations to set |
STATUS_OK | Module was configured correctly |
STATUS_ERR_ALREADY_INITIALIZED | If setting other GCLK generator than previously set |
References _sercom_get_default_pad(), i2c_slave_config::address, i2c_slave_config::address_mask, i2c_slave_config::address_mode, Assert, i2c_slave_config::buffer_timeout, system_pinmux_config::direction, i2c_slave_config::enable_general_call_address, I2C_SLAVE_SPEED_HIGH_SPEED, system_pinmux_config::mux_position, PINMUX_DEFAULT, i2c_slave_config::pinmux_pad0, i2c_slave_config::pinmux_pad1, i2c_slave_config::run_in_standby, i2c_slave_config::scl_low_timeout, i2c_slave_config::scl_stretch_only_after_ack_bit, i2c_slave_config::sda_hold_time, i2c_slave_config::slave_scl_low_extend_timeout, STATUS_OK, system_is_debugger_present(), system_pinmux_get_config_defaults(), SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK, system_pinmux_pin_set_config(), i2c_slave_config::ten_bit_address, and i2c_slave_config::transfer_speed.
Referenced by i2c_slave_init().
|
static |
Waits for answer on bus
[in] | module | Pointer to software module structure |
STATUS_OK | If given response from slave device |
STATUS_ERR_TIMEOUT | If no response was given within specified timeout period |
References Assert, STATUS_ERR_TIMEOUT, and STATUS_OK.
Referenced by i2c_slave_get_direction_wait(), i2c_slave_read_packet_wait(), and i2c_slave_write_packet_wait().