You are here

U2C_GetByteWithAck()

U2C_RESULT U2C_GetByteWithAck(
      HANDLE hDevice,
      BYTE* pData,
      BOOL bAck
);

The U2C_GetByteWithAck() function shifts in (reads) a single byte from the I2C bus and then generates acknowledge or not-acknowledge condition according to the value passed in bAck parameter. It assumes that the bus is available, Start Condition has been previously generated and the slave device has been properly addressed. This function can be called several times to implement custom I2C-like protocol. The function does not finish the I2C bus transaction after transmission, so at the end of I2C transaction U2C_Stop() function has to be called.

Parameters:

hDevice

Handle to the U2C-12 device.

pData

A pointer to byte to be filled with data read from the I2C bus.

bAck

This parameter determines if acknowledge should be generated after the byte is transmitted. If bAck is TRUE - acknowledge will be generated, if bAck is FALSE - non-acknowledge will be generated.

Return values:

U2C_SUCCESS

Byte was successfully read from I2C bus.

U2C_HARDWARE_NOT_FOUND

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

Rating: 
No votes yet

Languages

User login