Fix doc path
[opentx.git] / companion / src / firmwares / er9x / er9xeeprom.h
blob2ad3917cbb40253a333f18126de114a2ca567071
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 _ER9XEEPROM_H_
22 #define _ER9XEEPROM_H_
24 #include <inttypes.h>
25 #include "eeprominterface.h"
27 //eeprom data
28 #define ER9X_MAX_MIXERS 32
29 #define ER9X_MAX_CURVE5 8
30 #define ER9X_MAX_CURVE9 8
31 #define ER9X_MAX_CSFUNC 13
33 #define MDVERS 10
35 #define ER9X_NUM_CHNOUT 16 //number of real outputchannels CH1-CH8
36 #define ER9X_NUM_CSW 12 //number of custom switches
37 #define CPN_MAX_STICKSnPOTS 7 //number of sticks and pots
38 #define ER9X_MAX_GVARS 7
40 #define ER9X_MAX_MODES 4
42 PACK(typedef struct t_Er9xTrainerMix {
43 uint8_t srcChn:3; //0-7 = ch1-8
44 int8_t swtch:5;
45 int8_t studWeight:6;
46 uint8_t mode:2; // off, add-mode, subst-mode
48 operator TrainerMix();
49 t_Er9xTrainerMix();
50 }) Er9xTrainerMix; //
52 PACK(typedef struct t_Er9xTrainerData {
53 int16_t calib[4];
54 Er9xTrainerMix mix[4];
56 operator TrainerData();
57 t_Er9xTrainerData();
58 }) Er9xTrainerData;
60 PACK(typedef struct t_Er9xGeneral {
61 uint8_t myVers;
62 int16_t calibMid[CPN_MAX_STICKSnPOTS];
63 int16_t calibSpanNeg[CPN_MAX_STICKSnPOTS];
64 int16_t calibSpanPos[CPN_MAX_STICKSnPOTS];
65 uint16_t chkSum;
66 uint8_t currModel; //0..15
67 uint8_t contrast;
68 uint8_t vBatWarn;
69 int8_t txVoltageCalibration;
70 int8_t lightSw;
71 Er9xTrainerData trainer;
72 uint8_t view;
73 uint8_t disableThrottleWarning:1;
74 uint8_t disableSwitchWarning:1;
75 uint8_t disableMemoryWarning:1;
76 uint8_t beeperVal:3;
77 uint8_t reserveWarning:1;
78 uint8_t disableAlarmWarning:1;
79 uint8_t stickMode;
80 int8_t inactivityTimer;
81 uint8_t throttleReversed:1;
82 uint8_t minuteBeep:1;
83 uint8_t preBeep:1;
84 uint8_t flashBeep:1;
85 uint8_t disableSplashScreen:1;
86 uint8_t disablePotScroll:1;
87 uint8_t disableBG:1;
88 uint8_t frskyinternalalarm:1;
89 uint8_t spare_filter ; // No longer needed, left for eepe compatibility for now
90 uint8_t lightAutoOff;
91 uint8_t templateSetup; //RETA order according to chout_ar array
92 int8_t PPM_Multiplier;
93 uint8_t unused1;
94 uint8_t unused2:4;
95 uint8_t hideNameOnSplash:1;
96 uint8_t enablePpmsim:1;
97 uint8_t blightinv:1;
98 uint8_t stickScroll:1;
99 uint8_t speakerPitch;
100 uint8_t hapticStrength;
101 uint8_t speakerMode;
102 uint8_t lightOnStickMove;
104 char ownerName[10];
105 uint8_t switchWarningStates;
106 uint8_t volume ;
107 uint8_t res[3];
108 uint8_t crosstrim:1;
109 uint8_t spare1:7;
111 operator GeneralSettings();
112 t_Er9xGeneral();
113 }) Er9xGeneral;
115 PACK(typedef struct t_Er9xExpoData {
116 int8_t expo[3][2][2];
117 int8_t drSw1;
118 int8_t drSw2;
120 t_Er9xExpoData() { memset(this, 0, sizeof(t_Er9xExpoData)); }
121 }) Er9xExpoData;
124 PACK(typedef struct t_Er9xLimitData {
125 int8_t min;
126 int8_t max;
127 bool revert;
128 int16_t offset;
130 operator LimitData();
131 t_Er9xLimitData();
132 }) Er9xLimitData;
134 #define MLTPX_ADD 0
135 #define MLTPX_MUL 1
136 #define MLTPX_REP 2
138 PACK(typedef struct t_Er9xMixData {
139 uint8_t destCh; // 1..CPN_MAX_CHNOUT
140 uint8_t srcRaw; //
141 int8_t weight;
142 int8_t swtch;
143 uint8_t curve; //0=symmetrisch 1=no neg 2=no pos
144 uint8_t delayUp:4;
145 uint8_t delayDown:4;
146 uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
147 uint8_t speedDown:4; // 0 nichts
148 uint8_t carryTrim:1;
149 uint8_t mltpx:2; // multiplex method 0=+ 1=* 2=replace
150 uint8_t lateOffset:1; // Add offset later
151 uint8_t mixWarn:2; // mixer warning
152 uint8_t enableFmTrim:1;
153 uint8_t differential:1;
154 int8_t sOffset;
155 int8_t res;
157 operator MixData();
158 t_Er9xMixData();
159 }) Er9xMixData;
162 PACK(typedef struct t_Er9xLogicalSwitchData { // Custom Switches data
163 int8_t v1; //input
164 int8_t v2; //offset
165 uint8_t func:4;
166 uint8_t andsw:4;
168 operator LogicalSwitchData();
169 t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData)); }
170 }) Er9xLogicalSwitchData;
172 PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
173 int8_t swtch;
174 int8_t val;
176 t_Er9xSafetySwData();
177 }) Er9xSafetySwData;
179 PACK(typedef struct t_Er9xFrSkyChannelData {
180 uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
181 uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
182 uint8_t alarms_level:4;
183 uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
184 uint8_t type:2; // future use: 0=volts, ...
186 operator FrSkyChannelData();
187 t_Er9xFrSkyChannelData();
188 }) Er9xFrSkyChannelData;
190 PACK(typedef struct t_Er9xFrSkyData {
191 Er9xFrSkyChannelData channels[2];
193 operator FrSkyData();
194 t_Er9xFrSkyData();
195 }) Er9xFrSkyData;
197 PACK(typedef struct t_gvar {
198 int8_t gvar ;
199 uint8_t gvsource ;
200 // int8_t gvswitch ;
201 }) Er9xGvarData ;
203 PACK(typedef struct t_FlightModeData {
204 // Trim store as -1001 to -1, trim value-501, 0-5 use trim of phase 0-5
205 int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of modes 1|2|3|4 instead
206 int8_t swtch; // Try 0-5 use trim of phase 0-5, 1000-2000, trim + 1500 ???
207 uint8_t fadeIn:4;
208 uint8_t fadeOut:4;
209 }) Er9xFlightModeData;
211 PACK(typedef struct t_Er9xModelData {
212 char name[10]; // 10 must be first for eeLoadModelName
213 uint8_t modelVoice ; // Index to model name voice (260+value)
214 int8_t tmrMode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
215 uint8_t tmrDir:1; //0=>Count Down, 1=>Count Up
216 uint8_t traineron:1; // 0 disable trainer, 1 allow trainer
217 uint8_t t2throttle:1 ; // Start timer2 using throttle
218 uint8_t FrSkyUsrProto:1 ; // Protocol in FrSky User Data, 0=FrSky Hub, 1=WS HowHigh
219 uint8_t FrSkyGpsAlt:1 ; // Use Gps Altitude as main altitude reading
220 uint8_t FrSkyImperial:1 ; // Convert FrSky values to imperial units
221 uint8_t FrSkyAltAlarm:2;
222 uint16_t tmrVal;
223 uint8_t protocol;
224 int8_t ppmNCH;
225 uint8_t thrTrim:1; // Enable Throttle Trim
226 uint8_t xnumBlades:2; // RPM scaling
227 uint8_t spare10:1;
228 uint8_t thrExpo:1; // Enable Throttle Expo
229 uint8_t ppmStart:3 ; // Start channel for PPM
230 int8_t trimInc; // Trim Increments
231 int8_t ppmDelay;
232 int8_t trimSw;
233 uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
234 uint8_t pulsePol:1;
235 uint8_t extendedLimits:1;
236 uint8_t swashInvertELE:1;
237 uint8_t swashInvertAIL:1;
238 uint8_t swashInvertCOL:1;
239 uint8_t swashType:3;
240 uint8_t swashCollectiveSource;
241 uint8_t swashRingValue;
242 int8_t ppmFrameLength;
243 Er9xMixData mixData[ER9X_MAX_MIXERS];
244 Er9xLimitData limitData[ER9X_NUM_CHNOUT];
245 Er9xExpoData expoData[4];
246 int8_t trim[4];
247 int8_t curves5[ER9X_MAX_CURVE5][5];
248 int8_t curves9[ER9X_MAX_CURVE9][9];
249 Er9xLogicalSwitchData logicalSw[ER9X_NUM_CSW];
250 uint8_t frSkyVoltThreshold ;
251 int8_t tmrModeB;
252 uint8_t numVoice;
253 Er9xSafetySwData safetySw[ER9X_NUM_CHNOUT];
254 Er9xFrSkyData frsky;
255 uint8_t numBlades ;
256 uint8_t unused1[8] ;
257 uint8_t CustomDisplayIndex[6] ;
258 Er9xGvarData gvars[ER9X_MAX_GVARS] ;
259 Er9xFlightModeData flightModeData[ER9X_MAX_MODES] ;
261 operator ModelData();
262 t_Er9xModelData() { memset(this, 0, sizeof(t_Er9xModelData)); }
263 }) Er9xModelData;
265 #endif // _ER9XEEPROM_H_