libm2k
m2khardwaretrigger.hpp
1 /*
2  * Copyright (c) 2019 Analog Devices Inc.
3  *
4  * This file is part of libm2k
5  * (see http://www.github.com/analogdevicesinc/libm2k).
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 2.1 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef M2KHARDWARETRIGGER_HPP
23 #define M2KHARDWARETRIGGER_HPP
24 
25 #include <libm2k/enums.hpp>
26 #include <libm2k/digital/enums.hpp>
27 #include <libm2k/m2kglobal.hpp>
28 #include <libm2k/m2k.hpp>
29 #include <vector>
30 #include <memory>
31 
32 namespace libm2k {
33 
41 class LIBM2K_API M2kHardwareTrigger
42 {
43 public:
47  virtual ~M2kHardwareTrigger() {}
48 
49 
53  virtual void reset() = 0;
54 
60  virtual int getAnalogLevelRaw(unsigned int chnIdx) = 0;
61 
62 
68  virtual void setAnalogLevelRaw(unsigned int chnIdx, int level) = 0;
69 
70 
76  virtual void setAnalogLevel(unsigned int chnIdx, double v_level) = 0;
77 
78 
84  virtual double getAnalogLevel(unsigned int chnIdx) = 0;
85 
86 
92  virtual double getAnalogHysteresis(unsigned int chnIdx) = 0;
93 
94 
100  virtual void setAnalogHysteresis(unsigned int chnIdx, double hysteresis) = 0;
101 
102 
108  virtual M2K_TRIGGER_CONDITION_ANALOG getAnalogCondition(unsigned int chnIdx) = 0;
109 
110 
116  virtual void setAnalogCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_ANALOG cond) = 0;
117 
118 
124  virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(unsigned int chnIdx) = 0;
125 
126 
132  virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx) = 0;
133 
134 
140  virtual void setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;
141 
142 
148  virtual void setDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;
149 
150 
151 
157  virtual M2K_TRIGGER_MODE getAnalogMode(unsigned int chnIdx) = 0;
158 
159 
165  virtual void setAnalogMode(unsigned int chnIdx, M2K_TRIGGER_MODE mode) = 0;
166 
167 
172  virtual libm2k::digital::DIO_TRIGGER_MODE getDigitalMode() = 0;
173 
174 
179  virtual void setDigitalMode(libm2k::digital::DIO_TRIGGER_MODE mode) = 0;
180 
181 
186  virtual M2K_TRIGGER_SOURCE_ANALOG getAnalogSource() = 0;
187 
188 
193  virtual void setAnalogSource(M2K_TRIGGER_SOURCE_ANALOG src) = 0;
194 
195 
200  virtual int getAnalogSourceChannel() = 0;
201 
202 
207  virtual void setAnalogSourceChannel(unsigned int chnIdx) = 0;
208 
209 
224  virtual int getAnalogDelay() const = 0;
225 
226 
241  virtual void setAnalogDelay(int delay) = 0;
242 
243 
258  virtual int getDigitalDelay() const = 0;
259 
260 
275  virtual void setDigitalDelay(int delay) = 0;
276 
277 
281  virtual struct SETTINGS *getCurrentHwSettings() = 0;
282 
283 
287  virtual void setHwTriggerSettings(struct SETTINGS *settings) = 0;
288 
289 
294  virtual void setAnalogStreamingFlag(bool enable) = 0;
295 
296 
301  virtual bool getAnalogStreamingFlag() = 0;
302 
303 
313  virtual void setDigitalStreamingFlag(bool enable) = 0;
314 
315 
320  virtual bool getDigitalStreamingFlag() = 0;
321 
322 
326  virtual void setCalibParameters(unsigned int chnIdx, double scaling, double vert_offset) = 0;
327 
328 
334  virtual M2K_TRIGGER_CONDITION_DIGITAL getAnalogExternalCondition(unsigned int chnIdx) = 0;
335 
336 
342  virtual void setAnalogExternalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;
343 
344 
349  virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalExternalCondition() const = 0;
350 
351 
356  virtual void setDigitalExternalCondition(M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;
357 
358 
370  virtual void setAnalogExternalOutSelect(M2K_TRIGGER_OUT_SELECT output_select);
371 
372 
382  virtual M2K_TRIGGER_OUT_SELECT getAnalogExternalOutSelect();
383 
384 
388  virtual bool hasExternalTriggerIn() const = 0;
389 
390 
394  virtual bool hasExternalTriggerOut() const = 0;
395 
396 
400  virtual bool hasCrossInstrumentTrigger() const = 0;
401 
402 
411  virtual void setDigitalSource(M2K_TRIGGER_SOURCE_DIGITAL external_src);
412 
413 
422  virtual M2K_TRIGGER_SOURCE_DIGITAL getDigitalSource() const;
423 
424 
434  virtual void setAnalogOutTriggerSource(M2K_TRIGGER_SOURCE_OUT src) = 0;
435 
436 
446  virtual M2K_TRIGGER_SOURCE_OUT getAnalogOutTriggerSource() const = 0;
447 
448 
461  virtual void setAnalogOutTriggerCondition(M2K_TRIGGER_CONDITION_OUT condition) = 0;
462 
463 
475  virtual M2K_TRIGGER_CONDITION_OUT getAnalogOutTriggerCondition() const = 0;
476 
485  virtual void setAnalogOutTriggerStatus(M2K_TRIGGER_STATUS_ANALOG_OUT status) = 0;
486 
487 
496  virtual M2K_TRIGGER_STATUS_ANALOG_OUT getAnalogOutTriggerStatus() const = 0;
497 };
498 }
499 
500 #endif //M2KHARDWARETRIGGER_HPP
M2K_TRIGGER_STATUS_ANALOG_OUT
The status value determines the action that the output interface will take when the trigger condition...
Definition: enums.hpp:182
M2K_TRIGGER_SOURCE_OUT
Selects the source trigger for the output interfaces.
Definition: enums.hpp:158
M2K_TRIGGER_SOURCE_DIGITAL
Select the source for the digital trigger.
Definition: enums.hpp:193
DIO_CHANNEL
Indexes of the channels.
Definition: digital/enums.hpp:69
M2K_TRIGGER_CONDITION_DIGITAL
Condition of triggering.
Definition: enums.hpp:109
M2K_TRIGGER_CONDITION_OUT
Trigger condition when the source for M2K_TRIGGER_SOURCE_OUT is TRIGGER_TI.
Definition: enums.hpp:169
Digital enumerations.
M2K_TRIGGER_CONDITION_ANALOG
Condition of triggering.
Definition: enums.hpp:96
M2K_TRIGGER_MODE
Select the mode for the analog trigger.
Definition: enums.hpp:123
M2K_TRIGGER_OUT_SELECT
Select which trigger event will be forwarded on TO pin (trigger out)
Definition: enums.hpp:205
Triggering system.
Definition: enums.hpp:219
DIO_TRIGGER_MODE
Triggering mode for digital channels.
Definition: digital/enums.hpp:105
Controls the hardware trigger for ADALM2000.
Definition: m2khardwaretrigger.hpp:41
M2K_TRIGGER_SOURCE_ANALOG
Select the source for the analog trigger.
Definition: enums.hpp:140
Generic M2K enumerations.