External module on X10 now tested OK
[opentx.git] / radio / src / myeeprom.h
blob6f98e285ceef3fdc7b804798705de6743f0a3cb9
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 _MYEEPROM_H_
22 #define _MYEEPROM_H_
24 #include "datastructs.h"
26 #define WARN_THR_BIT 0x01
27 #define WARN_BEP_BIT 0x80
28 #define WARN_SW_BIT 0x02
29 #define WARN_MEM_BIT 0x04
30 #define WARN_BVAL_BIT 0x38
32 #define WARN_THR (!(g_eeGeneral.warnOpts & WARN_THR_BIT))
33 #define WARN_BEP (!(g_eeGeneral.warnOpts & WARN_BEP_BIT))
34 #define WARN_SW (!(g_eeGeneral.warnOpts & WARN_SW_BIT))
35 #define WARN_MEM (!(g_eeGeneral.warnOpts & WARN_MEM_BIT))
36 #define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
38 #if defined(CPUARM)
39 #define EEPROM_VER 218
40 #define FIRST_CONV_EEPROM_VER 216
41 #elif defined(CPUM2560) || defined(CPUM2561)
42 #define EEPROM_VER 217
43 #define FIRST_CONV_EEPROM_VER EEPROM_VER
44 #elif defined(CPUM128)
45 #define EEPROM_VER 217
46 #else
47 #define EEPROM_VER 216
48 #endif
50 #define GET_PPM_POLARITY(idx) g_model.moduleData[idx].ppm.pulsePol
51 #define GET_PPM_DELAY(idx) (g_model.moduleData[idx].ppm.delay * 50 + 300)
52 #define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppm.frameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
54 #if defined(PCBHORUS)
55 #define IS_TRAINER_EXTERNAL_MODULE() false
56 #define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER)
57 #elif defined(PCBTARANIS)
58 #define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE)
59 #define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER)
60 #else
61 #define IS_TRAINER_EXTERNAL_MODULE() false
62 #endif
64 #if defined(VOICE)
65 #define IS_PLAY_FUNC(func) ((func) >= FUNC_PLAY_SOUND && func <= FUNC_PLAY_VALUE)
66 #else
67 #define IS_PLAY_FUNC(func) ((func) == FUNC_PLAY_SOUND)
68 #endif
70 #if defined(CPUARM)
71 #define IS_PLAY_BOTH_FUNC(func) (0)
72 #define IS_VOLUME_FUNC(func) ((func) == FUNC_VOLUME)
73 #else
74 #define IS_PLAY_BOTH_FUNC(func) ((func) == FUNC_PLAY_BOTH)
75 #define IS_VOLUME_FUNC(func) (0)
76 #endif
78 #if defined(GVARS)
79 #define IS_ADJUST_GV_FUNC(func) ((func) == FUNC_ADJUST_GVAR)
80 #else
81 #define IS_ADJUST_GV_FUNC(func) (0)
82 #endif
84 #if defined(HAPTIC)
85 #define IS_HAPTIC_FUNC(func) ((func) == FUNC_HAPTIC)
86 #else
87 #define IS_HAPTIC_FUNC(func) (0)
88 #endif
90 #define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE)
91 #define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func))
93 #if defined(CPUARM)
94 #define CFN_EMPTY(p) (!(p)->swtch)
95 #define CFN_SWITCH(p) ((p)->swtch)
96 #define CFN_FUNC(p) ((p)->func)
97 #define CFN_ACTIVE(p) ((p)->active)
98 #define CFN_CH_INDEX(p) ((p)->all.param)
99 #define CFN_GVAR_INDEX(p) ((p)->all.param)
100 #define CFN_TIMER_INDEX(p) ((p)->all.param)
101 #define CFN_PLAY_REPEAT(p) ((p)->active)
102 #define CFN_PLAY_REPEAT_MUL 1
103 #define CFN_PLAY_REPEAT_NOSTART 0xFF
104 #define CFN_GVAR_MODE(p) ((p)->all.mode)
105 #define CFN_PARAM(p) ((p)->all.val)
106 #define CFN_RESET(p) ((p)->active=0, (p)->clear.val1=0, (p)->clear.val2=0)
107 #define CFN_GVAR_CST_MIN -GVAR_MAX
108 #define CFN_GVAR_CST_MAX GVAR_MAX
109 #elif defined(CPUM2560)
110 #define CFN_SWITCH(p) ((p)->swtch)
111 #define CFN_FUNC(p) ((p)->func)
112 #define CFN_ACTIVE(p) ((p)->active)
113 #define CFN_CH_INDEX(p) ((p)->param)
114 #define CFN_TIMER_INDEX(p) ((p)->param)
115 #define CFN_GVAR_INDEX(p) ((p)->param)
116 #define CFN_PLAY_REPEAT(p) ((p)->param)
117 #define CFN_PLAY_REPEAT_MUL 10
118 #define CFN_GVAR_MODE(p) ((p)->mode)
119 #define CFN_PARAM(p) ((p)->value)
120 #define CFN_RESET(p) ((p)->active = 0, CFN_PARAM(p) = 0)
121 #define CFN_GVAR_CST_MAX 125
122 #else
123 #define CFN_SWITCH(p) ((p)->all.swtch)
124 #define CFN_FUNC(p) ((p)->all.func)
125 #define CFN_ACTIVE(p) ((p)->all.active)
126 #define CFN_CH_INDEX(p) ((p)->all.param)
127 #define CFN_TIMER_INDEX(p) ((p)->all.param)
128 #define CFN_GVAR_INDEX(p) ((p)->gvar.param)
129 #define CFN_PLAY_REPEAT(p) ((p)->all.param)
130 #define CFN_PLAY_REPEAT_MUL 10
131 #define CFN_GVAR_MODE(p) ((p)->gvar.mode)
132 #define CFN_PARAM(p) ((p)->value)
133 #define CFN_RESET(p) ((p)->all.active = 0, CFN_PARAM(p) = 0)
134 #define CFN_GVAR_CST_MAX 125
135 #endif
137 #if defined(PCBTARANIS) || defined(PCBHORUS) || defined(PCBFLAMENCO)
138 enum SwitchConfig {
139 SWITCH_NONE,
140 SWITCH_TOGGLE,
141 SWITCH_2POS,
142 SWITCH_3POS,
144 enum PotConfig {
145 POT_NONE,
146 POT_WITH_DETENT,
147 POT_MULTIPOS_SWITCH,
148 POT_WITHOUT_DETENT
150 enum SliderConfig {
151 SLIDER_NONE,
152 SLIDER_WITH_DETENT,
154 #define SWITCH_CONFIG(x) ((g_eeGeneral.switchConfig >> (2*(x))) & 0x03)
155 #define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
156 #define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
157 #define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
158 #define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !IS_CONFIG_TOGGLE(x))
159 #else
160 #define IS_CONFIG_3POS(x) IS_3POS(x)
161 #define IS_CONFIG_TOGGLE(x) IS_TOGGLE(x)
162 #define switchInfo(x) ((x) >= 3 ? (x)-2 : 0)
163 #define SWITCH_EXISTS(x) true
164 #endif
166 #define ALTERNATE_VIEW 0x10
168 #if defined(PCBHORUS)
169 #include "layout.h"
170 #include "theme.h"
171 #include "topbar.h"
172 #else
173 #define THEME_DATA
174 #endif
176 #define SWITCHES_DELAY() uint8_t(15+g_eeGeneral.switchesDelay)
177 #define SWITCHES_DELAY_NONE (-15)
178 #define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength)
180 enum CurveRefType {
181 CURVE_REF_DIFF,
182 CURVE_REF_EXPO,
183 CURVE_REF_FUNC,
184 CURVE_REF_CUSTOM
187 #if !defined(CPUARM)
188 #define MODE_DIFFERENTIAL 0
189 #define MODE_EXPO 0
190 #define MODE_CURVE 1
191 #endif
193 #if defined(CPUARM)
194 #define MIN_EXPO_WEIGHT -100
195 #define EXPO_VALID(ed) ((ed)->mode)
196 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
197 #elif defined(CPUM2560) || defined(CPUM2561)
198 #define MIN_EXPO_WEIGHT 0
199 #define EXPO_VALID(ed) ((ed)->mode)
200 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
201 #else
202 #define MIN_EXPO_WEIGHT 0
203 #define EXPO_VALID(ed) ((ed)->mode)
204 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
205 #endif
207 #if defined(CPUARM)
208 #define limit_min_max_t int16_t
209 #define LIMIT_EXT_PERCENT 150
210 #define LIMIT_EXT_MAX (LIMIT_EXT_PERCENT*10)
211 #define PPM_CENTER_MAX 500
212 #define LIMIT_MAX(lim) (GV_IS_GV_VALUE(lim->max, -GV_RANGELARGE, GV_RANGELARGE) ? GET_GVAR_PREC1(lim->max, -LIMIT_EXT_MAX, LIMIT_EXT_MAX, mixerCurrentFlightMode) : lim->max+1000)
213 #define LIMIT_MIN(lim) (GV_IS_GV_VALUE(lim->min, -GV_RANGELARGE, GV_RANGELARGE) ? GET_GVAR_PREC1(lim->min, -LIMIT_EXT_MAX, LIMIT_EXT_MAX, mixerCurrentFlightMode) : lim->min-1000)
214 #define LIMIT_OFS(lim) (GV_IS_GV_VALUE(lim->offset, -1000, 1000) ? GET_GVAR_PREC1(lim->offset, -1000, 1000, mixerCurrentFlightMode) : lim->offset)
215 #define LIMIT_MAX_RESX(lim) calc1000toRESX(LIMIT_MAX(lim))
216 #define LIMIT_MIN_RESX(lim) calc1000toRESX(LIMIT_MIN(lim))
217 #define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
218 #else
219 #define limit_min_max_t int8_t
220 #define LIMIT_EXT_PERCENT 125
221 #define LIMIT_EXT_MAX LIMIT_EXT_PERCENT
222 #define PPM_CENTER_MAX 125
223 #define LIMIT_MAX(lim) (lim->max+100)
224 #define LIMIT_MIN(lim) (lim->min-100)
225 #define LIMIT_OFS(lim) (lim->offset)
226 #define LIMIT_MAX_RESX(lim) calc100toRESX(LIMIT_MAX(lim))
227 #define LIMIT_MIN_RESX(lim) calc100toRESX(LIMIT_MIN(lim))
228 #define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
229 #endif
231 #define TRIM_OFF (1)
232 #define TRIM_ON (0)
233 #define TRIM_RUD (-1)
234 #define TRIM_ELE (-2)
235 #define TRIM_THR (-3)
236 #define TRIM_AIL (-4)
237 #if defined(PCBHORUS)
238 #define TRIM_T5 (-5)
239 #define TRIM_T6 (-6)
240 #define TRIM_LAST TRIM_T6
241 #else
242 #define TRIM_LAST TRIM_AIL
243 #endif
245 #define MLTPX_ADD 0
246 #define MLTPX_MUL 1
247 #define MLTPX_REP 2
249 #if defined(CPUARM)
250 #define GV1_SMALL 128
251 #define GV1_LARGE 1024
252 #define GV_RANGE_WEIGHT 500
253 #define GV_RANGE_OFFSET 500
254 #define DELAY_STEP 10
255 #define SLOW_STEP 10
256 #define DELAY_MAX (25*DELAY_STEP) /* 25 seconds */
257 #define SLOW_MAX (25*SLOW_STEP) /* 25 seconds */
259 #define MD_WEIGHT(md) (md->weight)
260 #define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight
261 #define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word
263 #define MD_OFFSET(md) (md->offset)
264 #define MD_OFFSET_TO_UNION(md, var) var.word = md->offset
265 #define MD_UNION_TO_OFFSET(var, md) md->offset = var.word
266 // #define MD_SETOFFSET(md, val) md->offset = val
268 #else
270 // highest bit used for small values in mix 128 --> 8 bit is enough
271 #define GV1_SMALL 128
272 // highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode)
273 #define GV1_LARGE 256
275 #define DELAY_STEP 2
276 #define SLOW_STEP 2
277 #define DELAY_MAX 15 /* 7.5 seconds */
278 #define SLOW_MAX 15 /* 7.5 seconds */
280 PACK(union u_gvarint_t {
281 struct {
282 int8_t lo;
283 uint8_t hi;
284 } bytes_t;
285 int16_t word;
287 u_gvarint_t(int8_t l, uint8_t h) {bytes_t.lo=l; bytes_t.hi=h?255:0;} // hi bit is negativ sign
289 private:
290 // prevent unwanted constructors, also saves program
291 u_gvarint_t() {}
292 u_gvarint_t(const u_gvarint_t&) {}
294 #define MD_WEIGHT(md) (u_gvarint_t(md->weight,md->weightMode).word)
296 #define MD_WEIGHT_TO_UNION(md, var) var.bytes_t.lo=md->weight; var.bytes_t.hi=md->weightMode?255:0
297 #define MD_UNION_TO_WEIGHT(var, md) md->weight=var.bytes_t.lo; if (var.word<0) md->weightMode=1; else md->weightMode=0
298 // #define MD_SETWEIGHT(md, val) md->weight=val; if (val<0) md->weightMode=1; else md->weightMode=0
300 #define MD_OFFSET(md) (u_gvarint_t(md->offset,md->offsetMode).word)
301 #define MD_OFFSET_TO_UNION(md, var) var.bytes_t.lo=md->offset; var.bytes_t.hi=md->offsetMode?255:0
302 #define MD_UNION_TO_OFFSET(var, md) md->offset=var.bytes_t.lo; if (var.word<0) md->offsetMode=1; else md->offsetMode=0 /* set negative sign */
303 // #define MD_SETOFFSET(md, val) md->offset=val; if (val<0) md->offsetMode=1; else md->offsetMode=0
305 #endif
307 enum LogicalSwitchesFunctions {
308 LS_FUNC_NONE,
309 #if defined(CPUARM)
310 LS_FUNC_VEQUAL, // v==offset
311 #endif
312 LS_FUNC_VALMOSTEQUAL, // v~=offset
313 LS_FUNC_VPOS, // v>offset
314 LS_FUNC_VNEG, // v<offset
315 #if defined(CPUARM)
316 LS_FUNC_RANGE,
317 #endif
318 LS_FUNC_APOS, // |v|>offset
319 LS_FUNC_ANEG, // |v|<offset
320 LS_FUNC_AND,
321 LS_FUNC_OR,
322 LS_FUNC_XOR,
323 #if defined(CPUARM)
324 LS_FUNC_EDGE,
325 #endif
326 LS_FUNC_EQUAL,
327 LS_FUNC_GREATER,
328 LS_FUNC_LESS,
329 LS_FUNC_DIFFEGREATER,
330 LS_FUNC_ADIFFEGREATER,
331 LS_FUNC_TIMER,
332 LS_FUNC_STICKY,
333 LS_FUNC_COUNT,
334 LS_FUNC_MAX = LS_FUNC_COUNT-1
337 #if defined(CPUARM)
338 #define MAX_LS_DURATION 250 /*25s*/
339 #define MAX_LS_DELAY 250 /*25s*/
340 #define MAX_LS_ANDSW SWSRC_LAST
341 #else
342 #define MAX_LS_ANDSW 15
343 #endif
345 #if defined(CPUARM)
346 //#define TELEM_FLAG_TIMEOUT 0x01
347 #define TELEM_FLAG_LOG 0x02
348 //#define TELEM_FLAG_PERSISTENT 0x04
349 //#define TELEM_FLAG_SCALE 0x08
350 #define TELEM_FLAG_AUTO_OFFSET 0x10
351 #define TELEM_FLAG_FILTER 0x20
352 #define TELEM_FLAG_LOSS_ALARM 0x40
354 enum TelemetrySensorType
356 TELEM_TYPE_CUSTOM,
357 TELEM_TYPE_CALCULATED
360 enum TelemetrySensorFormula
362 TELEM_FORMULA_ADD,
363 TELEM_FORMULA_AVERAGE,
364 TELEM_FORMULA_MIN,
365 TELEM_FORMULA_MAX,
366 TELEM_FORMULA_MULTIPLY,
367 TELEM_FORMULA_TOTALIZE,
368 TELEM_FORMULA_CELL,
369 TELEM_FORMULA_CONSUMPTION,
370 TELEM_FORMULA_DIST,
371 TELEM_FORMULA_LAST = TELEM_FORMULA_DIST
373 #endif
375 enum VarioSource {
376 #if !defined(TELEMETRY_FRSKY_SPORT)
377 VARIO_SOURCE_ALTI,
378 VARIO_SOURCE_ALTI_PLUS,
379 #endif
380 VARIO_SOURCE_VSPEED,
381 VARIO_SOURCE_A1,
382 VARIO_SOURCE_A2,
383 #if defined(TELEMETRY_FRSKY_SPORT)
384 VARIO_SOURCE_DTE,
385 #endif
386 VARIO_SOURCE_COUNT,
387 VARIO_SOURCE_LAST = VARIO_SOURCE_COUNT-1
390 enum FrskyUsrProtocols {
391 USR_PROTO_NONE,
392 USR_PROTO_FRSKY,
393 USR_PROTO_WS_HOW_HIGH,
394 USR_PROTO_LAST = USR_PROTO_WS_HOW_HIGH,
397 enum FrskyCurrentSource {
398 FRSKY_CURRENT_SOURCE_NONE,
399 FRSKY_CURRENT_SOURCE_A1,
400 FRSKY_CURRENT_SOURCE_A2,
401 #if defined(CPUARM)
402 FRSKY_CURRENT_SOURCE_A3,
403 FRSKY_CURRENT_SOURCE_A4,
404 #endif
405 FRSKY_CURRENT_SOURCE_FAS,
406 FRSKY_CURRENT_SOURCE_LAST=FRSKY_CURRENT_SOURCE_FAS
409 enum FrskyVoltsSource {
410 FRSKY_VOLTS_SOURCE_A1,
411 FRSKY_VOLTS_SOURCE_A2,
412 #if defined(CPUARM)
413 FRSKY_VOLTS_SOURCE_A3,
414 FRSKY_VOLTS_SOURCE_A4,
415 #endif
416 FRSKY_VOLTS_SOURCE_FAS,
417 FRSKY_VOLTS_SOURCE_CELLS,
418 FRSKY_VOLTS_SOURCE_LAST=FRSKY_VOLTS_SOURCE_CELLS
423 enum SwashType {
424 SWASH_TYPE_NONE,
425 SWASH_TYPE_120,
426 SWASH_TYPE_120X,
427 SWASH_TYPE_140,
428 SWASH_TYPE_90,
429 SWASH_TYPE_MAX = SWASH_TYPE_90
432 #define TRIM_EXTENDED_MAX 500
433 #define TRIM_EXTENDED_MIN (-TRIM_EXTENDED_MAX)
434 #define TRIM_MAX 125
435 #define TRIM_MIN (-TRIM_MAX)
437 #define ROTARY_ENCODER_MAX 1024
439 #if defined(PCBSTD)
440 #define TRIMS_ARRAY_SIZE 5
441 #else
442 #define TRIMS_ARRAY_SIZE 8
443 #if defined(CPUARM)
444 #define TRIM_MODE_NONE 0x1F // 0b11111
445 #endif
446 #endif
448 #if defined(CPUARM)
449 #define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
450 #elif defined(CPUM2560)
451 #define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
452 #else
453 #define IS_MANUAL_RESET_TIMER(idx) 0
454 #endif
456 #if defined(CPUARM) && !defined(PCBSKY9X)
457 #define TIMER_COUNTDOWN_START(x) (g_model.timers[x].countdownStart > 0 ? 5 : 10 - g_model.timers[x].countdownStart * 10)
458 #else
459 #define TIMER_COUNTDOWN_START(x) 10
460 #endif
462 enum Protocols {
463 PROTO_PPM,
464 #if !defined(CPUARM)
465 PROTO_PPM16,
466 PROTO_PPMSIM,
467 #endif
468 #if defined(PXX) || defined(DSM2) || defined(IRPROTOS)
469 PROTO_PXX,
470 #endif
471 #if defined(DSM2) || defined(IRPROTOS)
472 PROTO_DSM2_LP45,
473 PROTO_DSM2_DSM2,
474 PROTO_DSM2_DSMX,
475 #endif
476 #if defined(CROSSFIRE) || defined(MULTIMODULE)
477 PROTO_CROSSFIRE,
478 #endif
479 #if defined(IRPROTOS)
480 // only used on AVR
481 // we will need 4 bits for proto :(
482 PROTO_SILV,
483 PROTO_TRAC09,
484 PROTO_PICZ,
485 PROTO_SWIFT,
486 #endif
487 #if defined(MULTIMODULE)
488 PROTO_MULTIMODULE,
489 #endif
490 PROTO_MAX,
491 PROTO_NONE
494 enum XJTRFProtocols {
495 RF_PROTO_OFF = -1,
496 RF_PROTO_X16,
497 RF_PROTO_D8,
498 RF_PROTO_LR12,
499 RF_PROTO_LAST = RF_PROTO_LR12
502 enum MultiModuleRFProtocols {
503 MM_RF_PROTO_CUSTOM = -1,
504 MM_RF_PROTO_FIRST = MM_RF_PROTO_CUSTOM,
505 MM_RF_PROTO_FLYSKY=0,
506 MM_RF_PROTO_HUBSAN,
507 MM_RF_PROTO_FRSKY,
508 MM_RF_PROTO_HISKY,
509 MM_RF_PROTO_V2X2,
510 MM_RF_PROTO_DSM2,
511 MM_RF_PROTO_DEVO,
512 MM_RF_PROTO_YD717,
513 MM_RF_PROTO_KN,
514 MM_RF_PROTO_SYMAX,
515 MM_RF_PROTO_SLT,
516 MM_RF_PROTO_CX10,
517 MM_RF_PROTO_CG023,
518 MM_RF_PROTO_BAYANG,
519 MM_RF_PROTO_ESky,
520 MM_RF_PROTO_MT99XX,
521 MM_RF_PROTO_MJXQ,
522 MM_RF_PROTO_SHENQI,
523 MM_RF_PROTO_FY326,
524 MM_RF_PROTO_SFHSS,
525 MM_RF_PROTO_J6PRO,
526 MM_RF_PROTO_FQ777,
527 MM_RF_PROTO_ASSAN,
528 MM_RF_PROTO_HONTAI,
529 MM_RF_PROTO_OLRS,
530 MM_RF_PROTO_FS_AFHDS2A,
531 MM_RF_PROTO_Q2X2,
532 MM_RF_PROTO_WK_2X01,
533 MM_RF_PROTO_Q303,
534 MM_RF_PROTO_GW008,
535 MM_RF_PROTO_DM002,
536 MM_RF_PROTO_LAST= MM_RF_PROTO_DM002
539 enum MMDSM2Subtypes {
540 MM_RF_DSM2_SUBTYPE_DSM2_22,
541 MM_RF_DSM2_SUBTYPE_DSM2_11,
542 MM_RF_DSM2_SUBTYPE_DSMX_22,
543 MM_RF_DSM2_SUBTYPE_DSMX_11,
544 MM_RF_DSM2_SUBTYPE_AUTO
547 enum MMRFrskySubtypes {
548 MM_RF_FRSKY_SUBTYPE_D16,
549 MM_RF_FRSKY_SUBTYPE_D8,
550 MM_RF_FRSKY_SUBTYPE_D16_8CH,
551 MM_RF_FRSKY_SUBTYPE_V8,
552 MM_RF_FRSKY_SUBTYPE_D16_LBT,
553 MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH
556 #define HAS_RF_PROTOCOL_FAILSAFE(rf) ((rf) == RF_PROTO_X16)
557 #define HAS_RF_PROTOCOL_MODELINDEX(rf) (((rf) == RF_PROTO_X16) || ((rf) == RF_PROTO_LR12))
559 enum DSM2Protocols {
560 DSM2_PROTO_LP45,
561 DSM2_PROTO_DSM2,
562 DSM2_PROTO_DSMX,
565 enum ModuleTypes {
566 MODULE_TYPE_NONE = 0,
567 MODULE_TYPE_PPM,
568 MODULE_TYPE_XJT,
569 MODULE_TYPE_DSM2,
570 MODULE_TYPE_CROSSFIRE,
571 MODULE_TYPE_MULTIMODULE,
572 MODULE_TYPE_R9M,
573 MODULE_TYPE_COUNT
576 enum AntennaTypes {
577 XJT_INTERNAL_ANTENNA,
578 XJT_EXTERNAL_ANTENNA
581 enum FailsafeModes {
582 FAILSAFE_NOT_SET,
583 FAILSAFE_HOLD,
584 FAILSAFE_CUSTOM,
585 FAILSAFE_NOPULSES,
586 FAILSAFE_RECEIVER,
587 FAILSAFE_LAST = FAILSAFE_RECEIVER
590 enum ThrottleSources {
591 THROTTLE_SOURCE_THR,
592 THROTTLE_SOURCE_FIRST_POT,
593 #if defined(PCBFLAMENCO)
594 THROTTLE_SOURCE_SD,
595 THROTTLE_SOURCE_LS,
596 THROTTLE_SOURCE_RS,
597 #elif defined(PCBX9E)
598 THROTTLE_SOURCE_F1 = THROTTLE_SOURCE_FIRST_POT,
599 THROTTLE_SOURCE_F2,
600 THROTTLE_SOURCE_F3,
601 THROTTLE_SOURCE_F4,
602 THROTTLE_SOURCE_S1,
603 THROTTLE_SOURCE_S2,
604 THROTTLE_SOURCE_LS,
605 THROTTLE_SOURCE_RS,
606 #elif defined(PCBTARANIS)
607 THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_FIRST_POT,
608 THROTTLE_SOURCE_S2,
609 THROTTLE_SOURCE_S3,
610 THROTTLE_SOURCE_LS,
611 THROTTLE_SOURCE_RS,
612 #else
613 THROTTLE_SOURCE_P1 = THROTTLE_SOURCE_FIRST_POT,
614 THROTTLE_SOURCE_P2,
615 THROTTLE_SOURCE_P3,
616 #endif
617 THROTTLE_SOURCE_CH1,
620 enum TelemetryType
622 PROTOCOL_TELEMETRY_FIRST,
623 PROTOCOL_FRSKY_SPORT = PROTOCOL_TELEMETRY_FIRST,
624 PROTOCOL_FRSKY_D,
625 PROTOCOL_FRSKY_D_SECONDARY,
626 PROTOCOL_PULSES_CROSSFIRE,
627 PROTOCOL_SPEKTRUM,
628 PROTOCOL_FLYSKY_IBUS,
629 PROTOCOL_MULTIMODULE,
630 PROTOCOL_TELEMETRY_LAST=PROTOCOL_MULTIMODULE
633 enum DisplayTrims
635 DISPLAY_TRIMS_NEVER,
636 DISPLAY_TRIMS_CHANGE,
637 DISPLAY_TRIMS_ALWAYS
640 #define TOTAL_EEPROM_USAGE (sizeof(ModelData)*MAX_MODELS + sizeof(RadioData))
642 extern RadioData g_eeGeneral;
643 extern ModelData g_model;
645 PACK(union u_int8int16_t {
646 struct {
647 int8_t lo;
648 uint8_t hi;
649 } bytes_t;
650 int16_t word;
653 #endif // _MYEEPROM_H_