-
Notifications
You must be signed in to change notification settings - Fork 2
/
widget.hpp
126 lines (111 loc) · 2.71 KB
/
widget.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
Copyright (C) 2011 Georgia Institute of Technology
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include <rtxi/widgets.hpp>
// This is an generated header file. You may change the namespace, but
// make sure to do the same in implementation (.cpp) file
namespace ttl_pulses
{
constexpr std::string_view MODULE_NAME = "ttl-pulses";
enum PARAMETER : Widgets::Variable::Id
{
// set parameter ids here
TTL_DURATION=0,
TTL_PULSES,
TTL_FREQUENCY,
TTL_DELAY,
REPEAT,
CURRENT_TRIAL,
CURRENT_PULSE
};
inline std::vector<Widgets::Variable::Info> get_default_vars()
{
return {
{
TTL_DURATION,
"TTL Duration (s)",
"Duration of pulse",
Widgets::Variable::DOUBLE_PARAMETER,
0.25
},
{
TTL_PULSES,
"TTL Pulses (#)",
"Number of pulses",
Widgets::Variable::UINT_PARAMETER,
uint64_t{1}
},
{
TTL_FREQUENCY,
"TTL Freq (Hz)",
"Frequency measured between pulse onsets",
Widgets::Variable::DOUBLE_PARAMETER,
1.0
},
{
TTL_DELAY,
"TTL Delay (s)",
"Time to wait between trials",
Widgets::Variable::DOUBLE_PARAMETER,
0.5
},
{
REPEAT,
"Repeat (#)",
"Number of trials",
Widgets::Variable::UINT_PARAMETER,
uint64_t{1}
},
{
CURRENT_TRIAL,
"Current Trial",
"Current trial being executed",
Widgets::Variable::STATE,
uint64_t{1}
},
{
CURRENT_PULSE,
"Current Pulse",
"Current pulse being executed",
Widgets::Variable::STATE,
uint64_t{1}
}
};
}
inline std::vector<IO::channel_t> get_default_channels()
{
return {
{ "TTL Signal", "TTL Signal", IO::OUTPUT, }, // output(0)
};
}
class Panel : public Widgets::Panel
{
Q_OBJECT
public:
Panel(QMainWindow* main_window, Event::Manager* ev_manager);
};
class Component : public Widgets::Component
{
public:
explicit Component(Widgets::Plugin* hplugin);
void execute() override;
private:
int64_t t_zero;
};
class Plugin : public Widgets::Plugin
{
public:
explicit Plugin(Event::Manager* ev_manager);
};
} // namespace ttl_pulses