Relacs DAQ Library
0.9.8
|
#include <digitalio.h>
Public Member Functions | |
DigitalIO (const string &deviceclass) | |
virtual | ~DigitalIO (void) |
virtual int | open (const string &device) override |
virtual int | open (Device &device) override |
virtual bool | isOpen (void) const =0 |
virtual void | close (void)=0 |
virtual int | lines (void) const =0 |
virtual const Options & | settings (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) |
virtual int | configureLine (unsigned int line, bool output) |
virtual int | configureLines (unsigned int lines, unsigned int output) |
bool | lineConfiguration (unsigned int line) const |
virtual int | write (unsigned int line, bool val)=0 |
virtual int | read (unsigned int line, bool &val)=0 |
virtual int | writeLines (unsigned int lines, unsigned int val)=0 |
virtual int | readLines (unsigned int lines, unsigned int &val)=0 |
virtual int | setSyncPulse (int modemask, int modebits, unsigned int line, double duration, int mode=0) |
virtual int | clearSyncPulse (int modemask, int modebits) |
Public Member Functions inherited from Device | |
Device (int type=MiscellaneousType) | |
Device (const string &deviceclass, int type=MiscellaneousType) | |
virtual | ~Device (void) |
virtual int | reset (void) |
virtual const Options & | info (void) const |
int | deviceType (void) const |
string | deviceTypeStr (void) const |
string | deviceClass (void) const |
string | deviceFile (void) const |
string | deviceName (void) const |
string | deviceVendor (void) const |
string | deviceIdent (void) const |
virtual void | setDeviceIdent (const string &ident) |
virtual void | clearError (void) |
virtual string | errorStr (void) const |
void | setErrorStr (const string &strg) |
void | addErrorStr (const string &strg) |
void | setErrorStr (int errnum) |
void | addErrorStr (int errnum) |
virtual bool | success (void) const |
virtual bool | failed (void) const |
Protected Member Functions | |
void | freeLines (void) |
void | setInfo (void) |
Protected Member Functions inherited from Device | |
void | setDeviceType (int type) |
void | setDeviceClass (const string &deviceclass) |
void | setDeviceFile (const string &devicefile) |
void | setDeviceName (const string &devicename) |
void | setDeviceVendor (const string &devicevendor) |
void | addInfo (void) |
void | lock (void) const |
void | unlock (void) const |
QMutex * | mutex (void) const |
virtual void | initOptions (void) |
Static Protected Attributes | |
static const unsigned int | MaxDIOLines = 32 |
Additional Inherited Members | |
Public Types inherited from Device | |
enum | DeviceTypes { MiscellaneousType = 0, AnalogInputType = 1, AnalogOutputType = 2, DigitalIOType = 3, TriggerType = 4, AttenuatorType = 5, AttenuateType = 6, ManipulatorType = 7, TemperatureType = 8, CameraType = 9 } |
Static Public Member Functions inherited from Device | |
static int | deviceTypes (void) |
static string | deviceTypeStr (int type) |
static string | getErrorStr (int ern) |
Static Public Attributes inherited from Device | |
static const int | NotOpen = -1 |
static const int | InvalidDevice = -2 |
static const int | ReadError = -3 |
static const int | WriteError = -4 |
static const int | InvalidParam = -5 |
Protected Attributes inherited from Device | |
Options | Info |
Options | Settings |
Interface for accessing digital input and output lines of a data-aquisition board.
After opening the device by open(), the digitial I/O lines that you are going to use should be allocated by allocateLines() or allocateLine().
Then the digital I/O lines should be configured for input or output using configureLines() or configureLine().
Bits can be read from or written to the digitial I/O lines by the read() and write() functions.
In case you want to use a digitial I/O device within RELACS, your DigitalIO implementation needs to provide a void default constructor (i.e. with no parameters) that does not open the device. Also, include the header file <relacs/relacsplugin.h>
and make the AnalogInput device known to RELACS with the addDigitalIO
( ClassNameOfYourDigitalIOImplementation, PluginSetName ) macro.
DigitalIO | ( | const string & | deviceclass | ) |
Constructs an DigitalIO with device class deviceclass.
References DigitalIO::freeLines(), and DigitalIO::MaxDIOLines.
|
virtual |
Close the daq driver. Reimplement this destructor.
|
overridevirtual |
Open the digital I/O device specified by device.
Reimplemented from Device.
References DigitalIO::freeLines(), Device::Info, Device::InvalidDevice, DigitalIO::MaxDIOLines, Device::setDeviceFile(), and Device::Settings.
|
overridevirtual |
Open the digital I/O device specified by device.
Reimplemented from Device.
References Device::deviceIdent(), DigitalIO::freeLines(), Device::Info, Device::InvalidDevice, DigitalIO::MaxDIOLines, Device::setDeviceFile(), and Device::Settings.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Referenced by DigitalIO::setInfo(), and DigitalIO::settings().
|
virtual |
Returns the ids for each digital I/O line.
Reimplemented from Device.
References DigitalIO::lines(), and Device::Settings.
int allocateLines | ( | unsigned int | lines | ) |
Allocate the lines lines of the digital I/O device.
[in] | lines | a bit mask of the digital lines to be allocated. |
References DigitalIO::MaxDIOLines.
int allocateLine | ( | unsigned int | line | ) |
Allocate the single digital I/O line line of the digital I/O device. Further lines can be allocated by calling allocateLine( int, int ).
[in] | line | the digital line (not its bitmask!) to be allocated. |
References relacs::line(), DigitalIO::MaxDIOLines, and Device::WriteError.
int allocateLine | ( | unsigned int | line, |
int | id | ||
) |
Allocate one more digital I/O line line of the digital I/O device for id id. The id should be the returned value of a previous call to allocateLine( int ).
[in] | line | the digital line (not its bitmask!) to be allocated. |
[in] | id | the id under which this line should be allocated. |
References relacs::line(), DigitalIO::MaxDIOLines, and Device::WriteError.
void freeLines | ( | int | id | ) |
Free the previously allocated digital I/O lines with id id.
References DigitalIO::MaxDIOLines.
bool allocatedLines | ( | unsigned int | lines, |
int | id | ||
) |
true
if all the digitial I/O lines lines have been allocated under id id. [in] | lines | the bit mask of the digital lines. |
[in] | id | the id under which this line was previously allocated. |
References DigitalIO::MaxDIOLines.
bool allocatedLines | ( | unsigned int | lines | ) |
true
if all the digitial I/O lines lines have been allocated, independent of the ids. [in] | lines | the bit mask of the digital lines. |
References DigitalIO::MaxDIOLines.
bool allocatedLine | ( | unsigned int | line, |
int | id | ||
) |
true
if digitial I/O line line was allocated under id id. [in] | line | the digital line (not its bitmask!) |
[in] | id | the id under which this line was previously allocated. |
References DigitalIO::MaxDIOLines.
bool allocatedLine | ( | unsigned int | line | ) |
true
if digitial I/O line line is allocated, independent of the id. [in] | line | the digital line (not its bitmask!) |
References DigitalIO::MaxDIOLines.
|
virtual |
Configure digital I/O line line for input (output = false
) or output (output = true
). When reimplementing this function, call this function on success.
[in] | line | the digital line (not its bitmask!) |
[in] | output | true if this line should be configured for output. |
References relacs::line(), DigitalIO::MaxDIOLines, and Device::WriteError.
|
virtual |
Configure digital I/O lines specified by lines for input (0) or output (1) according to output. When reimplementing this function, call this function on success.
[in] | lines | a bit mask of the digital lines to be configured. |
[in] | output | a bitmask for tha digital I/O lines that should be configured for output. |
References DigitalIO::MaxDIOLines.
bool lineConfiguration | ( | unsigned int | line | ) | const |
Returns the configuation of an digital I/O line.
[in] | line | the digital line (channel) |
true
, if the line has been configured for output. References relacs::line(), and DigitalIO::MaxDIOLines.
|
pure virtual |
Write val to the digital I/O line line.
[in] | line | the digital line (not its bitmask!) |
[in] | val | the value that should be written to the digital output line (true: high, false: low). |
|
pure virtual |
Read from digital I/O line line and return value in val.
[in] | line | the digital line (not its bitmask!) |
[out] | val | the value that was read from to the digital input line (true: high, false: low). |
|
pure virtual |
Write val to the digital I/O lines defined in lines.
[in] | lines | a bit mask selecting the digital lines to be written. |
[in] | val | a bit mask indicating what should be written to the digital output lines (1 : high, 0 : low). |
|
pure virtual |
Read digital I/O lines and return them in val.
[in] | lines | a bit mask selecting the digital lines from which to read. |
[out] | val | a bit field returning the values read from to the digital input lines (1 : high, 0 : low). |
|
virtual |
Enables generation of TTL Pulses on DIO line line and the scaling of the current for analog output according to the measured period divided by the curent injection time of duration microseconds. This is used for synchronizing a discontinous current-clamp amplifier with an dynamic-clamp loop.
[in] | modemask | the dio lines that switch the mode of the amplifier |
[in] | modebits | the dio lines to be set high to switch the mode of the amplifier into synchronized current clamp mode |
[in] | line | the dio line where to put out the synchronizing pulses |
[in] | duration | the duration of the current injection of the amplifier in seconds. |
[in] | mode | how the measured period is determined: 0: the fixed requested sampling interval, 1: the current period, > 1: the average over the mode last periods. |
References Device::InvalidDevice.
|
virtual |
Disable TTL Pulse generation and current scaling. Switch amplifier into a different mode.
[in] | modemask | the dio lines that switch the mode of the amplifier |
[in] | modebits | the dio lines to be set high to switch into the desired non syncrhonizing mode into synchronized current clamp mode |
References Device::InvalidDevice.
|
protected |
Free all allocated digital I/O lines.
References DigitalIO::MaxDIOLines.
Referenced by DigitalIO::DigitalIO(), and DigitalIO::open().
|
protected |
Set the device info(). Call this function from open().
References Device::addInfo(), Device::Info, and DigitalIO::lines().
|
staticprotected |
The maximum number of digital I/O lines.
Referenced by DigitalIO::allocatedLine(), DigitalIO::allocatedLines(), DigitalIO::allocateLine(), DigitalIO::allocateLines(), DigitalIO::configureLine(), DigitalIO::configureLines(), DigitalIO::DigitalIO(), DigitalIO::freeLines(), DigitalIO::lineConfiguration(), and DigitalIO::open().