Ucs_Return_t Ucs_I2c_ReadPort | ( | Ucs_Inst_t * | self, |
uint16_t | node_address, | ||
uint16_t | port_handle, | ||
uint8_t | slave_address, | ||
uint8_t | data_len, | ||
uint16_t | timeout, | ||
Ucs_I2c_ReadPortResCb_t | result_fptr | ||
) |
Reads a block of bytes from an I2C device at a specified I2C address.
This function corresponds with the INIC function INIC.I2CPortRead. |
self | The UNICENS instance pointer | ||
node_address | Address of the target device. Use the UCS_ADDR_LOCAL_NODE macro to target the local device. The following address ranges are supported:
| ||
port_handle | Port resource handle.
| ||
slave_address | The 7-bit I2C slave address of the peripheral to be read.
| ||
data_len | Number of bytes to be read from the address.
| ||
timeout | The timeout for the I2C Port read.
| ||
result_fptr | Required result callback function pointer. |
Value | Description |
---|---|
UCS_RET_SUCCESS | No error |
UCS_RET_ERR_PARAM | At least one parameter is wrong. |
UCS_RET_ERR_BUFFER_OVERFLOW | No message buffer is available. |
UCS_RET_ERR_API_LOCKED | API is currently locked. |
UCS_RET_ERR_NOT_SUPPORTED | API is not supported in the current Network Supervisor Mode. |
UCS_RET_ERR_NOT_INITIALIZED | UNICENS is not initialized. |
See also section Example for Ucs_I2c_ReadPort for an example implementation. |