M2M_T_HW_I2C_RESULT m2m_hw_i2c_cmb_format (UINT16 address, UINT8 *buffer, UINT8
len_wr, UINT8 len_rd)
Description: the function allows performing I2C Combined Format.
Parameters:
address: address of the I2C device, with the LSB used as read\write command. It does not
matter if the LSB is set to 0 or to 1. 10 bits address is supported.
buffer: pointer to the buffer containing the data to write on I2C device (len_wr >0) and where
store the data read from I2C device (len_rd>0); data are in hexadecimal format.
len_wr: number of bytes to write. See M2M_HW_I2C_MAX_BUF_LEN.
len_rd: number of bytes to read. See M2M_HW_I2C_MAX_BUF_LEN.
Return value:
refer to M2M_T_HW_I2C_RESULT enum
Example of "address" parameter format:
Suppose that the I2C device has the address 7 bits long, for example: 0x0F. The I2C device address must be shifted to left by one bit as shown below. It is up to the function to set the bit 0 in accordance with the command.
|
I2C device address |
Writing command | ||||||
"address" parameter |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
x |
bits |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |