Comedi Relacs Plugins
0.9.8
|
#include <comedianalogoutput.h>
Public Member Functions | |
ComediAnalogOutput (void) | |
ComediAnalogOutput (const string &device, const Options &opts) | |
virtual | ~ComediAnalogOutput (void) |
virtual int | open (const string &device) override |
virtual bool | isOpen (void) const |
virtual void | close (void) |
virtual int | channels (void) const |
virtual int | bits (void) const |
virtual double | maxRate (void) const |
virtual int | maxRanges (void) const |
virtual double | unipolarRange (int index) const |
virtual double | bipolarRange (int index) const |
virtual int | directWrite (OutList &sigs) |
virtual int | prepareWrite (OutList &sigs) |
virtual int | startWrite (QSemaphore *sp=0) |
virtual int | writeData (void) |
virtual int | stop (void) |
virtual int | reset (void) |
virtual Status | status (void) const |
Public Member Functions inherited from AnalogOutput | |
AnalogOutput (void) | |
AnalogOutput (int aotype) | |
AnalogOutput (const string &deviceclass, int aotype=0) | |
virtual | ~AnalogOutput (void) |
virtual int | open (Device &device) override |
double | delay (int channel) const |
void | setDelays (const vector< double > &delays) |
void | setDelay (double delay) |
double | externalReference (void) const |
void | setExternalReference (double extr) |
virtual int | testWrite (OutList &sigs) |
bool | running (void) const |
virtual long | index (void) const |
virtual int | getAISyncDevice (const vector< AnalogInput * > &ais) const |
virtual bool | useAIRate (void) const |
virtual void | take (const vector< AnalogOutput * > &aos, vector< int > &aoinx, vector< bool > &aorate) |
virtual void | addTraces (vector< TraceSpec > &traces, int deviceid) const |
virtual int | matchTraces (vector< TraceSpec > &traces) const |
int | analogOutputType (void) const |
Protected Member Functions | |
void | writeZeros (void) |
void | setupChanList (OutList &sigs, unsigned int *chanlist, int maxchanlist, bool setscale) |
int | setupCommand (OutList &sigs, comedi_cmd &cmd, bool setscale) |
virtual int | testWriteDevice (OutList &sigs) |
bool | noMoreData (void) const |
int | comediSubdevice (void) const |
bool | useAIStart (void) const |
int | bufferSize (void) const |
bool | prepared (void) const |
virtual void | initOptions () override |
Protected Member Functions inherited from AnalogOutput | |
virtual int | testWriteData (OutList &sigs) |
void | setAnalogOutputType (int aotype) |
void | setWriteSleep (unsigned long ms) |
void | setErrorStr (const string &strg) |
void | addErrorStr (const string &strg) |
void | setErrorStr (int errnum) |
void | addErrorStr (int errnum) |
void | setErrorStr (const OutList &sigs) |
void | addErrorStr (const OutList &sigs) |
void | setInfo (void) |
void | setSettings (const OutList &sigs, int writebuffer=0) |
virtual void | startThread (QSemaphore *sp=0, bool error=false) |
virtual void | run (void) |
virtual void | stopWrite (void) |
Friends | |
class | ComediAnalogInput |
class | DynClampAnalogOutput |
Additional Inherited Members | |
Public Types inherited from AnalogOutput | |
enum | Status |
[AnalogOutput] Interface for accessing analog output of a daq-board via comedi.
NI DAQCard cmd.stop_arg += 2048 needs to tested
unipolar support is not really working
For software calibrated boards (like NI M-Series boards) do
You may want to read the man page of comedi_calibrate
.
ComediAnalogOutput | ( | void | ) |
Create a new ComediAnalogOutput without opening a device.
References ComediAnalogOutput::initOptions().
ComediAnalogOutput | ( | const string & | device, |
const Options & | opts | ||
) |
Open the analog output driver specified by its device file device.
References ComediAnalogOutput::open().
|
virtual |
Stop analog output and close the daq driver.
References ComediAnalogOutput::close().
|
overridevirtual |
Open the analog output device on device file device.
if a ranges is not supported but comedi thinks so: set max = -1.0, i.e. NI 6070E PCI: range #3&4 (-1..1V, 0..1V) not supported
maybe use an internal maximum buffer size (in case comedi max is way too much)?
Reimplemented from AnalogOutput.
References ComediAnalogOutput::channels(), ComediAnalogOutput::close(), ComediAnalogOutput::isOpen(), max(), AnalogOutput::setDelays(), AnalogOutput::setErrorStr(), AnalogOutput::setExternalReference(), AnalogOutput::setInfo(), and ComediAnalogOutput::writeZeros().
Referenced by ComediAnalogOutput::ComediAnalogOutput().
|
virtual |
Returns true if driver was succesfully opened.
Implements AnalogOutput.
Referenced by ComediAnalogOutput::bits(), ComediAnalogOutput::channels(), ComediAnalogOutput::close(), ComediAnalogOutput::directWrite(), ComediAnalogOutput::open(), ComediAnalogOutput::prepareWrite(), and ComediAnalogOutput::testWriteDevice().
|
virtual |
Stop all activity and close the device.
Implements AnalogOutput.
References ComediAnalogOutput::isOpen(), ComediAnalogOutput::reset(), AnalogOutput::setErrorStr(), and ComediAnalogOutput::writeZeros().
Referenced by ComediAnalogOutput::open(), and ComediAnalogOutput::~ComediAnalogOutput().
|
virtual |
Number of analog output channels.
Implements AnalogOutput.
References ComediAnalogOutput::isOpen().
Referenced by ComediAnalogOutput::open(), and ComediAnalogOutput::writeZeros().
|
virtual |
Resolution in bits of analog output.
Implements AnalogOutput.
References ComediAnalogOutput::isOpen(), and log().
|
virtual |
Maximum sampling rate in Hz of analog output.
Implements AnalogOutput.
|
virtual |
Maximum number of analog output ranges.
|
virtual |
Voltage range index in Volt for unipolar mode. If -1 is returned this range is not supported.
References AnalogOutput::index().
Referenced by ComediAnalogOutput::setupChanList().
|
virtual |
Voltage range index in Volt for bipolar mode. If -1 is returned this range is not supported.
References AnalogOutput::index().
Referenced by ComediAnalogOutput::setupChanList().
|
virtual |
Directly writes from each signal in sigs the first data value to the data acquisition board.
Implements AnalogOutput.
References OutList::failed(), ComediAnalogOutput::isOpen(), ComediAnalogOutput::setupChanList(), OutList::size(), and OutList::success().
|
virtual |
Prepare analog output of the output signals sigs on the device. If an error ocurred in any signal, the corresponding errorflags in OutData are set and a negative value is returned. This function assumes that sigs successfully passed testWrite(). The channels in sigs are not sorted.
Implements AnalogOutput.
References OutList::add(), OutList::addError(), OutList::addErrorStr(), ComediAnalogOutput::bufferSize(), AnalogOutput::delay(), OutList::deviceBufferSize(), OutList::deviceReset(), ComediAnalogOutput::isOpen(), ComediAnalogOutput::reset(), AnalogOutput::setSettings(), ComediAnalogOutput::setupCommand(), OutList::size(), OutList::sortByChannel(), OutList::success(), and ComediAnalogOutput::writeData().
|
virtual |
Start analog output of the output signals that were passed to the previous call of prepareWrite(). If an error ocurred in any signal, the corresponding errorflags in OutData are set and a negative value is returned. If no further calls of writeData() are required, 0 is returned, otherwise 1 is returned. This function is always called after a successfull prepareRead().
[in] | sp | if not null, a thread is started feeding the running analog output. When the thread and analog output is finished, releases the semaphore by one. On error, the semaphore is released by 1000 so that the process waiting on the semaphore is waking up immediately. |
Implements AnalogOutput.
References AnalogOutput::startThread().
|
virtual |
Write data to a running data acquisition. Returns the number of data values that were popped from the signal device-buffers (sum over all signals). If an error ocurred in any channel, the corresponding errorflags in the OutList structure are filled and a negative value is returned.
Implements AnalogOutput.
References AnalogOutput::setErrorStr().
Referenced by ComediAnalogOutput::prepareWrite().
|
virtual |
Stop any running ananlog output activity. Returns zero on success, otherwise NotOpen.
Implements AnalogOutput.
References AnalogOutput::stopWrite().
|
virtual |
Clear any internal data buffers and reset the device. Assumes that analog output is already stopped. Returns zero on success, otherwise NotOpen.
Implements AnalogOutput.
Referenced by ComediAnalogOutput::close(), and ComediAnalogOutput::prepareWrite().
|
virtual |
Implements AnalogOutput.
References AnalogOutput::Idle, AnalogOutput::Running, and AnalogOutput::Underrun.
|
protected |
Initialize all channels with zero.
References ComediAnalogOutput::channels(), AnalogOutput::index(), and AnalogOutput::setErrorStr().
Referenced by ComediAnalogOutput::close(), and ComediAnalogOutput::open().
|
protected |
Initializes the chanlist from sigs.
References OutList::addError(), ComediAnalogOutput::bipolarRange(), AnalogOutput::index(), max(), min(), minMax(), OutList::size(), and ComediAnalogOutput::unipolarRange().
Referenced by ComediAnalogOutput::directWrite(), and ComediAnalogOutput::setupCommand().
|
protected |
Setup and test cmd according to sigs.
References OutList::addError(), OutList::addErrorStr(), AnalogOutput::delay(), OutList::failed(), OutList::setContinuous(), OutList::setSampleRate(), ComediAnalogOutput::setupChanList(), OutList::size(), and OutList::success().
Referenced by ComediAnalogOutput::prepareWrite(), and ComediAnalogOutput::testWriteDevice().
|
protectedvirtual |
Device driver specific tests on the settings in sigs for each output signal. Before this function is called, the validity of the settings in sigs was already tested by testReadData(). This function should test whether the settings are really supported by the hardware. If an error ocurred in any trace, the corresponding errorflags in the OutData are set and a negative value is returned. The channels in sigs are not sorted. This function is called by testWrite().
Implements AnalogOutput.
References OutList::addError(), ComediAnalogOutput::bufferSize(), ComediAnalogOutput::isOpen(), ComediAnalogOutput::setupCommand(), and OutList::size().
|
protected |
true
if writeData() does not need to be called any more.
|
protected |
Comedi internal index of analog output subdevice.
|
protected |
Return true
if start trigger from analog input is used for starting analog output.
|
protected |
returns buffer-size of device in samples.
Referenced by ComediAnalogOutput::prepareWrite(), and ComediAnalogOutput::testWriteDevice().
|
protected |
True if analog output was prepared using testWriteDevice() and prepareWrite()
|
overrideprotectedvirtual |
Referenced by ComediAnalogOutput::ComediAnalogOutput().
|
friend |
|
friend |