Firmware SDK
|
Driver for I2C bus. More...
Data Structures | |
struct | twr_i2c_transfer_t |
I2C transfer parameters. More... | |
struct | twr_i2c_memory_transfer_t |
I2C memory transfer parameters. More... | |
Macros | |
#define | TWR_I2C_MEMORY_ADDRESS_16_BIT 0x80000000 |
This flag extends I2C memory transfer address from 8-bit to 16-bit. | |
Enumerations | |
enum | twr_i2c_channel_t { TWR_I2C_I2C0 = 0 , TWR_I2C_I2C1 = 1 , TWR_I2C_I2C_1W = 2 } |
I2C channels. More... | |
enum | twr_i2c_speed_t { TWR_I2C_SPEED_100_KHZ = 0 , TWR_I2C_SPEED_400_KHZ = 1 } |
I2C communication speed. More... | |
Functions | |
void | twr_i2c_init (twr_i2c_channel_t channel, twr_i2c_speed_t speed) |
Initialize I2C channel. More... | |
void | twr_i2c_deinit (twr_i2c_channel_t channel) |
Deitialize I2C channel. More... | |
twr_i2c_speed_t | twr_i2c_get_speed (twr_i2c_channel_t channel) |
Get speed I2C channel. More... | |
void | twr_i2c_set_speed (twr_i2c_channel_t channel, twr_i2c_speed_t speed) |
Set I2C channel speed. More... | |
bool | twr_i2c_write (twr_i2c_channel_t channel, const twr_i2c_transfer_t *transfer) |
Write to I2C channel. More... | |
bool | twr_i2c_read (twr_i2c_channel_t channel, const twr_i2c_transfer_t *transfer) |
Read from I2C channel. More... | |
bool | twr_i2c_memory_write (twr_i2c_channel_t channel, const twr_i2c_memory_transfer_t *transfer) |
Memory write to I2C channel. More... | |
bool | twr_i2c_memory_read (twr_i2c_channel_t channel, const twr_i2c_memory_transfer_t *transfer) |
Memory read from I2C channel. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Driver for I2C bus.
enum twr_i2c_channel_t |
enum twr_i2c_speed_t |
void twr_i2c_deinit | ( | twr_i2c_channel_t | channel | ) |
Deitialize I2C channel.
[in] | channel | I2C channel |
Definition at line 140 of file twr_i2c.c.
Referenced by twr_zssc3123_deinit().
twr_i2c_speed_t twr_i2c_get_speed | ( | twr_i2c_channel_t | channel | ) |
void twr_i2c_init | ( | twr_i2c_channel_t | channel, |
twr_i2c_speed_t | speed | ||
) |
Initialize I2C channel.
[in] | channel | I2C channel |
[in] | speed | I2C communication speed |
Definition at line 57 of file twr_i2c.c.
Referenced by twr_atsha204_init(), twr_cy8cmbr3102_init(), twr_ds2484_init(), twr_hdc2080_init(), twr_hts221_init(), twr_lis2dh12_init(), twr_module_infra_grid_init(), twr_mpl3115a2_init(), twr_opt3001_init(), twr_sam_m8q_init(), twr_sc16is740_init(), twr_sgp30_init(), twr_sgpc3_init(), twr_sht20_init(), twr_sht30_init(), twr_sps30_init(), twr_ssd1306_init(), twr_tag_nfc_init(), twr_tca9534a_init(), twr_tmp112_init(), and twr_zssc3123_init().
bool twr_i2c_memory_read | ( | twr_i2c_channel_t | channel, |
const twr_i2c_memory_transfer_t * | transfer | ||
) |
Memory read from I2C channel.
[in] | channel | I2C channel |
[in] | transfer | Pointer to I2C memory transfer parameters instance |
Definition at line 371 of file twr_i2c.c.
Referenced by twr_i2c_memory_read_16b(), twr_i2c_memory_read_8b(), twr_module_infra_grid_read_values(), twr_sc16is740_read(), and twr_tag_nfc_init().
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.
[in] | channel | I2C channel |
[in] | device_address | 7-bit I2C device address |
[in] | memory_address | 8-bit I2C memory address (it can be extended to 16-bit format if OR-ed with TWR_I2C_MEMORY_ADDRESS_16_BIT) |
[out] | data | Output data which have been read (MSB first) |
Definition at line 449 of file twr_i2c.c.
Referenced by twr_cy8cmbr3102_get_proximity().
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.
[in] | channel | I2C channel |
[in] | device_address | 7-bit I2C device address |
[in] | memory_address | 8-bit I2C memory address (it can be extended to 16-bit format if OR-ed with TWR_I2C_MEMORY_ADDRESS_16_BIT) |
[out] | data | Output data which have been read |
Definition at line 437 of file twr_i2c.c.
Referenced by twr_cy8cmbr3102_is_touch(), twr_hts221_deinit(), twr_module_infra_grid_read_thermistor(), twr_sc16is740_available(), twr_sc16is740_get_spaces_available(), twr_sc16is740_set_baudrate(), twr_tca9534a_init(), and twr_tca9534a_read_port().
bool twr_i2c_memory_write | ( | twr_i2c_channel_t | channel, |
const twr_i2c_memory_transfer_t * | transfer | ||
) |
Memory write to I2C channel.
[in] | channel | I2C channel |
[in] | transfer | Pointer to I2C memory transfer parameters instance |
Definition at line 333 of file twr_i2c.c.
Referenced by twr_i2c_memory_write_16b(), twr_i2c_memory_write_8b(), twr_sc16is740_write(), and twr_tag_nfc_init().
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.
[in] | channel | I2C channel |
[in] | device_address | 7-bit I2C device address |
[in] | memory_address | 8-bit I2C memory address (it can be extended to 16-bit format if OR-ed with TWR_I2C_MEMORY_ADDRESS_16_BIT) |
[in] | data | Input data to be written (MSB first) |
Definition at line 420 of file twr_i2c.c.
Referenced by twr_opt3001_deinit(), twr_tmp112_deinit(), twr_zssc3123_eeprom_read(), twr_zssc3123_eeprom_write(), twr_zssc3123_end_cm(), twr_zssc3123_start_cm(), and twr_zssc3123_unlock_eeprom().
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.
[in] | channel | I2C channel |
[in] | device_address | 7-bit I2C device address |
[in] | memory_address | 8-bit I2C memory address (it can be extended to 16-bit format if OR-ed with TWR_I2C_MEMORY_ADDRESS_16_BIT) |
[in] | data | Input data to be written |
Definition at line 408 of file twr_i2c.c.
Referenced by twr_hdc2080_deinit(), twr_hts221_deinit(), twr_lis2dh12_set_alarm(), twr_module_rs485_deinit(), twr_mpl3115a2_deinit(), twr_sc16is740_init(), twr_sc16is740_reset_fifo(), twr_sc16is740_set_baudrate(), twr_tca9534a_set_port_direction(), and twr_tca9534a_write_port().
bool twr_i2c_read | ( | twr_i2c_channel_t | channel, |
const twr_i2c_transfer_t * | transfer | ||
) |
Read from I2C channel.
[in] | channel | I2C channel |
[in] | transfer | Pointer to I2C transfer parameters instance |
Definition at line 289 of file twr_i2c.c.
Referenced by twr_zssc3123_eeprom_read().
void twr_i2c_set_speed | ( | twr_i2c_channel_t | channel, |
twr_i2c_speed_t | speed | ||
) |
Set I2C channel speed.
[in] | channel | I2C channel |
[in] | speed | I2C communication speed |
Definition at line 200 of file twr_i2c.c.
Referenced by twr_i2c_init().
bool twr_i2c_write | ( | twr_i2c_channel_t | channel, |
const twr_i2c_transfer_t * | transfer | ||
) |