nidas
v1.2-1520
|
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 () throw (nidas::util::IOException) |
Open the DIO device. More... | |
void | close () throw (nidas::util::IOException) |
Close the DIO device. More... | |
int | getNumOutputs () const |
Return number of DOUT pins on this device (8). More... | |
int | getNumInputs () const |
Return number of DIN pins on this device (8). More... | |
void | clearOutputs (const nidas::util::BitArray &which) throw (nidas::util::IOException, nidas::util::InvalidParameterException) |
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which. More... | |
void | setOutputs (const nidas::util::BitArray &which) throw (nidas::util::IOException, nidas::util::InvalidParameterException) |
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which. More... | |
void | setOutputs (const nidas::util::BitArray &which, const nidas::util::BitArray &val) throw (nidas::util::IOException, nidas::util::InvalidParameterException) |
Set ports OUT0-7, selected by bits 0-7 of which, to 0(low) or high(1) based on bits 0-7 of val. More... | |
nidas::util::BitArray | getOutputs () throw (nidas::util::IOException) |
Get current settings of OUT0-7. More... | |
nidas::util::BitArray | getInputs () throw (nidas::util::IOException) |
get current settings of IN0-7 More... | |
Private Attributes | |
std::string | _devName |
int | _fd |
The file descriptor of this device. More... | |
int | _noutputs |
How many DOUT pins are on this device? More... | |
int | _ninputs |
How many DIN pins are on this device? More... | |
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 | ) | |
throw | ( | nidas::util::IOException, | |||
nidas::util::InvalidParameterException | |||||
) |
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
References VIPER_DIO_CLEAR.
void ViperDIO::close | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
|
inline |
References _devName.
|
inline |
References _fd.
n_u::BitArray ViperDIO::getInputs | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
get current settings of IN0-7
References _devName, _fd, nidas::util::BitArray::setBits(), and VIPER_DIO_GET_DIN.
|
inline |
References _devName.
|
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 |
n_u::BitArray ViperDIO::getOutputs | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
Get current settings of OUT0-7.
References _devName, _fd, nidas::util::BitArray::setBits(), and VIPER_DIO_GET_DOUT.
Referenced by main().
void ViperDIO::open | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
Open the DIO device.
References _devName, _fd, _ninputs, _noutputs, VIPER_DIO_GET_NIN, and VIPER_DIO_GET_NOUT.
Referenced by main().
|
inline |
void ViperDIO::setOutputs | ( | const nidas::util::BitArray & | which | ) | |
throw | ( | nidas::util::IOException, | |||
nidas::util::InvalidParameterException | |||||
) |
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
References VIPER_DIO_SET.
Referenced by main().
void ViperDIO::setOutputs | ( | const nidas::util::BitArray & | which, |
const nidas::util::BitArray & | val | ||
) | |||
throw | ( | nidas::util::IOException, | |
nidas::util::InvalidParameterException | |||
) |
Set ports OUT0-7, selected by bits 0-7 of which, to 0(low) or high(1) based on bits 0-7 of val.
References VIPER_DIO_SET_TO_VAL.
|
private |
Referenced by getDeviceName(), getInputs(), getName(), getOutputs(), open(), and setDeviceName().
|
private |
The file descriptor of this device.
Referenced by close(), getFd(), getInputs(), getOutputs(), open(), 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 getNumOutputs(), and open().