I2C Driver¶
-
group
I2CDriver
Defines
-
E_NO_ERR
¶ The return value of the driver is a bit strange, It should return E_NO_ERR if successfull and the value is -1.
-
I2C_MTU
¶ Maximum transfer length on I2C.
-
I2C_MASTER
¶ I2C device modes.
-
I2C_SLAVE
¶
Typedefs
-
typedef struct i2c_frame_s
i2c_frame_t
¶ Data structure for I2C frames.
-
typedef void (*
i2c_callback_t
)(i2c_frame_t *frame, void *pxTaskWoken)¶ Initialise the I2C driver.
- Return
- Error code
- Parameters
handle
: Which I2C bus (if more than one exists)mode
: I2C device mode. Must be either I2C_MASTER or I2C_SLAVEaddr
: Own slave addressspeed
: Bus speed in kbpsqueue_len_tx
: Length of transmit queuequeue_len_rx
: Length of receive queuecallback
: If this value is set, the driver will call this function instead of using an RX queue
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.
- Return
- Error code
- Parameters
handle
: Handle to the deviceframe
: Pointer to I2C frametimeout
: Ticks to wait
-
struct
i2c_frame_s
¶ - #include <i2c.h>
Data structure for I2C frames.
-