Search Results
I2CDriver
Files | |
file i2c.h | |
Common I2C interface, This file is derived from the Gomspace I2C driver,. | |
Data Structures | |
struct i2c_frame_s | |
Data structure for I2C frames. More... | |
Macros | |
#define E_NO_ERR -1 | |
The return value of the driver is a bit strange, It should return E_NO_ERR if successfull and the value is -1. More... | |
#define I2C_MTU 256 | |
Maximum transfer length on I2C. More... | |
#define I2C_MASTER 0 | |
I2C device modes. More... | |
#define I2C_SLAVE 1 | |
Typedefs | |
typedef struct i2c_frame_s i2c_frame_t | |
Data structure for I2C frames. More... | |
typedef void(* i2c_callback_t) (i2c_frame_t *frame, void *pxTaskWoken) | |
Initialise the I2C driver. More... | |
Functions | |
int i2c_init (int handle, int mode, uint8_t addr, uint16_t speed, int queue_len_tx, int queue_len_rx, i2c_callback_t callback) | |
int i2c_send (int handle, i2c_frame_t *frame, uint16_t timeout) | |
Send I2C frame via the selected device. More... | |
Data Structure Documentation
struct i2c_frame_s |
Data structure for I2C frames.
Data Fields | |
uint8_t padding | |
uint8_t retries | |
uint32_t reserved | |
uint8_t dest | |
uint8_t len_rx | |
uint16_t len | |
uint8_t data [I2C_MTU] | |
Field Documentation
uint8_t i2c_frame_s::data[I2C_MTU] |
uint8_t i2c_frame_s::dest |
uint16_t i2c_frame_s::len |
uint8_t i2c_frame_s::len_rx |
uint8_t i2c_frame_s::padding |
uint32_t i2c_frame_s::reserved |
uint8_t i2c_frame_s::retries |
Macro Definition Documentation
#define E_NO_ERR -1 |
The return value of the driver is a bit strange, It should return E_NO_ERR if successfull and the value is -1.
#define I2C_MASTER 0 |
I2C device modes.
#define I2C_MTU 256 |
Maximum transfer length on I2C.
#define I2C_SLAVE 1 |
Typedef Documentation
typedef void(* i2c_callback_t) (i2c_frame_t *frame, void *pxTaskWoken) |
Initialise the I2C driver.
- Parameters
-
handle Which I2C bus (if more than one exists) mode I2C device mode. Must be either I2C_MASTER or I2C_SLAVE addr Own slave address speed Bus speed in kbps queue_len_tx Length of transmit queue queue_len_rx Length of receive queue callback If this value is set, the driver will call this function instead of using an RX queue
- Returns
- Error code
typedef struct i2c_frame_s i2c_frame_t |
Data structure for I2C frames.
Function Documentation
int i2c_init | ( | int | handle, |
int | mode, | ||
uint8_t | addr, | ||
uint16_t | speed, | ||
int | queue_len_tx, | ||
int | queue_len_rx, | ||
i2c_callback_t | callback | ||
) |
int i2c_send | ( | int | handle, |
i2c_frame_t * | frame, | ||
uint16_t | timeout | ||
) |
Send I2C frame via the selected device.
- Parameters
-
handle Handle to the device frame Pointer to I2C frame timeout Ticks to wait
- Returns
- Error code