Minimal C++ API to a comedi device. More...
#include <ComediDevice.hpp>
Classes | |
class | DeviceInfo |
This class stores a comedi_t struct. More... | |
Public Types | |
typedef unsigned int | Data |
Public Member Functions | |
ComediDevice (unsigned int minor) | |
Data | getMaxData (unsigned int subd) |
Returns the maximum valid data value for channel chan of subdevice subdevice belonging to this device. | |
int | read (unsigned int subd, unsigned int chanNr, unsigned int range, unsigned int aref, Data &value) |
Read a single sample on the channel specified by the subdevice subdevice, and the channel channel. | |
int | write (unsigned int subd, unsigned int chanNr, unsigned int range, unsigned int aref, const ComediDevice::Data &value) |
int | getSubDeviceType (unsigned int subd) |
Returns an integer describing the type of subdevice that belongs to this comedi device and has the index subdevice. | |
DeviceInfo * | getDevice () |
Return a pointer to a comedi device info. | |
Protected Attributes | |
boost::shared_ptr< DeviceInfo > | d |
Minimal C++ API to a comedi device.
You require the ComediSubDevice family classes in order to access subdevices.
Definition at line 38 of file ComediDevice.hpp.
ComediDevice::DeviceInfo * getDevice | ( | ) |
Return a pointer to a comedi device info.
This may be null if the device could not be found.
Definition at line 95 of file ComediDevice.cpp.
Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), ComediSubDeviceAOut::ComediSubDeviceAOut(), and ComediSubDeviceDOut::ComediSubDeviceDOut().
Data getMaxData | ( | unsigned int | subd | ) |
Returns the maximum valid data value for channel chan of subdevice subdevice belonging to this device.
This function returns 0 on error.
subdevice | : the number of the subdevice to interrogate |
Definition at line 52 of file ComediDevice.cpp.
Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), and ComediSubDeviceAOut::ComediSubDeviceAOut().
int getSubDeviceType | ( | unsigned int | subd | ) |
Returns an integer describing the type of subdevice that belongs to this comedi device and has the index subdevice.
subd | : the number of the subdevice of which the type has to be retrieved |
Definition at line 60 of file ComediDevice.cpp.
Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), ComediSubDeviceAOut::ComediSubDeviceAOut(), and ComediSubDeviceDOut::ComediSubDeviceDOut().
int read | ( | unsigned int | subd, | |
unsigned int | chanNr, | |||
unsigned int | range, | |||
unsigned int | aref, | |||
ComediDevice::Data & | value | |||
) |
Read a single sample on the channel specified by the subdevice subdevice, and the channel channel.
For the A/D conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref. Analog reference types that are not supported by the device are silently ignored. The function reads one data value from the specified channel and places the data value in the location pointed to by data.
Data values returned by this function are unsigned integers less than or equal to the maximum sample value of the channel, which can be determined using the function getMaxData().
subd | : the number of the subdevice to read on | |
chanNr | : the number of the channel of subdevice subdevice to read on | |
value | : the data | |
range | : number between 0 and get_num_ranges(), |
aref | : possible options (see comedi doc) AREF_GROUND, AREF_COMMON, AREF_DIFF, AREF_OTHER |
Definition at line 67 of file ComediDevice.cpp.
Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), and ComediSubDeviceAOut::ComediSubDeviceAOut().