You are here

U2C_Read()

U2C_RESULT U2C_Read(
      HANDLE hDevice,
      PU2C_TRANSACTION pTransaction
);

The U2C_Read function() reads up to 256 bytes from the I2C slave device.

Parameters:

hDevice

Handle to the U2C-12 device.

pTransaction

Pointer to the U2C_TRANSACTION structure to be used during the I2C read transaction. Before calling the function this structure has to be partially filled:

  • nSlaveDeviceAddress - must contain the I 2 C slave device address.
  • nMemoryAddressLength - must contain the internal address length (in bytes from 0 up to 4). If nMemoryAddressLength is equal to 0, no address will be sent to device and repeated I 2 C start condition won't be generated.
  • MemoryAddress - must contain the internal I 2 C slave device address.
  • nBufferLength - must contain the number of bytes to be read from the I 2 C slave device.
After successful completion of the read operation Buffer member of the structure will be filled with data read from I2C slave device.

Return values:

U2C_SUCCESS

The data was successfully read.

U2C_HARDWARE_NOT_FOUND

U2C-12 device referenced by hDevice handle was not found.

U2C_SLAVE_OPENNING_FOR_WRITE_FAILED

I2C slave device did not acknowledge write slave address.

U2C_SLAVE_OPENNING_FOR_READ_FAILED

I2C slave device did not acknowledge read slave address.

U2C_SENDING_MEMORY_ADDRESS_FAILED

I2C slave device did not acknowledge internal address.

Rating: 
No votes yet

Languages

User login