Make TX volatge for simu more flexible (#7124)
[opentx.git] / companion / src / firmwares / logicalswitchdata.h
blob1b1c508204d1be7cf44bd28ce7f96a8b0b603d63
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef LOGICALSWITCHDATA_H
22 #define LOGICALSWITCHDATA_H
24 #include <QtCore>
26 class RadioDataConversionState;
28 enum CSFunction {
29 LS_FN_OFF,
30 LS_FN_VPOS,
31 LS_FN_VNEG,
32 LS_FN_APOS,
33 LS_FN_ANEG,
34 LS_FN_AND,
35 LS_FN_OR,
36 LS_FN_XOR,
37 LS_FN_EQUAL,
38 LS_FN_NEQUAL,
39 LS_FN_GREATER,
40 LS_FN_LESS,
41 LS_FN_EGREATER,
42 LS_FN_ELESS,
43 LS_FN_DPOS,
44 LS_FN_DAPOS,
45 LS_FN_VEQUAL, // added at the end to avoid everything renumbered
46 LS_FN_VALMOSTEQUAL,
47 LS_FN_TIMER,
48 LS_FN_STICKY,
49 LS_FN_EDGE,
50 // later ... LS_FN_RANGE,
51 LS_FN_MAX
54 enum CSFunctionFamily {
55 LS_FAMILY_VOFS,
56 LS_FAMILY_VBOOL,
57 LS_FAMILY_VCOMP,
58 LS_FAMILY_TIMER,
59 LS_FAMILY_STICKY,
60 LS_FAMILY_EDGE,
63 class LogicalSwitchData {
64 Q_DECLARE_TR_FUNCTIONS(LogicalSwitchData)
66 public:
67 LogicalSwitchData(unsigned int func=0)
69 clear();
70 this->func = func;
72 unsigned int func;
73 int val1;
74 int val2;
75 int val3;
76 unsigned int delay;
77 unsigned int duration;
78 int andsw;
80 void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
81 bool isEmpty() const;
82 CSFunctionFamily getFunctionFamily() const;
83 unsigned int getRangeFlags() const;
84 QString funcToString() const;
85 QString nameToString(int index) const;
86 void convert(RadioDataConversionState & cstate);
89 #endif // LOGICALSWITCHDATA_H