Comedi Relacs Plugins  0.9.8
Public Member Functions | Protected Member Functions | List of all members
ComediDigitalIO Class Reference

#include <comedidigitalio.h>

Inheritance diagram for ComediDigitalIO:
Inheritance graph
[legend]
Collaboration diagram for ComediDigitalIO:
Collaboration graph
[legend]

Public Member Functions

 ComediDigitalIO (void)
 
 ComediDigitalIO (const string &device, const Options &opts)
 
virtual ~ComediDigitalIO (void)
 
virtual int open (const string &device) override
 
virtual bool isOpen (void) const
 
virtual void close (void)
 
virtual int lines (void) const
 
virtual int configureLine (unsigned int line, bool output)
 
virtual int configureLines (unsigned int lines, unsigned int output)
 
virtual int write (unsigned int line, bool val)
 
virtual int read (unsigned int line, bool &val)
 
virtual int writeLines (unsigned int lines, unsigned int val)
 
virtual int readLines (unsigned int lines, unsigned int &val)
 
int comediSubdevice (void) const
 
- Public Member Functions inherited from DigitalIO
 DigitalIO (const string &deviceclass)
 
virtual ~DigitalIO (void)
 
virtual int open (Device &device) override
 
virtual const Optionssettings (void) const
 
int allocateLines (unsigned int lines)
 
int allocateLine (unsigned int line)
 
int allocateLine (unsigned int line, int id)
 
void freeLines (int id)
 
bool allocatedLines (unsigned int lines, int id)
 
bool allocatedLines (unsigned int lines)
 
bool allocatedLine (unsigned int line, int id)
 
bool allocatedLine (unsigned int line)
 
bool lineConfiguration (unsigned int line) const
 
virtual int setSyncPulse (int modemask, int modebits, unsigned int line, double duration, int mode=0)
 
virtual int clearSyncPulse (int modemask, int modebits)
 

Protected Member Functions

virtual void initOptions () override
 
- Protected Member Functions inherited from DigitalIO
void freeLines (void)
 
void setInfo (void)
 

Additional Inherited Members

- Static Protected Attributes inherited from DigitalIO
static const unsigned int MaxDIOLines
 

Detailed Description

[DigitalIO] Interface for accessing digital I/O lines of a daq-board via comedi.

Author
Jan Benda
Options
  • subdevice: the subdevice id of the digital I/O (check with comedi_test -t info).
  • startsubdevice: start searching for a digital I/O subdevice at the subdevice with the specified id.

Constructor & Destructor Documentation

ComediDigitalIO ( void  )

Create a new ComediDigitalIO without opening a device.

References ComediDigitalIO::initOptions().

ComediDigitalIO ( const string &  device,
const Options opts 
)

Open the digital I/O driver specified by its device file device.

References ComediDigitalIO::open().

~ComediDigitalIO ( void  )
virtual

Close the daq driver.

References ComediDigitalIO::close().

Member Function Documentation

int open ( const string &  device)
overridevirtual

Open a digital I/O device on the device device. The digital I/O subdevice can be specified by the "subdevice" option in opts. Alternatively, the first digital I/O subdevice is taken. The search for the digital I/O subdevice starts at the subdevice specified by the "startsubdevice" option in opts (defaults to "0"). Returns zero on success, or InvalidDevice (or any other negative number indicating the error).

See Also
isOpen(), close()

Reimplemented from DigitalIO.

References ComediDigitalIO::isOpen(), and DigitalIO::setInfo().

Referenced by ComediDigitalIO::ComediDigitalIO().

bool isOpen ( void  ) const
virtual

Returns true if the device is open.

See Also
open(), close()

Implements DigitalIO.

Referenced by ComediDigitalIO::close(), ComediDigitalIO::comediSubdevice(), ComediDigitalIO::lines(), and ComediDigitalIO::open().

void close ( void  )
virtual

Close the device.

See Also
open(), isOpen()

Implements DigitalIO.

References ComediDigitalIO::isOpen().

Referenced by ComediDigitalIO::~ComediDigitalIO().

int lines ( void  ) const
virtual
Returns
the number of digital I/O lines the device supports

Implements DigitalIO.

References ComediDigitalIO::isOpen().

Referenced by ComediDigitalIO::readLines().

int configureLine ( unsigned int  line,
bool  output 
)
virtual

Configure digital I/O line line for input (output = false) or output (output = true).

Returns
0 on success, otherwise a negative number indicating the error

Reimplemented from DigitalIO.

int configureLines ( unsigned int  lines,
unsigned int  output 
)
virtual

Configure digital I/O lines specified by lines for input (0) or output (1) according to output.

Parameters
[in]linesa bit mask of the digital lines to be configured.
[in]outputa bitmask for tha digital I/O lines that should be configured for output.
Returns
0 on success, otherwise a negative number indicating the error

Reimplemented from DigitalIO.

int write ( unsigned int  line,
bool  val 
)
virtual

Write val to the digital I/O line line.

Parameters
[in]linethe digital line (not its bitmask!)
[in]valthe value that should be written to the digital output line (true: high, false: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
read()

Implements DigitalIO.

int read ( unsigned int  line,
bool &  val 
)
virtual

Read from digital I/O line line and return value in val.

Parameters
[in]linethe digital line (not its bitmask!)
[out]valthe value that was read from to the digital input line (true: high, false: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
write()

Implements DigitalIO.

int writeLines ( unsigned int  lines,
unsigned int  val 
)
virtual

Write val to the digital I/O lines defined in lines.

Parameters
[in]linesa bit mask selecting the digital lines to be written.
[in]vala bit mask indicating what should be written to the digital output lines (1: high, 0: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
read()

Implements DigitalIO.

int readLines ( unsigned int  lines,
unsigned int &  val 
)
virtual

Read digital I/O lines and return them in val.

Parameters
[in]linesa bit mask selecting the digital lines from which to read.
[out]vala bit field returning the values read from to the digital input lines (1: high, 0: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
write()

Implements DigitalIO.

References ComediDigitalIO::lines().

int comediSubdevice ( void  ) const

Comedi internal index of analog input subdevice.

References ComediDigitalIO::isOpen().

void initOptions ( void  )
overrideprotectedvirtual

The documentation for this class was generated from the following files: