Create release.yml
[betaflight.git] / src / main / rx / a7105_flysky_defs.h
blob1387618e516bc9ebf8f28802dccc4adda21abf09
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 <stdbool.h>
24 #include <stdint.h>
26 #define MAX_FLYSKY_CHANNEL_COUNT 8
27 #define MAX_FLYSKY_2A_CHANNEL_COUNT 14
29 #define FLYSKY_PAYLOAD_SIZE 21
30 #define FLYSKY_2A_PAYLOAD_SIZE 37
32 #define FLYSKY_FREQUENCY_COUNT 16
33 #define FLYSKY_RSSI_SAMPLE_COUNT 16
35 #ifndef FLYSKY_CHANNEL_COUNT
36 #define FLYSKY_CHANNEL_COUNT MAX_FLYSKY_CHANNEL_COUNT
37 #endif
39 #ifndef FLYSKY_2A_CHANNEL_COUNT
40 #define FLYSKY_2A_CHANNEL_COUNT MAX_FLYSKY_2A_CHANNEL_COUNT
41 #endif
43 #define TX_DELAY 500
44 #define BIND_TIMEOUT 200000
46 typedef struct __attribute__((packed)) {
47 uint8_t type;
48 uint8_t number;
49 uint8_t valueL;
50 uint8_t valueH;
51 } flySky2ASens_t;
53 typedef struct __attribute__((packed)) {
54 uint8_t type;
55 uint32_t txId;
56 uint32_t rxId;
57 flySky2ASens_t sens[7];
58 } flySky2ATelemetryPkt_t;
60 typedef struct __attribute__((packed)) {
61 uint8_t type;
62 uint32_t txId;
63 uint32_t rxId;
64 uint8_t state;
65 uint8_t reserved1;
66 uint8_t rfChannelMap[16];
67 uint8_t reserved2[10];
68 } flySky2ABindPkt_t;
70 typedef struct __attribute__((packed)) {
71 uint8_t type;
72 uint32_t txId;
73 uint32_t rxId;
74 uint8_t data[28];
75 } flySky2ARcDataPkt_t;
77 typedef struct __attribute__((packed)) {
78 uint8_t type;
79 uint32_t txId;
80 uint8_t data[16];
81 } flySkyRcDataPkt_t;
83 typedef struct {
84 uint32_t packet;
85 uint32_t firstPacket;
86 uint32_t syncPacket;
87 uint32_t telemetry;
88 } timings_t;
90 enum {
91 SENSOR_INT_V = 0x00,
92 SENSOR_TEMP = 0x01,
93 SENSOR_MOT_RPM = 0x02,
94 SENSOR_EXT_V = 0x03,
95 SENSOR_RSSI = 0xFC,
96 SENSOR_ERR_RATE = 0xFE
99 enum {
100 FLYSKY_2A_PACKET_RC_DATA = 0x58,
101 FLYSKY_2A_PACKET_BIND1 = 0xBB,
102 FLYSKY_2A_PACKET_BIND2 = 0xBC,
103 FLYSKY_2A_PACKET_FS_SETTINGS = 0x56,
104 FLYSKY_2A_PACKET_SETTINGS = 0xAA,
105 FLYSKY_2A_PACKET_TELEMETRY = 0xAA,
106 FLYSKY_PACKET_RC_DATA = 0x55,
107 FLYSKY_PACKET_BIND = 0xAA