Add OSD_STATE_GROUP_ELEMENTS state to osdUpdate() and optimise DMA vs polled MAX7456...
[betaflight.git] / src / main / rx / spektrum.h
blobc7c7defbcc546b5581e41c6106c37dd33694988c
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 #pragma once
23 #define SPEKTRUM_MAX_SUPPORTED_CHANNEL_COUNT 12
24 #define SPEKTRUM_2048_CHANNEL_COUNT 12
25 #define SPEKTRUM_1024_CHANNEL_COUNT 7
27 #define SPEKTRUM_SAT_BIND_DISABLED 0
28 #define SPEKTRUM_SAT_BIND_MAX 10
30 #define SPEK_FRAME_SIZE 16
31 #define SRXL_FRAME_OVERHEAD 5
32 #define SRXL_FRAME_SIZE_MAX (SPEK_FRAME_SIZE + SRXL_FRAME_OVERHEAD)
34 #define SPEKTRUM_NEEDED_FRAME_INTERVAL 5000
36 #define SPEKTRUM_BAUDRATE 115200
39 // Spektrum system type values
40 #define SPEKTRUM_DSM2_22 0x01
41 #define SPEKTRUM_DSM2_11 0x12
42 #define SPEKTRUM_DSMX_22 0xa2
43 #define SPEKTRUM_DSMX_11 0xb2
45 extern uint32_t spekChannelData[SPEKTRUM_MAX_SUPPORTED_CHANNEL_COUNT];
47 extern bool srxlEnabled;
48 extern int32_t resolution;
49 extern uint8_t rssi_channel; // Stores the RX RSSI channel.
51 void spektrumBind(rxConfig_t *rxConfig);
52 bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeState_t *rxRuntimeState);
54 bool srxlTelemetryBufferEmpty();
55 void srxlRxWriteTelemetryData(const void *data, int len);
56 bool srxlRxIsActive(void);