NXC
Version 1.2.1 r5
|
|
inline |
Perform an I2C write/read transaction.
This method writes the bytes contained in the input buffer (inbuf) to the I2C device on the specified port, checks for the specified number of bytes to be ready for reading, and then tries to read the specified number (count) of bytes from the I2C device into the output buffer (outbuf).
This is a higher-level wrapper around the three main I2C functions. It also maintains a "last good read" buffer and returns values from that buffer if the I2C communication transaction fails.
port | The port to which the I2C device is attached. See the Input port constants group. You may use a constant or a variable. Constants should be used where possible to avoid blocking access to I2C devices on other ports by code running on other threads. |
inbuf | A byte array containing the address of the I2C device, the I2C device register at which to write data, and up to 14 bytes of data to be written at the specified register. |
count | The number of bytes that should be returned by the I2C device. On output count is set to the number of bytes in outbuf. |
outbuf | A byte array that contains the data read from the internal I2C buffer. |