LibTiePie  0.5
Library for interfacing TiePie engineering instruments
 All Files Functions Typedefs Macros Modules Pages
Reading data

Description

Functions to read data from an I2C device.

Functions

bool8_t I2CRead (TpDeviceHandle_t hDevice, uint16_t wAddress, void *pBuffer, uint32_t dwSize, bool8_t bStop)
 Read data from a specified address on the I2C bus, using a specified I2C host. More...
 
bool8_t I2CReadByte (TpDeviceHandle_t hDevice, uint16_t wAddress, uint8_t *pValue)
 Read one byte from a specified address on the I2C bus, using a specified I2C host. More...
 
bool8_t I2CReadWord (TpDeviceHandle_t hDevice, uint16_t wAddress, uint16_t *pValue)
 Read one word from a specified address on the I2C bus, using a specified I2C host. More...
 

Function Documentation

bool8_t I2CRead ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
void *  pBuffer,
uint32_t  dwSize,
bool8_t  bStop 
)

Read data from a specified address on the I2C bus, using a specified I2C host.

Parameters
[in]hDeviceA device handle identifying the I2C host.
[in]wAddressThe I2C address to read from.
[out]pBufferA pointer to the read buffer.
[in]dwSizeThe number of bytes to read.
[in]bStopIndicates whether an I2C stop is generated after the transaction, when BOOL8_TRUE, an I2C stop is generated, when BOOL8_FALSE not.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
Status values
INTERNAL_ADDRESS The requested I2C address is an internally used address in the device.
BIT_ERROR The requested I2C operation generated a bit error.
NO_ACKNOWLEDGE The requested I2C operation generated "No acknowledge".
INVALID_HANDLE The handle is not a valid I2C host handle.
DEVICE_GONE The device indicated by the device handle is no longer available.
LIBRARY_NOT_INITIALIZEDThe library is not initialized, see LibInit().
SUCCESS The function executed successfully.
See also
I2CReadByte
I2CReadWord
Since
0.4.0
bool8_t I2CReadByte ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint8_t *  pValue 
)

Read one byte from a specified address on the I2C bus, using a specified I2C host.

An I2C stop is generated after the transaction.

Parameters
[in]hDeviceA device handle identifying the I2C host.
[in]wAddressThe I2C address to read from.
[out]pValueA pointer to the read buffer.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
Status values
INTERNAL_ADDRESS The requested I2C address is an internally used address in the device.
BIT_ERROR The requested I2C operation generated a bit error.
NO_ACKNOWLEDGE The requested I2C operation generated "No acknowledge".
INVALID_HANDLE The handle is not a valid I2C host handle.
DEVICE_GONE The device indicated by the device handle is no longer available.
LIBRARY_NOT_INITIALIZEDThe library is not initialized, see LibInit().
SUCCESS The function executed successfully.
See also
I2CRead
I2CReadWord
Since
0.4.0
bool8_t I2CReadWord ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint16_t *  pValue 
)

Read one word from a specified address on the I2C bus, using a specified I2C host.

An I2C stop is generated after the transaction.

Parameters
[in]hDeviceA device handle identifying the I2C host.
[in]wAddressThe I2C address to read from.
[out]pValueA pointer to the read buffer.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
Note
Bus data is regarded big endian and converted to host endianess.
Status values
INTERNAL_ADDRESS The requested I2C address is an internally used address in the device.
BIT_ERROR The requested I2C operation generated a bit error.
NO_ACKNOWLEDGE The requested I2C operation generated "No acknowledge".
INVALID_HANDLE The handle is not a valid I2C host handle.
DEVICE_GONE The device indicated by the device handle is no longer available.
LIBRARY_NOT_INITIALIZEDThe library is not initialized, see LibInit().
SUCCESS The function executed successfully.
See also
I2CRead
I2CReadByte
Since
0.4.0