4 #include <twr_common.h> 11 #define TWR_I2C_MEMORY_ADDRESS_16_BIT 0x80000000
bool twr_i2c_write(twr_i2c_channel_t channel, const twr_i2c_transfer_t *transfer)
Write to I2C channel.
bool twr_i2c_memory_write(twr_i2c_channel_t channel, const twr_i2c_memory_transfer_t *transfer)
Memory write to I2C channel.
uint32_t memory_address
8-bit I2C memory address (it can be extended to 16-bit format if OR-ed with TWR_I2C_MEMORY_ADDRESS_16...
bool twr_i2c_memory_write_16b(twr_i2c_channel_t channel, uint8_t device_address, uint32_t memory_address, uint16_t data)
Memory write 2 bytes to I2C channel.
I2C communication speed is 100 kHz.
uint8_t device_address
7-bit I2C device address
twr_i2c_speed_t twr_i2c_get_speed(twr_i2c_channel_t channel)
Get speed I2C channel.
bool twr_i2c_memory_read(twr_i2c_channel_t channel, const twr_i2c_memory_transfer_t *transfer)
Memory read from I2C channel.
void twr_i2c_set_speed(twr_i2c_channel_t channel, twr_i2c_speed_t speed)
Set I2C channel speed.
void * buffer
Pointer to buffer which is being written or read.
void twr_i2c_init(twr_i2c_channel_t channel, twr_i2c_speed_t speed)
Initialize I2C channel.
twr_i2c_speed_t
I2C communication speed.
I2C memory transfer parameters.
bool twr_i2c_memory_read_16b(twr_i2c_channel_t channel, uint8_t device_address, uint32_t memory_address, uint16_t *data)
Memory read 2 bytes from I2C channel.
bool twr_i2c_memory_write_8b(twr_i2c_channel_t channel, uint8_t device_address, uint32_t memory_address, uint8_t data)
Memory write 1 byte to I2C channel.
size_t length
Length of buffer which is being written or read.
twr_i2c_channel_t
I2C channels.
bool twr_i2c_read(twr_i2c_channel_t channel, const twr_i2c_transfer_t *transfer)
Read from I2C channel.
void * buffer
Pointer to buffer which is being written or read.
size_t length
Length of buffer which is being written or read.
bool twr_i2c_memory_read_8b(twr_i2c_channel_t channel, uint8_t device_address, uint32_t memory_address, uint8_t *data)
Memory read 1 byte from I2C channel.
void twr_i2c_deinit(twr_i2c_channel_t channel)
Deitialize I2C channel.
I2C communication speed is 400 kHz.
uint8_t device_address
7-bit I2C device address