Fix rx spi processing required (#13454)
[betaflight.git] / src / main / rx / rx_spi.h
blob5f1cd307d38b3b5fa2028e03501b39f7027afeda
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 "drivers/exti.h"
25 #include "pg/rx.h"
26 #include "pg/rx_spi.h"
28 #include "rx/rx.h"
30 // Used in MSP. Append at end.
31 typedef enum {
32 RX_SPI_NRF24_V202_250K = 0,
33 RX_SPI_NRF24_V202_1M,
34 RX_SPI_NRF24_SYMA_X,
35 RX_SPI_NRF24_SYMA_X5C,
36 RX_SPI_NRF24_CX10,
37 RX_SPI_NRF24_CX10A,
38 RX_SPI_NRF24_H8_3D,
39 RX_SPI_NRF24_INAV,
40 RX_SPI_FRSKY_D,
41 RX_SPI_FRSKY_X,
42 RX_SPI_A7105_FLYSKY,
43 RX_SPI_A7105_FLYSKY_2A,
44 RX_SPI_NRF24_KN,
45 RX_SPI_SFHSS,
46 RX_SPI_CYRF6936_DSM,
47 RX_SPI_FRSKY_X_LBT,
48 RX_SPI_REDPINE,
49 RX_SPI_FRSKY_X_V2,
50 RX_SPI_FRSKY_X_LBT_V2,
51 RX_SPI_EXPRESSLRS,
52 RX_SPI_PROTOCOL_COUNT
53 } rx_spi_protocol_e;
55 typedef enum {
56 RX_SPI_RECEIVED_NONE = 0,
57 RX_SPI_RECEIVED_BIND = (1 << 0),
58 RX_SPI_RECEIVED_DATA = (1 << 1),
59 RX_SPI_PROCESSING_REQUIRED = (1 << 2),
60 } rx_spi_received_e;
62 // RC channels in AETR order
63 typedef enum {
64 RC_SPI_ROLL = 0,
65 RC_SPI_PITCH,
66 RC_SPI_THROTTLE,
67 RC_SPI_YAW,
68 RC_SPI_AUX1,
69 RC_SPI_AUX2,
70 RC_SPI_AUX3,
71 RC_SPI_AUX4,
72 RC_SPI_AUX5,
73 RC_SPI_AUX6,
74 RC_SPI_AUX7,
75 RC_SPI_AUX8,
76 RC_SPI_AUX9,
77 RC_SPI_AUX10,
78 RC_SPI_AUX11,
79 RC_SPI_AUX12,
80 RC_SPI_AUX13,
81 RC_SPI_AUX14
82 } rc_spi_aetr_e;
84 typedef struct {
85 ioConfig_t ioConfig;
86 extiTrigger_t trigger;
87 } rxSpiExtiConfig_t;
89 // RC channels as used by deviation
90 #define RC_CHANNEL_RATE RC_SPI_AUX1
91 #define RC_CHANNEL_FLIP RC_SPI_AUX2
92 #define RC_CHANNEL_PICTURE RC_SPI_AUX3
93 #define RC_CHANNEL_VIDEO RC_SPI_AUX4
94 #define RC_CHANNEL_HEADLESS RC_SPI_AUX5
95 #define RC_CHANNEL_RTH RC_SPI_AUX6 // return to home
97 bool rxSpiInit(const rxSpiConfig_t *rxSpiConfig, rxRuntimeState_t *rxRuntimeState);
98 void rxSpiStop(void);