If RSSI Channel is set to Disabled when using S.Bus then generate RSS… (#5090)
[betaflight.git] / src / main / rx / flysky_defs.h
blob256e20f527ad4c7d2265641a128a0ddfe80a31b5
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 #include <stdbool.h>
21 #include <stdint.h>
23 #define MAX_FLYSKY_CHANNEL_COUNT 8
24 #define MAX_FLYSKY_2A_CHANNEL_COUNT 14
26 #define FLYSKY_PAYLOAD_SIZE 21
27 #define FLYSKY_2A_PAYLOAD_SIZE 37
29 #define FLYSKY_FREQUENCY_COUNT 16
30 #define FLYSKY_RSSI_SAMPLE_COUNT 16
32 #ifndef FLYSKY_CHANNEL_COUNT
33 #define FLYSKY_CHANNEL_COUNT MAX_FLYSKY_CHANNEL_COUNT
34 #endif
36 #ifndef FLYSKY_2A_CHANNEL_COUNT
37 #define FLYSKY_2A_CHANNEL_COUNT MAX_FLYSKY_2A_CHANNEL_COUNT
38 #endif
40 #define TX_DELAY 500
41 #define BIND_TIMEOUT 200000
43 typedef struct __attribute__((packed)) {
44 uint8_t type;
45 uint8_t number;
46 uint8_t valueL;
47 uint8_t valueH;
48 } flySky2ASens_t;
50 typedef struct __attribute__((packed)) {
51 uint8_t type;
52 uint32_t txId;
53 uint32_t rxId;
54 flySky2ASens_t sens[7];
55 } flySky2ATelemetryPkt_t;
57 typedef struct __attribute__((packed)) {
58 uint8_t type;
59 uint32_t txId;
60 uint32_t rxId;
61 uint8_t state;
62 uint8_t reserved1;
63 uint8_t rfChannelMap[16];
64 uint8_t reserved2[10];
65 } flySky2ABindPkt_t;
67 typedef struct __attribute__((packed)) {
68 uint8_t type;
69 uint32_t txId;
70 uint32_t rxId;
71 uint8_t data[28];
72 } flySky2ARcDataPkt_t;
74 typedef struct __attribute__((packed)) {
75 uint8_t type;
76 uint32_t txId;
77 uint8_t data[16];
78 } flySkyRcDataPkt_t;
80 typedef struct {
81 uint32_t packet;
82 uint32_t firstPacket;
83 uint32_t syncPacket;
84 uint32_t telemetry;
85 } timings_t;
87 enum {
88 SENSOR_INT_V = 0x00,
89 SENSOR_TEMP = 0x01,
90 SENSOR_MOT_RPM = 0x02,
91 SENSOR_EXT_V = 0x03,
92 SENSOR_RSSI = 0xFC,
93 SENSOR_ERR_RATE = 0xFE
96 enum {
97 FLYSKY_2A_PACKET_RC_DATA = 0x58,
98 FLYSKY_2A_PACKET_BIND1 = 0xBB,
99 FLYSKY_2A_PACKET_BIND2 = 0xBC,
100 FLYSKY_2A_PACKET_FS_SETTINGS = 0x56,
101 FLYSKY_2A_PACKET_SETTINGS = 0xAA,
102 FLYSKY_2A_PACKET_TELEMETRY = 0xAA,
103 FLYSKY_PACKET_RC_DATA = 0x55,
104 FLYSKY_PACKET_BIND = 0xAA