LibTiePie  0.4.0
Library for interfacing TiePie engineering instruments
 All Files Functions Typedefs Groups Pages
I2CHost

Functions

bool8_t I2CRead (TpDeviceHandle_t hDevice, uint16_t wAddress, void *pBuffer, uint32_t dwSize, bool8_t bStop)
 Read data from the I2C bus.
 
bool8_t I2CReadByte (TpDeviceHandle_t hDevice, uint16_t wAddress, uint8_t *pValue)
 Read one byte from the I2C bus.
 
bool8_t I2CReadWord (TpDeviceHandle_t hDevice, uint16_t wAddress, uint16_t *pValue)
 Read one word from the I2C bus.
 
bool8_t I2CWrite (TpDeviceHandle_t hDevice, uint16_t wAddress, void *pBuffer, uint32_t dwSize, bool8_t bStop)
 Write data to the I2C bus.
 
bool8_t I2CWriteByte (TpDeviceHandle_t hDevice, uint16_t wAddress, uint8_t byValue)
 Write one byte to the I2C bus.
 
bool8_t I2CWriteByteByte (TpDeviceHandle_t hDevice, uint16_t wAddress, uint8_t byValue1, uint8_t byValue2)
 Write two bytes to the I2C bus.
 
bool8_t I2CWriteByteWord (TpDeviceHandle_t hDevice, uint16_t wAddress, uint8_t byValue1, uint16_t wValue2)
 Write one byte and one word to the I2C bus.
 
bool8_t I2CWriteWord (TpDeviceHandle_t hDevice, uint16_t wAddress, uint16_t wValue)
 Write one word to the I2C bus.
 
double I2CGetSpeed (TpDeviceHandle_t hDevice)
 Get the current I2C bus frequency.
 
double I2CGetSpeedMax (TpDeviceHandle_t hDevice)
 Get the maximum I2C bus frequency.
 
double I2CSetSpeed (TpDeviceHandle_t hDevice, double dSpeed)
 Set the I2C bus frequency.
 
double I2CVerifySpeed (TpDeviceHandle_t hDevice, double dSpeed)
 Verify the I2C bus frequency.
 
bool8_t I2CIsInternalAddress (TpDeviceHandle_t hDevice, uint16_t wAddress)
 Check whether an address is used internally.
 

Detailed Description

Function Documentation

double I2CGetSpeed ( TpDeviceHandle_t  hDevice)

Get the current I2C bus frequency.

Parameters
hDeviceA device handle.
Returns
Bus frequency in Hz.
double I2CGetSpeedMax ( TpDeviceHandle_t  hDevice)

Get the maximum I2C bus frequency.

Parameters
hDeviceA device handle.
Returns
Maximum bus frequency in Hz.
bool8_t I2CIsInternalAddress ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress 
)

Check whether an address is used internally.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
Returns
BOOL8_TRUE if internal address, BOOL8_FALSE otherwise.
bool8_t I2CRead ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
void *  pBuffer,
uint32_t  dwSize,
bool8_t  bStop 
)

Read data from the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
pBufferPointer to buffer for read data.
dwSizeBuffer size in bytes.
bStopIf BOOL8_TRUE a I2C stop is generated after the transaction, if BOOL8_FALSE no I2C stop is generated after the transaction.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CReadByte ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint8_t *  pValue 
)

Read one byte from the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
pValuePointer to buffer for read data.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CReadWord ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint16_t *  pValue 
)

Read one word from the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
pValuePointer to buffer for read data.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
double I2CSetSpeed ( TpDeviceHandle_t  hDevice,
double  dSpeed 
)

Set the I2C bus frequency.

Parameters
hDeviceA device handle.
dSpeedThe requested bus frequency in Hz.
Returns
Bus frequency that was actually set, in Hz.
double I2CVerifySpeed ( TpDeviceHandle_t  hDevice,
double  dSpeed 
)

Verify the I2C bus frequency.

Parameters
hDeviceA device handle.
dSpeedThe requested bus frequency in Hz.
Returns
Bus frequency that would be set, in Hz.
bool8_t I2CWrite ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
void *  pBuffer,
uint32_t  dwSize,
bool8_t  bStop 
)

Write data to the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
pBufferPointer to write buffer.
dwSizeLength of write buffer in bytes.
bStopIf BOOL8_TRUE a I2C stop is generated after the transaction, if BOOL8_FALSE no I2C stop is generated after the transaction.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CWriteByte ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint8_t  byValue 
)

Write one byte to the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
byValueByte value to write.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CWriteByteByte ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint8_t  byValue1,
uint8_t  byValue2 
)

Write two bytes to the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
byValue1First byte value to write.
byValue2Second byte value to write.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CWriteByteWord ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint8_t  byValue1,
uint16_t  wValue2 
)

Write one byte and one word to the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
byValue1Byte value to write.
wValue2Word value to write.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.
bool8_t I2CWriteWord ( TpDeviceHandle_t  hDevice,
uint16_t  wAddress,
uint16_t  wValue 
)

Write one word to the I2C bus.

Parameters
hDeviceA device handle.
wAddressAn I2C device address.
wValueWord value to write.
Returns
BOOL8_TRUE if successful, BOOL8_FALSE otherwise.