gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
IIO Class Reference

The iio_channel_info structure is external. More...

#include <IIO.H>

Inheritance diagram for IIO:
[legend]
Collaboration diagram for IIO:
[legend]

Public Member Functions

 IIO ()
 
virtual ~IIO ()
 
int findDevicesByChipName (std::string chipName)
 
uint getDeviceCnt ()
 
uint getChCnt ()
 
void printInfo ()
 
int open (void)
 
int close (void)
 
int getChFrameSize (void)
 
int getDevFrameSize (void)
 
template<typename TYPE >
int getReadArray (uint N, Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
 
template<typename TYPE >
int getReadArraySampleCount (Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
 
template<typename TYPE >
int read (uint N, const Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
 
int enable (bool enable)
 
int getChannelBufferCnt ()
 
int setChannelBufferCnt (int chBufCnt)
 

Private Member Functions

std::string findChipName (std::string devicePath)
 

Static Private Attributes

static const char * iioDir = "/sys/bus/iio/devices/"
 The sys fs location of iio devcies "/sys/bus/iio/devices/". More...
 

Detailed Description

The iio_channel_info structure is external.

Industrial IO class.

In this version, this class assumes that all devices are driven by the same chip. For this reason, each device has the same number of channels and word size.

This class will open and maintain all IIO devices with the same chip name. For example :

std::string chipName("AD7476A"); // we are looking for devices on the IIO system with the "AD7476A" chip
IIO iio;
iio.findDevicesByChipName(chipName);
iio.printInfo(); // print out detail about the devices which were found ...

Which produces the following output :

Device 0 chip AD7476A
channel 0
Name in_voltage0
Generic name in
Index 0
unsigned, little endian
This channel has 16 bits, which require shifting down by 0 bits.
This device has 32 bits in one frame of DMA data shifting.
channel 1
Name in_voltage1
Generic name in
Index 1
unsigned, little endian
This channel has 16 bits, which require shifting down by 16 bits.
This device has 32 bits in one frame of DMA data shifting.
Examples:
IIOTest.C.

Definition at line 72 of file IIO.H.

Constructor & Destructor Documentation

◆ IIO()

IIO::IIO ( )
inline

Definition at line 88 of file IIO.H.

◆ ~IIO()

virtual IIO::~IIO ( )
inlinevirtual

Definition at line 89 of file IIO.H.

Here is the call graph for this function:

Member Function Documentation

◆ close()

int IIO::close ( void  )
inline

Close all of the devices.

Returns
NO_ERROR on success, or the appropriate error number on failure.
Examples:
IIOQueueTest.C, and IIOTest.C.

Definition at line 179 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable()

int IIO::enable ( bool  enable)
inline

Enable or disable all of the devices.

Parameters
enableTrue to enable, false to disable.
Examples:
IIOMMapTest.C, IIOQueueTest.C, and IIOTest.C.

Definition at line 290 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findChipName()

std::string IIO::findChipName ( std::string  devicePath)
inlineprivate

Find the name of the chip on the device at devicePath.

Parameters
devicePath= "/sys/bus/iio/devices/iio:deviceN"
Returns
The chip name, or an empty std::string on error.

Definition at line 79 of file IIO.H.

Here is the caller graph for this function:

◆ findDevicesByChipName()

int IIO::findDevicesByChipName ( std::string  chipName)
inline

Find all IIO devices with a particular chip name

Parameters
chipNameThe name of the iio chip, e.g. "AD7476"
Returns
NO_ERROR on success, or the appropriate error number otherwise.
Examples:
IIOMMapTest.C, IIOQueueTest.C, and IIOTest.C.

Definition at line 97 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChannelBufferCnt()

int IIO::getChannelBufferCnt ( )
inline

Find the number of samples per channel which the buffer can hold.

Returns
the maximum number of samples which the buffer can hold, otherwise an error.

Definition at line 301 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChCnt()

uint IIO::getChCnt ( )
inline

Find the total number of channels across all devices.

Returns
The total number of channels which exist on all devices
Examples:
IIOMMapTest.C, and IIOQueueTest.C.

Definition at line 137 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChFrameSize()

int IIO::getChFrameSize ( void  )
inline

Find the number of bytes per channel.

Returns
The total number of bytes in one channel or the appropriate error on failure

Definition at line 190 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDevFrameSize()

int IIO::getDevFrameSize ( void  )
inline

Find the number of bytes per device frame (all channels on one device).

Returns
The total number of bytes in one device frame or the appropriate error on failure

Definition at line 205 of file IIO.H.

Here is the call graph for this function:

◆ getDeviceCnt()

uint IIO::getDeviceCnt ( )
inline

Open an iio device by name.

Parameters
deviceNameThe name of the iio device, e.g. "iio:1"
Returns
NOERROR on success, or the appropriate error number otherwise. Find the number of devices present.
the number of devices maintained by this IIO system.

Definition at line 130 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getReadArray()

template<typename TYPE >
int IIO::getReadArray ( uint  N,
Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &  array 
)
inline

Get an Array suitable for reading N samples from each channel on each device. The arrays are shaped as N*chCnt rows and device count columns.

Parameters
NThe number of samples to read from each channel.
[out]arrayThe array to create and resize appropriately
Returns
NO_ERROR or the suitable error. The array is returned correctly sized for the number of channels.
Examples:
IIOMMapTest.C, and IIOTest.C.

Definition at line 222 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getReadArraySampleCount()

template<typename TYPE >
int IIO::getReadArraySampleCount ( Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &  array)
inline

Get the numbers of samples per channel which the read array can handle.

Parameters
arrayThe array to create and resize appropriately
Returns
NO_ERROR or the suitable error. The array is returned correctly sized for the number of channels.

Definition at line 241 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

int IIO::open ( void  )
inline

Open all of the devices all channels.

Returns
NO_ERROR on success, or the appropriate error number on failure.
Examples:
IIOQueueTest.C, and IIOTest.C.

Definition at line 156 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printInfo()

void IIO::printInfo ( )
inline

Print the info for each device.

Examples:
IIOMMapTest.C, IIOQueueTest.C, and IIOTest.C.

Definition at line 146 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

template<typename TYPE >
int IIO::read ( uint  N,
const Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &  array 
)
inline

Read N samples from each channel.

Parameters
NThe number of samples to read from each channel.
arrayThe array to fill with data.
Returns
NO_ERROR on success, or the appropriate error on failure.
Template Parameters
TYPEthe type of the samples to read in, for example signed 16 bit is short int.
Examples:
IIOTest.C.

Definition at line 254 of file IIO.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChannelBufferCnt()

int IIO::setChannelBufferCnt ( int  chBufCnt)
inline

Set the number of samples per channel which the buffer can hold.

Parameters
chBufferCntThe number of samples per channel the buffer can hold.
Returns
the maximum number of samples which the buffer can hold, otherwise an error.

Definition at line 315 of file IIO.H.

Here is the call graph for this function:

Member Data Documentation

◆ iioDir

const char * IIO::iioDir = "/sys/bus/iio/devices/"
staticprivate

The sys fs location of iio devcies "/sys/bus/iio/devices/".

Definition at line 73 of file IIO.H.


The documentation for this class was generated from the following file:
gtkIOStream: IIO Class Reference
GTK+ IOStream  Beta