Implement reading firmware on Horus via USB (#5442)
[opentx.git] / radio / src / pulses / pulses.h
blob4399d816312572044ddeca4bbde792f0c0e19f4d
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 _PULSES_H_
22 #define _PULSES_H_
24 enum ModuleFlag
26 MODULE_NORMAL_MODE,
27 MODULE_RANGECHECK,
28 MODULE_BIND,
29 // MODULE_OFF, // will need an EEPROM conversion
32 #if defined(CPUARM) // (PXX) || defined(DSM2)
33 extern uint8_t moduleFlag[NUM_MODULES];
34 #endif
36 #if NUM_MODULES > 1
37 #define IS_RANGECHECK_ENABLE() (moduleFlag[0] == MODULE_RANGECHECK || moduleFlag[1] == MODULE_RANGECHECK)
38 #else
39 #define IS_RANGECHECK_ENABLE() (moduleFlag[0] == MODULE_RANGECHECK)
40 #endif
42 #if defined(DSM2) && !defined(PCBTARANIS)
43 #define DSM2_BIND_TIMEOUT 255 // 255*11ms
44 extern uint8_t dsm2BindTimer;
45 #endif
47 #if defined(CPUARM)
48 #define IS_PPM_PROTOCOL(protocol) (protocol==PROTO_PPM)
49 #else
50 #define IS_PPM_PROTOCOL(protocol) (protocol<=PROTO_PPMSIM)
51 #endif
53 #if defined(PXX)
54 #define IS_PXX_PROTOCOL(protocol) (protocol==PROTO_PXX)
55 #else
56 #define IS_PXX_PROTOCOL(protocol) (0)
57 #endif
59 #if defined(DSM2)
60 #define IS_DSM2_PROTOCOL(protocol) (protocol>=PROTO_DSM2_LP45 && protocol<=PROTO_DSM2_DSMX)
61 #else
62 #define IS_DSM2_PROTOCOL(protocol) (0)
63 #endif
65 #if defined(DSM2_SERIAL)
66 #define IS_DSM2_SERIAL_PROTOCOL(protocol) (IS_DSM2_PROTOCOL(protocol))
67 #else
68 #define IS_DSM2_SERIAL_PROTOCOL(protocol) (0)
69 #endif
71 #if defined(MULTIMODULE)
72 #define IS_MULTIMODULE_PROTOCOL(protocol) (protocol==PROTO_MULTIMODULE)
73 #if !defined(DSM2)
74 #error You need to enable DSM2 = PPM for MULTIMODULE support
75 #endif
76 #else
77 #define IS_MULTIMODULE_PROTOCOL(protocol) (0)
78 #endif
80 #if defined(CPUARM)
81 #define IS_SBUS_PROTOCOL(protocol) (protocol == PROTO_SBUS)
82 #else
83 #define IS_SBUS_PROTOCOL(protocol) (0)
84 #endif
87 #if defined(CPUARM)
88 #include "pulses_arm.h"
89 #else
90 #include "pulses_avr.h"
91 #endif
93 #endif // _PULSES_H_