Fix doc path
[opentx.git] / radio / src / myeeprom.h
blob34bccb5828d2ff623d26f3862db679dadc2845a3
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_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
52 #define GET_PPM_DELAY(idx) (g_model.moduleData[idx].ppm.delay * 50 + 300)
53 #define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppm.frameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
55 #if defined(PCBHORUS)
56 #define IS_TRAINER_EXTERNAL_MODULE() false
57 #define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER)
58 #elif defined(PCBTARANIS)
59 #define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE)
60 #define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER)
61 #else
62 #define IS_TRAINER_EXTERNAL_MODULE() false
63 #endif
65 #if defined(VOICE)
66 #define IS_PLAY_FUNC(func) ((func) >= FUNC_PLAY_SOUND && func <= FUNC_PLAY_VALUE)
67 #else
68 #define IS_PLAY_FUNC(func) ((func) == FUNC_PLAY_SOUND)
69 #endif
71 #if defined(CPUARM)
72 #define IS_PLAY_BOTH_FUNC(func) (0)
73 #define IS_VOLUME_FUNC(func) ((func) == FUNC_VOLUME)
74 #else
75 #define IS_PLAY_BOTH_FUNC(func) ((func) == FUNC_PLAY_BOTH)
76 #define IS_VOLUME_FUNC(func) (0)
77 #endif
79 #if defined(GVARS)
80 #define IS_ADJUST_GV_FUNC(func) ((func) == FUNC_ADJUST_GVAR)
81 #else
82 #define IS_ADJUST_GV_FUNC(func) (0)
83 #endif
85 #if defined(HAPTIC)
86 #define IS_HAPTIC_FUNC(func) ((func) == FUNC_HAPTIC)
87 #else
88 #define IS_HAPTIC_FUNC(func) (0)
89 #endif
91 #define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE)
92 #define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func))
94 #if defined(CPUARM)
95 #define CFN_EMPTY(p) (!(p)->swtch)
96 #define CFN_SWITCH(p) ((p)->swtch)
97 #define CFN_FUNC(p) ((p)->func)
98 #define CFN_ACTIVE(p) ((p)->active)
99 #define CFN_CH_INDEX(p) ((p)->all.param)
100 #define CFN_GVAR_INDEX(p) ((p)->all.param)
101 #define CFN_TIMER_INDEX(p) ((p)->all.param)
102 #define CFN_PLAY_REPEAT(p) ((p)->active)
103 #define CFN_PLAY_REPEAT_MUL 1
104 #define CFN_PLAY_REPEAT_NOSTART 0xFF
105 #define CFN_GVAR_MODE(p) ((p)->all.mode)
106 #define CFN_PARAM(p) ((p)->all.val)
107 #define CFN_RESET(p) ((p)->active=0, (p)->clear.val1=0, (p)->clear.val2=0)
108 #define CFN_GVAR_CST_MIN -GVAR_MAX
109 #define CFN_GVAR_CST_MAX GVAR_MAX
110 #define MODEL_GVAR_MIN(idx) (CFN_GVAR_CST_MIN + g_model.gvars[idx].min)
111 #define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
112 #elif defined(CPUM2560)
113 #define CFN_SWITCH(p) ((p)->swtch)
114 #define CFN_FUNC(p) ((p)->func)
115 #define CFN_ACTIVE(p) ((p)->active)
116 #define CFN_CH_INDEX(p) ((p)->param)
117 #define CFN_TIMER_INDEX(p) ((p)->param)
118 #define CFN_GVAR_INDEX(p) ((p)->param)
119 #define CFN_PLAY_REPEAT(p) ((p)->param)
120 #define CFN_PLAY_REPEAT_MUL 10
121 #define CFN_GVAR_MODE(p) ((p)->mode)
122 #define CFN_PARAM(p) ((p)->value)
123 #define CFN_RESET(p) ((p)->active = 0, CFN_PARAM(p) = 0)
124 #define CFN_GVAR_CST_MAX 125
125 #else
126 #define CFN_SWITCH(p) ((p)->all.swtch)
127 #define CFN_FUNC(p) ((p)->all.func)
128 #define CFN_ACTIVE(p) ((p)->all.active)
129 #define CFN_CH_INDEX(p) ((p)->all.param)
130 #define CFN_TIMER_INDEX(p) ((p)->all.param)
131 #define CFN_GVAR_INDEX(p) ((p)->gvar.param)
132 #define CFN_PLAY_REPEAT(p) ((p)->all.param)
133 #define CFN_PLAY_REPEAT_MUL 10
134 #define CFN_GVAR_MODE(p) ((p)->gvar.mode)
135 #define CFN_PARAM(p) ((p)->value)
136 #define CFN_RESET(p) ((p)->all.active = 0, CFN_PARAM(p) = 0)
137 #define CFN_GVAR_CST_MAX 125
138 #endif
140 #if defined(PCBTARANIS) || defined(PCBHORUS)
141 enum SwitchConfig {
142 SWITCH_NONE,
143 SWITCH_TOGGLE,
144 SWITCH_2POS,
145 SWITCH_3POS,
147 enum PotConfig {
148 POT_NONE,
149 POT_WITH_DETENT,
150 POT_MULTIPOS_SWITCH,
151 POT_WITHOUT_DETENT
153 enum SliderConfig {
154 SLIDER_NONE,
155 SLIDER_WITH_DETENT,
157 #define SWITCH_CONFIG(x) ((g_eeGeneral.switchConfig >> (2*(x))) & 0x03)
158 #define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
159 #define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
160 #define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
161 #define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !IS_CONFIG_TOGGLE(x))
162 #else
163 #define IS_CONFIG_3POS(x) IS_3POS(x)
164 #define IS_CONFIG_TOGGLE(x) IS_TOGGLE(x)
165 #define switchInfo(x) ((x) >= 3 ? (x)-2 : 0)
166 #define SWITCH_EXISTS(x) true
167 #endif
169 #define ALTERNATE_VIEW 0x10
171 #if defined(PCBHORUS)
172 #include "layout.h"
173 #include "theme.h"
174 #include "topbar.h"
175 #else
176 #define THEME_DATA
177 #endif
179 #define SWITCHES_DELAY() uint8_t(15+g_eeGeneral.switchesDelay)
180 #define SWITCHES_DELAY_NONE (-15)
181 #define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength)
183 enum CurveRefType {
184 CURVE_REF_DIFF,
185 CURVE_REF_EXPO,
186 CURVE_REF_FUNC,
187 CURVE_REF_CUSTOM
190 #if !defined(CPUARM)
191 #define MODE_DIFFERENTIAL 0
192 #define MODE_EXPO 0
193 #define MODE_CURVE 1
194 #endif
196 #if defined(CPUARM)
197 #define MIN_EXPO_WEIGHT -100
198 #define EXPO_VALID(ed) ((ed)->mode)
199 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
200 #elif defined(CPUM2560) || defined(CPUM2561)
201 #define MIN_EXPO_WEIGHT 0
202 #define EXPO_VALID(ed) ((ed)->mode)
203 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
204 #else
205 #define MIN_EXPO_WEIGHT 0
206 #define EXPO_VALID(ed) ((ed)->mode)
207 #define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
208 #endif
210 #if defined(CPUARM)
211 #define limit_min_max_t int16_t
212 #define LIMIT_EXT_PERCENT 150
213 #define LIMIT_EXT_MAX (LIMIT_EXT_PERCENT*10)
214 #define PPM_CENTER_MAX 500
215 #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)
216 #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)
217 #define LIMIT_OFS(lim) (GV_IS_GV_VALUE(lim->offset, -1000, 1000) ? GET_GVAR_PREC1(lim->offset, -1000, 1000, mixerCurrentFlightMode) : lim->offset)
218 #define LIMIT_MAX_RESX(lim) calc1000toRESX(LIMIT_MAX(lim))
219 #define LIMIT_MIN_RESX(lim) calc1000toRESX(LIMIT_MIN(lim))
220 #define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
221 #else
222 #define limit_min_max_t int8_t
223 #define LIMIT_EXT_PERCENT 125
224 #define LIMIT_EXT_MAX LIMIT_EXT_PERCENT
225 #define PPM_CENTER_MAX 125
226 #define LIMIT_MAX(lim) (lim->max+100)
227 #define LIMIT_MIN(lim) (lim->min-100)
228 #define LIMIT_OFS(lim) (lim->offset)
229 #define LIMIT_MAX_RESX(lim) calc100toRESX(LIMIT_MAX(lim))
230 #define LIMIT_MIN_RESX(lim) calc100toRESX(LIMIT_MIN(lim))
231 #define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
232 #endif
234 #define TRIM_OFF (1)
235 #define TRIM_ON (0)
236 #define TRIM_RUD (-1)
237 #define TRIM_ELE (-2)
238 #define TRIM_THR (-3)
239 #define TRIM_AIL (-4)
240 #if defined(PCBHORUS)
241 #define TRIM_T5 (-5)
242 #define TRIM_T6 (-6)
243 #define TRIM_LAST TRIM_T6
244 #else
245 #define TRIM_LAST TRIM_AIL
246 #endif
248 #define MLTPX_ADD 0
249 #define MLTPX_MUL 1
250 #define MLTPX_REP 2
252 #if defined(CPUARM)
253 #define GV1_SMALL 128
254 #define GV1_LARGE 1024
255 #define GV_RANGE_WEIGHT 500
256 #define GV_RANGE_OFFSET 500
257 #define DELAY_STEP 10
258 #define SLOW_STEP 10
259 #define DELAY_MAX (25*DELAY_STEP) /* 25 seconds */
260 #define SLOW_MAX (25*SLOW_STEP) /* 25 seconds */
262 #define MD_WEIGHT(md) (md->weight)
263 #define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight
264 #define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word
266 #define MD_OFFSET(md) (md->offset)
267 #define MD_OFFSET_TO_UNION(md, var) var.word = md->offset
268 #define MD_UNION_TO_OFFSET(var, md) md->offset = var.word
269 // #define MD_SETOFFSET(md, val) md->offset = val
271 #else
273 // highest bit used for small values in mix 128 --> 8 bit is enough
274 #define GV1_SMALL 128
275 // highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode)
276 #define GV1_LARGE 256
278 #define DELAY_STEP 2
279 #define SLOW_STEP 2
280 #define DELAY_MAX 15 /* 7.5 seconds */
281 #define SLOW_MAX 15 /* 7.5 seconds */
283 PACK(union u_gvarint_t {
284 struct {
285 int8_t lo;
286 uint8_t hi;
287 } bytes_t;
288 int16_t word;
290 u_gvarint_t(int8_t l, uint8_t h) {bytes_t.lo=l; bytes_t.hi=h?255:0;} // hi bit is negativ sign
292 private:
293 // prevent unwanted constructors, also saves program
294 u_gvarint_t() {}
295 u_gvarint_t(const u_gvarint_t&) {}
297 #define MD_WEIGHT(md) (u_gvarint_t(md->weight,md->weightMode).word)
299 #define MD_WEIGHT_TO_UNION(md, var) var.bytes_t.lo=md->weight; var.bytes_t.hi=md->weightMode?255:0
300 #define MD_UNION_TO_WEIGHT(var, md) md->weight=var.bytes_t.lo; if (var.word<0) md->weightMode=1; else md->weightMode=0
301 // #define MD_SETWEIGHT(md, val) md->weight=val; if (val<0) md->weightMode=1; else md->weightMode=0
303 #define MD_OFFSET(md) (u_gvarint_t(md->offset,md->offsetMode).word)
304 #define MD_OFFSET_TO_UNION(md, var) var.bytes_t.lo=md->offset; var.bytes_t.hi=md->offsetMode?255:0
305 #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 */
306 // #define MD_SETOFFSET(md, val) md->offset=val; if (val<0) md->offsetMode=1; else md->offsetMode=0
308 #endif
310 enum LogicalSwitchesFunctions {
311 LS_FUNC_NONE,
312 #if defined(CPUARM)
313 LS_FUNC_VEQUAL, // v==offset
314 #endif
315 LS_FUNC_VALMOSTEQUAL, // v~=offset
316 LS_FUNC_VPOS, // v>offset
317 LS_FUNC_VNEG, // v<offset
318 #if defined(CPUARM)
319 LS_FUNC_RANGE,
320 #endif
321 LS_FUNC_APOS, // |v|>offset
322 LS_FUNC_ANEG, // |v|<offset
323 LS_FUNC_AND,
324 LS_FUNC_OR,
325 LS_FUNC_XOR,
326 #if defined(CPUARM)
327 LS_FUNC_EDGE,
328 #endif
329 LS_FUNC_EQUAL,
330 LS_FUNC_GREATER,
331 LS_FUNC_LESS,
332 LS_FUNC_DIFFEGREATER,
333 LS_FUNC_ADIFFEGREATER,
334 LS_FUNC_TIMER,
335 LS_FUNC_STICKY,
336 LS_FUNC_COUNT,
337 LS_FUNC_MAX = LS_FUNC_COUNT-1
340 #if defined(CPUARM)
341 #define MAX_LS_DURATION 250 /*25s*/
342 #define MAX_LS_DELAY 250 /*25s*/
343 #define MAX_LS_ANDSW SWSRC_LAST
344 #else
345 #define MAX_LS_ANDSW 15
346 #endif
348 #if defined(CPUARM)
349 //#define TELEM_FLAG_TIMEOUT 0x01
350 #define TELEM_FLAG_LOG 0x02
351 //#define TELEM_FLAG_PERSISTENT 0x04
352 //#define TELEM_FLAG_SCALE 0x08
353 #define TELEM_FLAG_AUTO_OFFSET 0x10
354 #define TELEM_FLAG_FILTER 0x20
355 #define TELEM_FLAG_LOSS_ALARM 0x40
357 enum TelemetrySensorType
359 TELEM_TYPE_CUSTOM,
360 TELEM_TYPE_CALCULATED
363 enum TelemetrySensorFormula
365 TELEM_FORMULA_ADD,
366 TELEM_FORMULA_AVERAGE,
367 TELEM_FORMULA_MIN,
368 TELEM_FORMULA_MAX,
369 TELEM_FORMULA_MULTIPLY,
370 TELEM_FORMULA_TOTALIZE,
371 TELEM_FORMULA_CELL,
372 TELEM_FORMULA_CONSUMPTION,
373 TELEM_FORMULA_DIST,
374 TELEM_FORMULA_LAST = TELEM_FORMULA_DIST
376 #endif
378 enum VarioSource {
379 #if !defined(TELEMETRY_FRSKY_SPORT)
380 VARIO_SOURCE_ALTI,
381 VARIO_SOURCE_ALTI_PLUS,
382 #endif
383 VARIO_SOURCE_VSPEED,
384 VARIO_SOURCE_A1,
385 VARIO_SOURCE_A2,
386 #if defined(TELEMETRY_FRSKY_SPORT)
387 VARIO_SOURCE_DTE,
388 #endif
389 VARIO_SOURCE_COUNT,
390 VARIO_SOURCE_LAST = VARIO_SOURCE_COUNT-1
393 enum FrskyUsrProtocols {
394 USR_PROTO_NONE,
395 USR_PROTO_FRSKY,
396 USR_PROTO_WS_HOW_HIGH,
397 USR_PROTO_LAST = USR_PROTO_WS_HOW_HIGH,
400 enum FrskyCurrentSource {
401 FRSKY_CURRENT_SOURCE_NONE,
402 FRSKY_CURRENT_SOURCE_A1,
403 FRSKY_CURRENT_SOURCE_A2,
404 #if defined(CPUARM)
405 FRSKY_CURRENT_SOURCE_A3,
406 FRSKY_CURRENT_SOURCE_A4,
407 #endif
408 FRSKY_CURRENT_SOURCE_FAS,
409 FRSKY_CURRENT_SOURCE_LAST=FRSKY_CURRENT_SOURCE_FAS
412 enum FrskyVoltsSource {
413 FRSKY_VOLTS_SOURCE_A1,
414 FRSKY_VOLTS_SOURCE_A2,
415 #if defined(CPUARM)
416 FRSKY_VOLTS_SOURCE_A3,
417 FRSKY_VOLTS_SOURCE_A4,
418 #endif
419 FRSKY_VOLTS_SOURCE_FAS,
420 FRSKY_VOLTS_SOURCE_CELLS,
421 FRSKY_VOLTS_SOURCE_LAST=FRSKY_VOLTS_SOURCE_CELLS
426 enum SwashType {
427 SWASH_TYPE_NONE,
428 SWASH_TYPE_120,
429 SWASH_TYPE_120X,
430 SWASH_TYPE_140,
431 SWASH_TYPE_90,
432 SWASH_TYPE_MAX = SWASH_TYPE_90
435 #define TRIM_EXTENDED_MAX 500
436 #define TRIM_EXTENDED_MIN (-TRIM_EXTENDED_MAX)
437 #define TRIM_MAX 125
438 #define TRIM_MIN (-TRIM_MAX)
440 #define ROTARY_ENCODER_MAX 1024
442 #if defined(PCBSTD)
443 #define TRIMS_ARRAY_SIZE 5
444 #else
445 #define TRIMS_ARRAY_SIZE 8
446 #if defined(CPUARM)
447 #define TRIM_MODE_NONE 0x1F // 0b11111
448 #endif
449 #endif
451 #if defined(CPUARM)
452 #define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
453 #elif defined(CPUM2560)
454 #define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
455 #else
456 #define IS_MANUAL_RESET_TIMER(idx) 0
457 #endif
459 #if defined(CPUARM) && !defined(PCBSKY9X)
460 #define TIMER_COUNTDOWN_START(x) (g_model.timers[x].countdownStart > 0 ? 5 : 10 - g_model.timers[x].countdownStart * 10)
461 #else
462 #define TIMER_COUNTDOWN_START(x) 10
463 #endif
465 enum Protocols {
466 PROTO_PPM,
467 #if !defined(CPUARM)
468 PROTO_PPM16,
469 PROTO_PPMSIM,
470 #endif
471 #if defined(PXX) || defined(DSM2) || defined(IRPROTOS)
472 PROTO_PXX,
473 #endif
474 #if defined(DSM2) || defined(IRPROTOS)
475 PROTO_DSM2_LP45,
476 PROTO_DSM2_DSM2,
477 PROTO_DSM2_DSMX,
478 #endif
479 #if defined(CPUARM)
480 PROTO_CROSSFIRE,
481 #endif
482 #if defined(IRPROTOS)
483 // only used on AVR
484 // we will need 4 bits for proto :(
485 PROTO_SILV,
486 PROTO_TRAC09,
487 PROTO_PICZ,
488 PROTO_SWIFT,
489 #endif
490 #if defined(CPUARM)
491 PROTO_MULTIMODULE,
492 PROTO_SBUS,
493 #endif
494 PROTO_MAX,
495 PROTO_NONE
498 enum XJTRFProtocols {
499 RF_PROTO_OFF = -1,
500 RF_PROTO_X16,
501 RF_PROTO_D8,
502 RF_PROTO_LR12,
503 RF_PROTO_LAST = RF_PROTO_LR12
506 enum R9MSubTypes
508 MODULE_SUBTYPE_R9M_FCC,
509 MODULE_SUBTYPE_R9M_EU,
510 MODULE_SUBTYPE_R9M_EUPLUS,
511 MODULE_SUBTYPE_R9M_AUPLUS,
512 MODULE_SUBTYPE_R9M_LAST=MODULE_SUBTYPE_R9M_AUPLUS
515 enum MultiModuleRFProtocols {
516 MM_RF_PROTO_CUSTOM = -1,
517 MM_RF_PROTO_FIRST = MM_RF_PROTO_CUSTOM,
518 MM_RF_PROTO_FLYSKY=0,
519 MM_RF_PROTO_HUBSAN,
520 MM_RF_PROTO_FRSKY,
521 MM_RF_PROTO_HISKY,
522 MM_RF_PROTO_V2X2,
523 MM_RF_PROTO_DSM2,
524 MM_RF_PROTO_DEVO,
525 MM_RF_PROTO_YD717,
526 MM_RF_PROTO_KN,
527 MM_RF_PROTO_SYMAX,
528 MM_RF_PROTO_SLT,
529 MM_RF_PROTO_CX10,
530 MM_RF_PROTO_CG023,
531 MM_RF_PROTO_BAYANG,
532 MM_RF_PROTO_ESky,
533 MM_RF_PROTO_MT99XX,
534 MM_RF_PROTO_MJXQ,
535 MM_RF_PROTO_SHENQI,
536 MM_RF_PROTO_FY326,
537 MM_RF_PROTO_SFHSS,
538 MM_RF_PROTO_J6PRO,
539 MM_RF_PROTO_FQ777,
540 MM_RF_PROTO_ASSAN,
541 MM_RF_PROTO_HONTAI,
542 MM_RF_PROTO_OLRS,
543 MM_RF_PROTO_FS_AFHDS2A,
544 MM_RF_PROTO_Q2X2,
545 MM_RF_PROTO_WK_2X01,
546 MM_RF_PROTO_Q303,
547 MM_RF_PROTO_GW008,
548 MM_RF_PROTO_DM002,
549 MM_RF_PROTO_CABELL,
550 MM_RF_PROTO_ESKY150,
551 MM_RF_PROTO_H83D,
552 MM_RF_PROTO_CORONA,
553 MM_RF_PROTO_CFLIE,
554 MM_RF_PROTO_HITEC,
555 MM_RF_PROTO_WFLY,
556 MM_RF_PROTO_BUGS,
557 MM_RF_PROTO_BUGS_MINI,
558 MM_RF_PROTO_TRAXXAS,
559 MM_RF_PROTO_NCC1701,
560 MM_RF_PROTO_E01X,
561 MM_RF_PROTO_V911S,
562 MM_RF_PROTO_GD00X,
563 MM_RF_PROTO_V761,
564 MM_RF_PROTO_KF606,
565 MM_RF_PROTO_REDPINE,
566 MM_RF_PROTO_POTENSIC,
567 MM_RF_PROTO_LAST = MM_RF_PROTO_POTENSIC
570 enum MMDSM2Subtypes {
571 MM_RF_DSM2_SUBTYPE_DSM2_22,
572 MM_RF_DSM2_SUBTYPE_DSM2_11,
573 MM_RF_DSM2_SUBTYPE_DSMX_22,
574 MM_RF_DSM2_SUBTYPE_DSMX_11,
575 MM_RF_DSM2_SUBTYPE_AUTO
578 enum MMRFrskySubtypes {
579 MM_RF_FRSKY_SUBTYPE_D16,
580 MM_RF_FRSKY_SUBTYPE_D8,
581 MM_RF_FRSKY_SUBTYPE_D16_8CH,
582 MM_RF_FRSKY_SUBTYPE_V8,
583 MM_RF_FRSKY_SUBTYPE_D16_LBT,
584 MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH
587 #define HAS_RF_PROTOCOL_FAILSAFE(rf) ((rf) == RF_PROTO_X16)
588 #define HAS_RF_PROTOCOL_MODELINDEX(rf) (((rf) == RF_PROTO_X16) || ((rf) == RF_PROTO_LR12))
590 enum DSM2Protocols {
591 DSM2_PROTO_LP45,
592 DSM2_PROTO_DSM2,
593 DSM2_PROTO_DSMX,
596 enum ModuleTypes {
597 MODULE_TYPE_NONE = 0,
598 MODULE_TYPE_PPM,
599 MODULE_TYPE_XJT,
600 MODULE_TYPE_DSM2,
601 MODULE_TYPE_CROSSFIRE,
602 MODULE_TYPE_MULTIMODULE,
603 MODULE_TYPE_R9M,
604 MODULE_TYPE_SBUS,
605 MODULE_TYPE_COUNT
608 enum AntennaTypes {
609 XJT_INTERNAL_ANTENNA,
610 XJT_EXTERNAL_ANTENNA
613 enum FailsafeModes {
614 FAILSAFE_NOT_SET,
615 FAILSAFE_HOLD,
616 FAILSAFE_CUSTOM,
617 FAILSAFE_NOPULSES,
618 FAILSAFE_RECEIVER,
619 FAILSAFE_LAST = FAILSAFE_RECEIVER
622 enum ThrottleSources {
623 THROTTLE_SOURCE_THR,
624 THROTTLE_SOURCE_FIRST_POT,
625 #if defined(PCBX9E)
626 THROTTLE_SOURCE_F1 = THROTTLE_SOURCE_FIRST_POT,
627 THROTTLE_SOURCE_F2,
628 THROTTLE_SOURCE_F3,
629 THROTTLE_SOURCE_F4,
630 THROTTLE_SOURCE_S1,
631 THROTTLE_SOURCE_S2,
632 THROTTLE_SOURCE_LS,
633 THROTTLE_SOURCE_RS,
634 #elif defined(PCBTARANIS)
635 THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_FIRST_POT,
636 THROTTLE_SOURCE_S2,
637 THROTTLE_SOURCE_S3,
638 THROTTLE_SOURCE_LS,
639 THROTTLE_SOURCE_RS,
640 #else
641 THROTTLE_SOURCE_P1 = THROTTLE_SOURCE_FIRST_POT,
642 THROTTLE_SOURCE_P2,
643 THROTTLE_SOURCE_P3,
644 #endif
645 THROTTLE_SOURCE_CH1,
648 enum TelemetryType
650 PROTOCOL_TELEMETRY_FIRST,
651 PROTOCOL_FRSKY_SPORT = PROTOCOL_TELEMETRY_FIRST,
652 PROTOCOL_FRSKY_D,
653 PROTOCOL_FRSKY_D_SECONDARY,
654 PROTOCOL_PULSES_CROSSFIRE,
655 PROTOCOL_SPEKTRUM,
656 PROTOCOL_FLYSKY_IBUS,
657 PROTOCOL_MULTIMODULE,
658 PROTOCOL_TELEMETRY_LAST=PROTOCOL_MULTIMODULE
661 enum DisplayTrims
663 DISPLAY_TRIMS_NEVER,
664 DISPLAY_TRIMS_CHANGE,
665 DISPLAY_TRIMS_ALWAYS
668 #define TOTAL_EEPROM_USAGE (sizeof(ModelData)*MAX_MODELS + sizeof(RadioData))
670 extern RadioData g_eeGeneral;
671 extern ModelData g_model;
673 PACK(union u_int8int16_t {
674 struct {
675 int8_t lo;
676 uint8_t hi;
677 } bytes_t;
678 int16_t word;
681 #endif // _MYEEPROM_H_