45#define IOT_I2C_STANDARD_MODE_BPS ( 100000 )
46#define IOT_I2C_FAST_MODE_BPS ( 400000 )
47#define IOT_I2C_FAST_MODE_PLUS_BPS ( 1000000 )
48#define IOT_I2C_HIGH_SPEED_BPS ( 3400000 )
53#define IOT_I2C_SUCCESS ( 0 )
54#define IOT_I2C_INVALID_VALUE ( 1 )
55#define IOT_I2C_BUSY ( 2 )
56#define IOT_I2C_WRITE_FAILED ( 3 )
57#define IOT_I2C_READ_FAILED ( 4 )
58#define IOT_I2C_NACK ( 5 )
59#define IOT_I2C_BUS_TIMEOUT ( 6 )
60#define IOT_I2C_NOTHING_TO_CANCEL ( 7 )
61#define IOT_I2C_FUNCTION_NOT_SUPPORTED ( 8 )
62#define IOT_I2C_SLAVE_ADDRESS_NOT_SET ( 9 )
87typedef struct IotI2CConfig
114struct IotI2CDescriptor;
134 void * pvUserContext );
171 void * pvUserContext );
271 uint8_t *
const pucBuffer,
308 uint8_t *
const pucBuffer,
348 uint8_t *
const pucBuffer,
389 uint8_t *
const pucBuffer,
443 void *
const pvBuffer );
int32_t iot_i2c_cancel(IotI2CHandle_t const pxI2CPeripheral)
This function is used to cancel the current operation in progress, if possible.
int32_t iot_i2c_write_sync(IotI2CHandle_t const pxI2CPeripheral, uint8_t *const pucBuffer, size_t xBytes)
Starts the I2C master write operation in synchronous mode.
void(* IotI2CCallback_t)(IotI2COperationStatus_t xOpStatus, void *pvUserContext)
The callback function for completion of I2C operation.
Definition: iot_i2c.h:133
int32_t iot_i2c_read_async(IotI2CHandle_t const pxI2CPeripheral, uint8_t *const pucBuffer, size_t xBytes)
Starts the I2C master read operation in asynchronous mode.
int32_t iot_i2c_close(IotI2CHandle_t const pxI2CPeripheral)
Stops the ongoing operation and de-initializes the I2C peripheral.
#define IOT_I2C_BUS_TIMEOUT
Definition: iot_i2c.h:59
void iot_i2c_set_callback(IotI2CHandle_t const pxI2CPeripheral, IotI2CCallback_t xCallback, void *pvUserContext)
Sets the application callback to be called on completion of an operation.
struct IotI2CDescriptor * IotI2CHandle_t
IotI2CHandle_t is the handle type returned by calling iot_i2c_open(). This is initialized in open and...
Definition: iot_i2c.h:121
#define IOT_I2C_BUSY
Definition: iot_i2c.h:55
#define IOT_I2C_SUCCESS
Definition: iot_i2c.h:53
#define IOT_I2C_NACK
Definition: iot_i2c.h:58
IotI2COperationStatus_t
I2C operation status.
Definition: iot_i2c.h:77
int32_t iot_i2c_write_async(IotI2CHandle_t const pxI2CPeripheral, uint8_t *const pucBuffer, size_t xBytes)
Starts the I2C master write operation in asynchronous mode.
IotI2CBusStatus_t
I2C Bus status.
Definition: iot_i2c.h:68
int32_t iot_i2c_ioctl(IotI2CHandle_t const pxI2CPeripheral, IotI2CIoctlRequest_t xI2CRequest, void *const pvBuffer)
Configures the I2C master with user configuration.
int32_t iot_i2c_read_sync(IotI2CHandle_t const pxI2CPeripheral, uint8_t *const pucBuffer, size_t xBytes)
Starts the I2C master read operation in synchronous mode.
IotI2CIoctlRequest_t
Ioctl request types.
Definition: iot_i2c.h:97
IotI2CHandle_t iot_i2c_open(int32_t lI2CInstance)
Initiates and reserves an I2C instance as master.
@ eI2CDriverFailed
Definition: iot_i2c.h:79
@ eI2CCompleted
Definition: iot_i2c.h:78
@ eI2CMasterTimeout
Definition: iot_i2c.h:81
@ eI2CNackFromSlave
Definition: iot_i2c.h:80
@ eI2CBusIdle
Definition: iot_i2c.h:69
@ eI2cBusBusy
Definition: iot_i2c.h:70
@ eI2CGetTxNoOfbytes
Definition: iot_i2c.h:106
@ eI2CSetSlaveAddr
Definition: iot_i2c.h:101
@ eI2CSetMasterConfig
Definition: iot_i2c.h:102
@ eI2CGetBusState
Definition: iot_i2c.h:104
@ eI2CBusReset
Definition: iot_i2c.h:105
@ eI2CSendNoStopFlag
Definition: iot_i2c.h:98
@ eI2CGetMasterConfig
Definition: iot_i2c.h:103
@ eI2CGetRxNoOfbytes
Definition: iot_i2c.h:107
I2C bus configuration.
Definition: iot_i2c.h:88
uint32_t ulMasterTimeout
Definition: iot_i2c.h:89
uint32_t ulBusFreq
Definition: iot_i2c.h:90