SAM I2C Master Driver.
Copyright (c) 2012-2020 Microchip Technology Inc. and its subsidiaries.
Functions | |
enum status_code | _i2c_master_address_response (struct i2c_master_module *const module) |
static enum status_code | _i2c_master_read_packet (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
enum status_code | _i2c_master_send_hs_master_code (struct i2c_master_module *const module, uint8_t hs_master_code) |
enum status_code | _i2c_master_wait_for_bus (struct i2c_master_module *const module) |
static enum status_code | _i2c_master_write_packet (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
enum status_code | i2c_master_init (struct i2c_master_module *const module, Sercom *const hw, const struct i2c_master_config *const config) |
Initializes the requested I2C hardware module. More... | |
enum status_code | i2c_master_read_byte (struct i2c_master_module *const module, uint8_t *byte) |
Reads one byte data from slave. More... | |
enum status_code | i2c_master_read_packet_wait (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
Reads data packet from slave. More... | |
enum status_code | i2c_master_read_packet_wait_no_nack (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
Reads data packet from slave without sending a nack signal and a stop condition when done. More... | |
enum status_code | i2c_master_read_packet_wait_no_stop (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
Reads data packet from slave without sending a stop condition when done. More... | |
void | i2c_master_reset (struct i2c_master_module *const module) |
Resets the hardware module. More... | |
void | i2c_master_send_nack (struct i2c_master_module *const module) |
Sends nack signal on bus. More... | |
void | i2c_master_send_stop (struct i2c_master_module *const module) |
Sends stop condition on bus. More... | |
enum status_code | i2c_master_write_byte (struct i2c_master_module *const module, uint8_t byte) |
Write one byte data to slave. More... | |
enum status_code | i2c_master_write_packet_wait (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
Writes data packet to slave. More... | |
enum status_code | i2c_master_write_packet_wait_no_stop (struct i2c_master_module *const module, struct i2c_master_packet *const packet) |
Writes data packet to slave without sending a stop condition when done. More... | |
enum status_code _i2c_master_address_response | ( | struct i2c_master_module *const | module | ) |
Referenced by _i2c_master_read_packet(), and _i2c_master_write_packet().
|
static |
Starts blocking read operation.
[in,out] | module | Pointer to software module struct |
[in,out] | packet | Pointer to I2C packet to transfer |
STATUS_OK | The packet was read successfully |
STATUS_ERR_TIMEOUT | If no response was given within specified timeout period |
STATUS_ERR_DENIED | If error on bus |
STATUS_ERR_PACKET_COLLISION | If arbitration is lost |
STATUS_ERR_BAD_ADDRESS | If slave is busy, or no slave acknowledged the address |
References _i2c_master_address_response(), _i2c_master_send_hs_master_code(), _i2c_master_wait_for_bus(), i2c_master_packet::address, Assert, i2c_master_packet::data, i2c_master_packet::data_length, i2c_master_packet::high_speed, i2c_master_packet::hs_master_code, I2C_TRANSFER_READ, STATUS_ERR_PACKET_COLLISION, STATUS_OK, and i2c_master_packet::ten_bit_address.
Referenced by i2c_master_read_packet_wait(), i2c_master_read_packet_wait_no_nack(), and i2c_master_read_packet_wait_no_stop().
enum status_code _i2c_master_send_hs_master_code | ( | struct i2c_master_module *const | module, |
uint8_t | hs_master_code | ||
) |
Send master code for high speed transfer.
[in,out] | module | Pointer to software module structure |
[in] | hs_master_code | 8-bit master code (0000 1XXX) |
STATUS_OK | No error happen |
References _i2c_master_wait_for_bus().
Referenced by _i2c_master_read_packet(), and _i2c_master_write_packet().
enum status_code _i2c_master_wait_for_bus | ( | struct i2c_master_module *const | module | ) |
|
static |
Starts blocking write operation.
[in,out] | module | Pointer to software module struct |
[in,out] | packet | Pointer to I2C packet to transfer |
STATUS_OK | The packet was write successfully |
STATUS_ERR_TIMEOUT | If no response was given within specified timeout period |
STATUS_ERR_DENIED | If error on bus |
STATUS_ERR_PACKET_COLLISION | If arbitration is lost |
STATUS_ERR_BAD_ADDRESS | If slave is busy, or no slave acknowledged the address |
References _i2c_master_address_response(), _i2c_master_send_hs_master_code(), _i2c_master_wait_for_bus(), i2c_master_packet::address, i2c_master_packet::data, i2c_master_packet::data_length, i2c_master_packet::high_speed, i2c_master_packet::hs_master_code, I2C_TRANSFER_WRITE, STATUS_ERR_OVERFLOW, STATUS_ERR_PACKET_COLLISION, STATUS_OK, and i2c_master_packet::ten_bit_address.
Referenced by i2c_master_write_packet_wait(), and i2c_master_write_packet_wait_no_stop().