26.1.5.9 i2c_m_async_cmd_read
Async version of read register value from the I2C slave.
int32_t i2c_m_async_cmd_read(
struct i2c_m_async_desc *const i2c,
uint8_t reg,
uint8_t * value
)
This function will read a byte value from a specified reg in the I2C slave device and then return before the last sub-operation is done.
The sequence of this routine is sta->address(write)->ack->reg address->ack->resta->address(read)->ack->reg value->nack->stt
Parameters
- i2c
-
Type: struct i2c_m_async_desc Struct *const
An I2C master descriptor, which is used to communicate through I2C
- reg
-
Type: uint8_t
The internal address/register of the I2C slave device
- value
-
Type: uint8_t *
The value read from the I2C slave device
Returns
Type: int32_t
The status whether successfully read from the device
- <0
-
The passed parameters were invalid or read fail
- 0
-
Reading from register is completed successfully