Added option to display RX SNR dB for CRSF instead of RSSI dBm.
[betaflight.git] / src / main / rx / crsf.h
blobfe8efed0777eeb0ff8fb8811dafc80ddcac7f084
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 #include "rx/crsf_protocol.h"
26 #define CRSF_PORT_OPTIONS (SERIAL_STOPBITS_1 | SERIAL_PARITY_NO)
27 #define CRSF_PORT_MODE MODE_RXTX
29 #define CRSF_MAX_CHANNEL 16
31 #define CRSF_RSSI_MIN (-130)
32 #define CRSF_RSSI_MAX 0
33 #define CRSF_SNR_MIN (-30)
34 #define CRSF_SNR_MAX 20
36 typedef struct crsfFrameDef_s {
37 uint8_t deviceAddress;
38 uint8_t frameLength;
39 uint8_t type;
40 uint8_t payload[CRSF_PAYLOAD_SIZE_MAX + 1]; // +1 for CRC at end of payload
41 } crsfFrameDef_t;
43 typedef union crsfFrame_u {
44 uint8_t bytes[CRSF_FRAME_SIZE_MAX];
45 crsfFrameDef_t frame;
46 } crsfFrame_t;
48 void crsfRxWriteTelemetryData(const void *data, int len);
49 void crsfRxSendTelemetryData(void);
51 struct rxConfig_s;
52 struct rxRuntimeState_s;
53 bool crsfRxInit(const struct rxConfig_s *initialRxConfig, struct rxRuntimeState_s *rxRuntimeState);
54 bool crsfRxIsActive(void);