If RSSI Channel is set to Disabled when using S.Bus then generate RSS… (#5090)
[betaflight.git] / src / main / rx / spektrum.h
blobe2e6e5ec84628ad338fcad8edc68269c85cfe8d8
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #define SPEKTRUM_MAX_SUPPORTED_CHANNEL_COUNT 12
21 #define SPEKTRUM_2048_CHANNEL_COUNT 12
22 #define SPEKTRUM_1024_CHANNEL_COUNT 7
24 #define SPEKTRUM_SAT_BIND_DISABLED 0
25 #define SPEKTRUM_SAT_BIND_MAX 10
27 #define SPEK_FRAME_SIZE 16
28 #define SRXL_FRAME_OVERHEAD 5
29 #define SRXL_FRAME_SIZE_MAX (SPEK_FRAME_SIZE + SRXL_FRAME_OVERHEAD)
31 #define SPEKTRUM_NEEDED_FRAME_INTERVAL 5000
32 #define SPEKTRUM_TELEMETRY_FRAME_DELAY 1000 // Gap between received Rc frame and transmited TM frame, uS
34 #define SPEKTRUM_BAUDRATE 115200
37 // Spektrum system type values
38 #define SPEKTRUM_DSM2_22 0x01
39 #define SPEKTRUM_DSM2_11 0x12
40 #define SPEKTRUM_DSMX_22 0xa2
41 #define SPEKTRUM_DSMX_11 0xb2
43 extern uint32_t spekChannelData[SPEKTRUM_MAX_SUPPORTED_CHANNEL_COUNT];
45 extern bool srxlEnabled;
46 extern int32_t resolution;
47 extern uint8_t rssi_channel; // Stores the RX RSSI channel.
49 void spektrumBind(rxConfig_t *rxConfig);
50 bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig);
52 void srxlRxWriteTelemetryData(const void *data, int len);
53 bool srxlRxIsActive(void);