NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
long I2CBytes ( const byte  port,
byte  inbuf[],
byte &  count,
byte &  outbuf[] 

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.

portThe 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.
inbufA 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.
countThe number of bytes that should be returned by the I2C device. On output count is set to the number of bytes in outbuf.
outbufA byte array that contains the data read from the internal I2C buffer.
Returns true or false indicating whether the I2C transaction succeeded or failed.
See Also
I2CCheckStatus, I2CWrite, I2CStatus, I2CBytesReady, I2CRead, LowspeedRead, LowspeedWrite, LowspeedCheckStatus, LowspeedBytesReady, and LowspeedStatus