2 #include "StimulationsDAQmx.h"
3 #include "parameters/Scope.h"
5 #include "helpers/ScopeException.h"
13 int32 samplingtype = (_params.
requested_mode()==DaqModeHelper::continuous)?DAQmx_Val_ContSamps:DAQmx_Val_FiniteSamps;
15 double pixelrate = 1/(_params.
areas[ThisAreaOrMasterArea(0)]->daq.pixeltime()*1E-6);
16 int32_t pixelsperchan = _params.
areas[ThisAreaOrMasterArea(0)]->Currentframe().TotalPixels();;
18 pixelsperchan = _params.
areas[ThisAreaOrMasterArea(0)]->Currentframe().TotalPixels() * _params.
areas[ThisAreaOrMasterArea(0)]->daq.requested_frames() * _params.
areas[ThisAreaOrMasterArea(0)]->daq.averages();
37 written =
task.
WriteDigitalU8(_stimvec->data(),
static_cast<int32_t
>(_stimvec->size()));
StimulationsDAQmx(const parameters::Scope &_params)
Creates the tasks for digital stimulation output with NI-DAQmx.
The master parameters class.
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
ScopeString channel
digital output channel
~StimulationsDAQmx()
Stop and clear the digital stimulation task.
void CreateDOChannel(const std::wstring &_devicelines, const std::wstring &_channelname=L"")
Creates a digital output channel.
ScopeNumber< bool > enable
stimulation enabled/disabled
void Start()
Start stimulation task, waits on first output task sample clock.
This is the include file for standard system include files, or project specific include files that ar...
ScopeValue< DaqMode > requested_mode
requested acquisition mode (see DaqModeHelper)
void Start(void)
Starts the task.
In here all declarations for all kinds of datatypes Scope needs.
void ScopeExceptionHandler(const std::string &_origin, const bool &_log, const bool &_showmessagebox, const bool &_trace, const bool &_rethrow)
Handles all exceptions and does nice logging.
void Clear(void)
Clear the task.
void CreateTask(const std::wstring &_name=L"")
void ConfigureSampleTiming(const std::wstring &_src, const float64 &_rate, const int32 &_samplesperchan, const int32 &_samplingtype=DAQmx_Val_ContSamps, const int32 &_actedge=DAQmx_Val_Rising)
Configures a sample timing for the task.
int32 WriteDigitalU8(const uInt8 *_data, int32 _sampsperchan, bool _autostart=false, float64 _timeout=2, bool32 _layout=DAQmx_Val_GroupByChannel)
Writes to an 8 bit digital output port, lowest bit is line0, highest bit is line7.
DAQmx::CDAQmxDigitalOutTask task
The DAQmx tasks.
ScopeString timingsource
timing source.
Stimulation stimulation
the StimulationParameters
void Stop(void)
Stops the task.
virtual int32_t Write(std::shared_ptr< const std::vector< uint8_t >> const _stimvec)
Write the stimulation vector to the digital stimulation task.