25 I2C_RESULT_SUCCESS = 0,
26 I2C_RESULT_ERR_ADDR_NACK = -1,
27 I2C_RESULT_ERR_BUSSTATE = -2,
28 I2C_RESULT_ERR_BUSERR = -3,
29 I2C_RESULT_ERR_DATA_NACK = -4,
58i2c_result_t
i2c_write(uint8_t address, uint8_t* data,
size_t len);
66i2c_result_t
i2c_read(uint8_t address, uint8_t* data,
size_t len);
103i2c_result_t
i2c_write_instance(uint8_t sercom, uint8_t address, uint8_t* data,
size_t len);
112i2c_result_t
i2c_read_instance(uint8_t sercom, uint8_t address, uint8_t* data,
size_t len);
i2c_result_t i2c_write_instance(uint8_t sercom, uint8_t address, uint8_t *data, size_t len)
Writes data to an I2C device on the given SERCOM at the provided address.
Definition i2c.c:99
void i2c_init(void)
Initializes the I2C peripheral for a board with a defined I2C_SERCOM.
void i2c_enable(void)
Enables the I2C peripheral for a board with a defined I2C_SERCOM.
i2c_result_t i2c_write(uint8_t address, uint8_t *data, size_t len)
Writes data to an I2C device at the provided address.
i2c_result_t i2c_read_instance(uint8_t sercom, uint8_t address, uint8_t *data, size_t len)
Reads data from an I2C device on the given SERCOM at the provided address.
Definition i2c.c:152
void i2c_enable_instance(uint8_t sercom)
Enables the I2C peripheral on the given SERCOM.
Definition i2c.c:87
bool i2c_is_enabled_instance(uint8_t sercom)
Checks if the I2C peripheral on the given SERCOM is currently enabled.
Definition i2c.c:95
void i2c_disable_instance(uint8_t sercom)
Disables the I2C peripheral on the given SERCOM.
Definition i2c.c:198
void i2c_disable(void)
Disables the I2C peripheral for a board with defined SDA/SCL pins.
bool i2c_is_enabled(void)
Checks if the I2C peripheral is currently enabled for a board with a defined I2C_SERCOM.
void i2c_init_instance(uint8_t sercom, uint32_t baud)
Initializes an I2C peripheral on the given SERCOM.
Definition i2c.c:48
i2c_result_t i2c_read(uint8_t address, uint8_t *data, size_t len)
Reads data from an I2C device at the provided address.