LibTiePie  0.6.1
Library for interfacing TiePie engineering instruments
I2C Host

Description

Functions to setup and control I2C hosts.

All I2C host related functions require an I2C host handle to identify the I2C host, see opening a device.

Some I2C addresses may be reserved for internal use in the instrument, these addresses can not be controlled via the I2C host routines. Use I2CIsInternalAddress() to check whether an address is used internally.

Modules

 Reading data
 Functions to read data from an I2C device.
 
 Writing data
 Functions to write data to an I2C device.
 
 Writing/reading data
 Functions to write and read data to/from an I2C device.
 
 Speed
 Functions to control the I2C clock speed.
 

Functions

bool8_t I2CIsInternalAddress (LibTiePieHandle_t hDevice, uint16_t wAddress)
 Check whether an address is used internally. More...
 
uint32_t I2CGetInternalAddresses (LibTiePieHandle_t hDevice, uint16_t *pAddresses, uint32_t dwLength)
 Get all addresses which are used internally. More...
 

Function Documentation

bool8_t I2CIsInternalAddress ( LibTiePieHandle_t  hDevice,
uint16_t  wAddress 
)

Check whether an address is used internally.

Parameters
[in]hDeviceA device handle identifying the I2C host.
[in]wAddressAn I2C device address.
Returns
BOOL8_TRUE if the address is used internally, BOOL8_FALSE otherwise.
Status values
INVALID_HANDLE The handle is not a valid I2C host handle.
OBJECT_GONE The object indicated by the handle is no longer available.
LIBRARY_NOT_INITIALIZEDThe library is not initialized, see LibInit().
SUCCESS The function executed successfully.
See also
I2CGetInternalAddresses
Since
0.4.0
uint32_t I2CGetInternalAddresses ( LibTiePieHandle_t  hDevice,
uint16_t *  pAddresses,
uint32_t  dwLength 
)

Get all addresses which are used internally.

Parameters
[in]hDeviceA device handle identifying the I2C host.
[out]pAddressesA pointer to an array for the addresses.
[in]dwLengthThe number of elements in the array.
Returns
The total number of addresses.
Status values
INVALID_HANDLE The handle is not a valid I2C host handle.
OBJECT_GONE The object indicated by the handle is no longer available.
LIBRARY_NOT_INITIALIZEDThe library is not initialized, see LibInit().
SUCCESS The function executed successfully.
Example
uint32_t dwLength = I2CGetInternalAddresses( hDevice , NULL , 0 );
uint16_t* pAddresses = malloc( sizeof( uint16_t ) * dwLength );
dwLength = I2CGetInternalAddresses( hDevice , pAddresses , dwLength );
printf( "I2CGetInternalAddresses:\n" );
for( i = 0 ; i < dwLength ; i++ )
printf( "- 0x%x (%u)\n" , pAddresses[ i ] , pAddresses[ i ] );
free( pAddresses );
See also
I2CIsInternalAddress
Since
0.6