forked from analogdevicesinc/scopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardware_trigger.hpp
106 lines (81 loc) · 2.2 KB
/
hardware_trigger.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef HARDWARE_TRIGGER_H
#define HARDWARE_TRIGGER_H
#include <iio.h>
#include <QList>
#include <QVector>
#include <QString>
#include <memory>
extern "C" {
struct iio_device;
struct iio_channel;
}
namespace adiscope {
class HardwareTrigger
{
public:
enum condition {
RISING_EDGE = 0,
FALLING_EDGE = 1,
LOW = 3,
HIGH = 4,
ANY_EDGE = 5,
};
enum mode {
ALWAYS = 0,
ANALOG = 1,
DIGITAL = 2,
DIGITAL_OR_ANALOG = 3,
DIGITAL_AND_ANALOG = 4,
DIGITAL_XOR_ANALOG = 5,
N_DIGITAL_OR_ANALOG = 6,
N_DIGITAL_AND_ANALOG = 7,
N_DIGITAL_XOR_ANALOG = 8,
};
struct Settings {
QList<condition> analog_condition;
QList<condition> digital_condition;
QList<int> level;
QList<int> hysteresis;
QList<enum mode> mode;
QString source;
int delay;
};
typedef std::unique_ptr<HardwareTrigger::Settings> settings_uptr;
public:
HardwareTrigger(struct iio_device *trigger_dev);
uint numChannels() const;
condition analogCondition(uint chnIdx) const;
void setAnalogCondition(uint chnIdx, condition cond);
condition digitalCondition(uint chnIdx) const;
void setDigitalCondition(uint chnIdx, condition cond);
int level(uint chnIdx) const;
void setLevel(uint chnIdx, int level);
int hysteresis(uint chnIdx) const;
void setHysteresis(uint chnIdx, int histeresis);
mode triggerMode(uint chnIdx) const;
void setTriggerMode(uint chnIdx, mode mode);
QString source() const;
void setSource(const QString& source);
int sourceChannel() const;
void setSourceChannel(uint chnIdx);
int delay() const;
void setDelay(int delay);
std::unique_ptr<struct Settings> getCurrentHwSettings();
void setHwTriggerSettings(struct Settings *settings);
void setStreamingFlag(bool);
bool getStreamingFlag();
private:
struct iio_device *m_trigger_device;
QList<struct iio_channel *> m_analog_channels;
QList<struct iio_channel *> m_digital_channels;
QList<struct iio_channel *> m_logic_channels;
struct iio_channel *m_delay_trigger;
bool m_streaming_flag;
uint m_num_channels;
static QVector<QString> lut_analog_trigg_cond;
static QVector<QString> lut_digital_trigg_cond;
static QVector<QString> lut_trigg_mode;
static QVector<QString> lut_trigg_source;
};
} /* namespace adiscope */
#endif // HARDWARE_TRIGGER_H