Skip to content
Ken Sharp edited this page Dec 8, 2023 · 1 revision

I2cRead()

Read data from the I2C bus.

Syntax

I2cRead(unsigned char channel, unsigned char slaveAddress, unsigned char eofConfig, unsigned char numBytes, unsigned int timeout, unsigned char* recBuffer);

channel
The I2C master channel to read from.

slaveAddress
The slave address of the I2C device to read from.

eofConfig
End of frame configuration:

  • 0 - EOF_STOP - Stop
  • 1 - EOF_RESTART - Stop and restart
  • 2 - EOF_RESTART_NOSTOP - Restart with no stop
  • 3 - EOF_NOSTOP - No stop

numBytes
The number of bytes to read from the I2C device.

timeout
The maximum amount of time in mS to wait for all data bytes.

recBuffer
A pointer to an unsigned byte array to store the incoming data from the I2C device. This array must be at least numBytes in size.

Returns

int status

Related Links

Clone this wiki locally