I2C_WriteRead

The function I2C_WriteRead writes pInBuffer to the I2C and reads data from I2C to pOutBuffer.

BOOL I2C_WriteRead( UCHAR SlaveAddress, UCHAR* pInBuffer, int inbytes, UCHAR* pOutBuffer, int outbytes );

Return Values

If the function fails, the return value is 0. If the function succeeds, the return value is 1.

Parameters

uSlaveAddress
Slave-Address of i2c-device.

pInBuffer
Pointer to a Buffer that is send to the I2C device.

inbytes
Number of bytes in pInBuffer.

pOutBuffer
Pointer to a Buffer which receives the bytes read.

outbytes
Number of bytes to receive in pOutBuffer.

Remarks

Issues following sequence:

If pInBuffer is not NULL:

  • Start

  • SlaveAddress with write-bit

  • send pInBuffer (inbytes)

  • Stop

If pOutBuffer is not NULL:

  • Start

  • SlaveAddress with read-bit

  • fill pOutBuffer (outbytes)

  • Stop

Requirements

OS Versions: Windows Embedded Compact 7 and later.
Module: Trizeps VII
Header: drvlib_app.h
Link Library: drvlib_app.lib

See Also

I2C_ReadBurst