nidas v1.2.3
|
Support for the digital IO on an Arcom Viper. More...
#include <ViperDIO.h>
Public Member Functions | |
ViperDIO () | |
~ViperDIO () | |
void | setDeviceName (const std::string &val) |
const std::string & | getDeviceName () const |
const std::string & | getName () const |
int | getFd () const |
void | open () |
Open the DIO device. | |
void | close () |
Close the DIO device. | |
int | getNumOutputs () const |
Return number of DOUT pins on this device (8). | |
int | getNumInputs () const |
Return number of DIN pins on this device (8). | |
void | clearOutputs (const nidas::util::BitArray &which) |
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which. | |
void | setOutputs (const nidas::util::BitArray &which) |
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which. | |
void | setOutputs (const nidas::util::BitArray &which, const nidas::util::BitArray &val) |
Set ports OUT0-7, selected by bits 0-7 of which, to 0(low) or high(1) based on bits 0-7 of val. | |
nidas::util::BitArray | getOutputs () |
Get current settings of OUT0-7. | |
nidas::util::BitArray | getInputs () |
get current settings of IN0-7 | |
Private Attributes | |
std::string | _devName |
int | _fd |
The file descriptor of this device. | |
int | _noutputs |
How many DOUT pins are on this device? | |
int | _ninputs |
How many DIN pins are on this device? | |
Support for the digital IO on an Arcom Viper.
There are 8 independent inputs, IN0-7, and 8 independent outputs OUT0-7. The value of the inputs can be read, and the value of the outputs written or read.
ViperDIO::ViperDIO | ( | ) |
void ViperDIO::clearOutputs | ( | const nidas::util::BitArray & | which | ) |
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
References _devName, _fd, _noutputs, nidas::core::getSample(), and VIPER_DIO_CLEAR.
void ViperDIO::close | ( | ) |
n_u::BitArray ViperDIO::getInputs | ( | ) |
get current settings of IN0-7
nidas::util::IOException |
References _devName, _fd, nidas::core::getSample(), and VIPER_DIO_GET_DIN.
|
inline |
Return number of DIN pins on this device (8).
Value will be 0 if the device has not been opened, or -1 if the open failed.
References _ninputs.
|
inline |
Return number of DOUT pins on this device (8).
Value will be 0 if the device has not been opened, or -1 if the open failed.
References _noutputs.
Referenced by nidas::dynld::raf::CVIProcessor::attachLVInput().
n_u::BitArray ViperDIO::getOutputs | ( | ) |
Get current settings of OUT0-7.
nidas::util::IOException |
References _devName, _fd, nidas::core::getSample(), and VIPER_DIO_GET_DOUT.
void ViperDIO::open | ( | ) |
Open the DIO device.
nidas::util::IOException |
References _devName, _fd, _ninputs, _noutputs, open(), VIPER_DIO_GET_NIN, and VIPER_DIO_GET_NOUT.
Referenced by nidas::dynld::raf::CVIProcessor::attachLVInput(), and open().
References _devName, and nidas::core::getSample().
Referenced by nidas::dynld::raf::CVIProcessor::attachLVInput().
void ViperDIO::setOutputs | ( | const nidas::util::BitArray & | which | ) |
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
References _devName, _fd, _noutputs, nidas::core::getSample(), and VIPER_DIO_SET.
void ViperDIO::setOutputs | ( | const nidas::util::BitArray & | which, |
const nidas::util::BitArray & | val ) |
Set ports OUT0-7, selected by bits 0-7 of which, to 0(low) or high(1) based on bits 0-7 of val.
nidas::util::IOException |
throws nidas::util::InvalidParameterException
References _devName, _fd, _noutputs, nidas::core::getSample(), and VIPER_DIO_SET_TO_VAL.
|
private |
Referenced by clearOutputs(), getDeviceName(), getInputs(), getName(), getOutputs(), open(), setDeviceName(), setOutputs(), and setOutputs().
|
private |
The file descriptor of this device.
Referenced by clearOutputs(), close(), getFd(), getInputs(), getOutputs(), open(), setOutputs(), setOutputs(), and ~ViperDIO().
|
private |
How many DIN pins are on this device?
Referenced by getNumInputs(), and open().
|
private |
How many DOUT pins are on this device?
Referenced by clearOutputs(), getNumOutputs(), open(), setOutputs(), and setOutputs().