M2M_T_HW_I2C_RESULT m2m_hw_i2c_write(UINT16 address, UINT8 reg_addr, UINT8
*buffer, UINT8 len)
Description: the function writes data on an I2C device.
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
reg_addr: register address where the first byte is written
buffer: pointer to the buffer containing the data to write on I2C device (in hexadecimal
format)
len: length of the buffer in bytes, 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 |