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 ) 87 typedef struct IotI2CConfig
114 struct 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 );
IotI2CHandle_t iot_i2c_open(int32_t lI2CInstance)
Initiates and reserves an I2C instance as master.
Definition: iot_i2c.h:104
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.
#define IOT_I2C_BUSY
Definition: iot_i2c.h:55
Definition: iot_i2c.h:106
IotI2COperationStatus_t
I2C operation status.
Definition: iot_i2c.h:76
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.
Definition: iot_i2c.h:101
Definition: iot_i2c.h:103
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
int32_t iot_i2c_close(IotI2CHandle_t const pxI2CPeripheral)
Stops the ongoing operation and de-initializes the I2C peripheral.
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.
uint32_t ulBusFreq
Definition: iot_i2c.h:90
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.
Definition: iot_i2c.h:105
Definition: iot_i2c.h:102
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.
I2C bus configuration.
Definition: iot_i2c.h:87
int32_t iot_i2c_ioctl(IotI2CHandle_t const pxI2CPeripheral, IotI2CIoctlRequest_t xI2CRequest, void *const pvBuffer)
Configures the I2C master with user configuration.
void(* IotI2CCallback_t)(IotI2COperationStatus_t xOpStatus, void *pvUserContext)
The callback function for completion of I2C operation.
Definition: iot_i2c.h:133
#define IOT_I2C_BUS_TIMEOUT
Definition: iot_i2c.h:59
uint32_t ulMasterTimeout
Definition: iot_i2c.h:89
int32_t iot_i2c_cancel(IotI2CHandle_t const pxI2CPeripheral)
This function is used to cancel the current operation in progress, if possible.
IotI2CBusStatus_t
I2C Bus status.
Definition: iot_i2c.h:67
Definition: iot_i2c.h:107
#define IOT_I2C_NACK
Definition: iot_i2c.h:58
#define IOT_I2C_SUCCESS
Definition: iot_i2c.h:53
IotI2CIoctlRequest_t
Ioctl request types.
Definition: iot_i2c.h:96