[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / io / spektrum_vtx_control.h
blob039dad1326b4e12750722b5d6071ec70ec1a3e67
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 //VTX control frame bits and pieces
22 #define SPEKTRUM_VTX_CONTROL_FRAME_MASK 0xf000f000
23 #define SPEKTRUM_VTX_CONTROL_FRAME 0xe000e000
25 #define SPEKTRUM_VTX_CONTROL_1 (SPEK_FRAME_SIZE - 4)
26 #define SPEKTRUM_VTX_CONTROL_2 (SPEK_FRAME_SIZE - 3)
27 #define SPEKTRUM_VTX_CONTROL_3 (SPEK_FRAME_SIZE - 2)
28 #define SPEKTRUM_VTX_CONTROL_4 (SPEK_FRAME_SIZE - 1)
29 #define SPEKTRUM_VTX_CONTROL_SIZE 4
31 #define SPEKTRUM_VTX_BAND_MASK 0x00e00000
32 #define SPEKTRUM_VTX_CHANNEL_MASK 0x000f0000
33 #define SPEKTRUM_VTX_PIT_MODE_MASK 0x00000010
34 #define SPEKTRUM_VTX_REGION_MASK 0x00000008
35 #define SPEKTRUM_VTX_POWER_MASK 0x00000007
37 #define SPEKTRUM_VTX_BAND_SHIFT 21
38 #define SPEKTRUM_VTX_CHANNEL_SHIFT 16
39 #define SPEKTRUM_VTX_PIT_MODE_SHIFT 4
40 #define SPEKTRUM_VTX_REGION_SHIFT 3
41 #define SPEKTRUM_VTX_POWER_SHIFT 0
43 #define SPEKTRUM_VTX_BAND_COUNT 5
44 #define SPEKTRUM_VTX_CHAN_COUNT 8
47 Channels vs Band according to spektrum spec.
48 0 1 2 3 4 5 6 7
49 5740 5760 5780 5800 5820 5840 5860 5880 FatShark
50 5658 5695 5732 5769 5806 5843 5880 5917 Race
51 5705 5685 5665 5645 5885 5905 5925 5945 Band E
52 5733 5752 5771 5790 5809 5828 5847 5866 Band B
53 5865 5845 5825 5805 5785 5765 5745 5725 Band A
56 // Band translation to BF internal vtx_common needed
57 // Spektrum order, zero based.
58 #define SPEKTRUM_VTX_BAND_FS 0
59 #define SPEKTRUM_VTX_BAND_RACE 1
60 #define SPEKTRUM_VTX_BAND_E 2
61 #define SPEKTRUM_VTX_BAND_B 3
62 #define SPEKTRUM_VTX_BAND_A 4
63 #define SPEKTRUM_VTX_BAND_COUNT 5
65 // Spektrum Max power index
66 #define SPEKTRUM_VTX_POWER_OFF 0
67 #define SPEKTRUM_VTX_POWER_14 1
68 #define SPEKTRUM_VTX_POWER_25 2
69 #define SPEKTRUM_VTX_POWER_99 3
70 #define SPEKTRUM_VTX_POWER_299 4
71 #define SPEKTRUM_VTX_POWER_600 5
72 #define SPEKTRUM_VTX_POWER_MAXIT 6
73 #define SPEKTRUM_VTX_POWER_MAN 7
74 #define SPEKTRUM_VTX_POWER_COUNT 8
76 #define SPEKTRUM_VTX_REGION_USA 0
77 #define SPEKTRUM_VTX_REGION_EU 1
78 #define SPEKTRUM_VTX_REGION_NONE 0xff
80 #define SPEKTRUM_VTX_PITMODE_OFF 0 // Power on, race
81 #define SPEKTRUM_VTX_PITMODE_ON 1 // Power off, pit
83 typedef struct
85 uint8_t band;
86 uint8_t channel;
87 uint8_t power;
88 uint8_t region;
89 uint8_t pitMode;
90 uint16_t powerValue;
91 } spektrumVtx_t;
94 extern const uint16_t SpektrumVtxfrequencyTable[SPEKTRUM_VTX_BAND_COUNT][SPEKTRUM_VTX_CHAN_COUNT];
95 extern const uint8_t spek2commonBand[SPEKTRUM_VTX_BAND_COUNT];
96 extern const uint8_t vtxTrampPi[SPEKTRUM_VTX_POWER_COUNT];
97 extern const uint8_t vtxRTC6705Pi[SPEKTRUM_VTX_POWER_COUNT];
98 extern const uint8_t vtxSaPi[SPEKTRUM_VTX_POWER_COUNT];
99 extern uint8_t SpektrumRegion;
101 void spektrumHandleVtxControl(uint32_t vtxControl);
102 void spektrumVtxControl(void);