AIROC™ BTSDK v4.8 - Documentation | ||||
Defines an I2C driver to facilitate communication with other devices on an I2C bus (such as a temperature sensor, etc). More...
Modules | |
I2C EEPROM Interface | |
Defines a driver for the I2C EEPROM interface. | |
Typedefs | |
typedef void | I2C_SLAVE_CALLBACK_HANDLER (uint32_t evtFlag, uint8_t *rx_PktPointer, uint16_t rx_PktLength) |
Enumerations | |
enum | { I2CM_SPEED_100KHZ = 233, I2CM_SPEED_400KHZ = 53, I2CM_SPEED_800KHZ = 23, I2CM_SPEED_1000KHZ = 17 } |
Enumeration of speed options. More... | |
enum | { I2CM_SUCCESS, I2CM_OP_FAILED } |
Enumeration of I2C transaction return values. More... | |
enum | { I2C_TRAN_EVENT_MASK_RX_DONE = 1, I2C_TRAN_EVENT_MASK_TX_DONE = 2, I2C_TRAN_EVENT_MASK_RX_STOP = 4 } |
Functions | |
void | wiced_hal_i2c_init (void) |
Initializes the I2C driver and its private values. More... | |
void | wiced_hal_i2c_set_speed (uint8_t speed) |
Sets the I2C bus speed. More... | |
uint8_t | wiced_hal_i2c_get_speed (void) |
Gets the current I2C bus speed. More... | |
uint8_t | wiced_hal_i2c_read (uint8_t *data, uint16_t length, uint8_t slave) |
Reads data into given buffer from the I2C HW addressing a particular slave address. More... | |
uint8_t | wiced_hal_i2c_write (uint8_t *data, uint16_t length, uint8_t slave) |
Writes the given data to the I2C HW addressing a particular slave address. More... | |
void | wiced_hal_i2c_select_pads (uint8_t scl_pin, uint8_t sda_pin) |
Configures GPIOs to use for I2C pins. More... | |
uint8_t | wiced_hal_i2c_combined_read (uint8_t *rx_data, uint8_t rx_data_len, uint8_t *tx_data, uint16_t tx_data_len, uint8_t slave) |
Executes two transactions back-to-back with a repeated start condition between the first and the second. More... | |
void | wiced_hal_i2c_slave_set_device_address (UINT8 address) |
void | wiced_hal_i2c_slave_select_pads (UINT32 scl_pin, UINT32 sda_pin) |
void | wiced_hal_i2c_slave_init (void) |
void | wiced_hal_i2c_slave_register_cb (I2C_SLAVE_CALLBACK_HANDLER *cb) |
void | wiced_hal_i2c_slave_synchronous_write (UINT8 *buffer, UINT32 length) |
Defines an I2C driver to facilitate communication with other devices on an I2C bus (such as a temperature sensor, etc).
The driver is only capable of assuming a master role. Applications use this driver to obtain the status from and control the behavior of the I2C hardware. This driver only offers services for speed control and data transfer operations.
Please note that even though this driver can access off-chip memory (if installed; EEPROM, etc), please use the drivers found in wiced_hal_ieeprom.h to access those modules, as those drivers include checks to ensure safe data handling operations. This driver is intended only to interface with other devices on the I2C bus, such as a motion sensor.
anonymous enum |
anonymous enum |
uint8_t wiced_hal_i2c_combined_read | ( | uint8_t * | rx_data, |
uint8_t | rx_data_len, | ||
uint8_t * | tx_data, | ||
uint16_t | tx_data_len, | ||
uint8_t | slave | ||
) |
Executes two transactions back-to-back with a repeated start condition between the first and the second.
tx_data is written to the slave in the first transaction while data is read back from the slave into rx_data after the repeated start.
[in,out] | rx_data | Pointer to a buffer that will hold the incoming data |
[in] | rx_data_len | The length in bytes of the data to read |
[in] | tx_data | Pointer to a buffer that will hold the outgoing data |
[in] | tx_data_len | The length in bytes of the data to write |
[in] | slave | The 7-bit slave address |
hal/i2c_master
uint8_t wiced_hal_i2c_get_speed | ( | void | ) |
Gets the current I2C bus speed.
Smaller numbers indicate higher speeds.
none |
hal/i2c_master
void wiced_hal_i2c_init | ( | void | ) |
Initializes the I2C driver and its private values.
This initialization sets the bus speed to 100KHz by default (I2CM_SPEED_100KHZ). To make the bus run at another speed, call wiced_hal_i2c_setSpeed(<speed>) right after this call.
none |
hal/i2c_master
uint8_t wiced_hal_i2c_read | ( | uint8_t * | data, |
uint16_t | length, | ||
uint8_t | slave | ||
) |
Reads data into given buffer from the I2C HW addressing a particular slave address.
The data bytes are transparent. Though any arbitrary length of data may be read from the slave, atomic transactions greater than HW's capability are not possible - they will be split into multiple transactions. This is a blocking call. Interrupts will not affect timing within a transaction.
[in,out] | data | Pointer to a buffer that will hold the incoming data |
[in] | length | The length in bytes of the data to read |
[in] | slave | The 7-bit slave address |
void wiced_hal_i2c_select_pads | ( | uint8_t | scl_pin, |
uint8_t | sda_pin | ||
) |
Configures GPIOs to use for I2C pins.
[in] | scl_pin | LHL GPIO to be used for SCL |
[in] | sda_pin | LHL GPIO to be used for SDA |
void wiced_hal_i2c_set_speed | ( | uint8_t | speed | ) |
Sets the I2C bus speed.
[in] | speed | The new speed to be used. Refer to the speeds in the parameter section |
hal/i2c_master
uint8_t wiced_hal_i2c_write | ( | uint8_t * | data, |
uint16_t | length, | ||
uint8_t | slave | ||
) |
Writes the given data to the I2C HW addressing a particular slave address.
The data bytes are transparent. Though any arbitrary length of data may be written to the slave, atomic transactions greater than HW's capability are not possible - they will be split into multiple transactions. This is a blocking call. Interrupts will not affect timing within a transaction.
[in] | data | Pointer to a buffer that will hold the outgoing data |
[in] | length | The length in bytes of the data to write |
[in] | slave | The 7-bit slave address |
hal/i2c_master