Create release.yml
[betaflight.git] / src / main / target / MATEKF411RX / target.h
blobc5caac22c943640bbfc22355f7166b850097f371
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 #if defined(CRAZYBEEF4FR)
24 #define TARGET_BOARD_IDENTIFIER "C4FR"
25 #define USBD_PRODUCT_STRING "CrazyBee F4 FR"
26 #elif defined(CRAZYBEEF4FS)
27 #define TARGET_BOARD_IDENTIFIER "C4FS"
28 #define USBD_PRODUCT_STRING "CrazyBee F4 FS"
29 #elif defined(CRAZYBEEF4DX)
30 #define TARGET_BOARD_IDENTIFIER "C4DX"
31 #define USBD_PRODUCT_STRING "CrazyBee F4 DX"
32 #else
33 #define TARGET_BOARD_IDENTIFIER "M41R"
34 #define USBD_PRODUCT_STRING "MATEKF411RX"
35 #endif
37 #define LED0_PIN PC13
39 #define USE_BEEPER
40 #define BEEPER_PIN PC15
41 #define BEEPER_INVERTED
43 #define USE_SPI
45 #define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
46 #define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_OFF
48 // *************** SPI1 Gyro & ACC **********************
49 #define USE_SPI_DEVICE_1
50 #define SPI1_SCK_PIN PA5
51 #define SPI1_MISO_PIN PA6
52 #define SPI1_MOSI_PIN PA7
54 #define GYRO_1_CS_PIN PA4
55 #define GYRO_1_SPI_INSTANCE SPI1
57 #define USE_EXTI
58 #define USE_GYRO_EXTI
59 #define GYRO_1_EXTI_PIN PA1
60 #define USE_MPU_DATA_READY_SIGNAL
62 #define USE_GYRO
63 #define USE_GYRO_SPI_MPU6000
64 #if defined(CRAZYBEEF4FS) || defined(CRAZYBEEF4FR) || defined(CRAZYBEEF4DX)
65 #define GYRO_1_ALIGN CW90_DEG
66 #else
67 #define GYRO_1_ALIGN CW180_DEG
68 #endif
69 #define USE_ACC
70 #define USE_ACC_SPI_MPU6000
71 // *************** SPI2 OSD *****************************
72 #define USE_SPI_DEVICE_2
73 #define SPI2_SCK_PIN PB13
74 #define SPI2_MISO_PIN PB14
75 #define SPI2_MOSI_PIN PB15
77 #define USE_MAX7456
78 #define MAX7456_SPI_INSTANCE SPI2
79 #define MAX7456_SPI_CS_PIN PB12
81 #if defined(CRAZYBEEF4DX)
82 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
83 #define SERIALRX_PROVIDER SERIALRX_SPEKTRUM2048
84 #define SERIALRX_UART SERIAL_PORT_USART2
85 #define RX_CHANNELS_TAER
87 #else
88 // *************** SPI3 CC2500 ***************************
89 #define USE_SPI_DEVICE_3
90 #define SPI3_SCK_PIN PB3
91 #define SPI3_MISO_PIN PB4
92 #define SPI3_MOSI_PIN PB5
93 #define RX_NSS_PIN PA15
95 #define USE_RX_SPI
96 #define RX_SPI_INSTANCE SPI3
98 #define RX_SPI_BIND_PIN PB2
100 #define DEFAULT_RX_FEATURE FEATURE_RX_SPI
102 #if defined(CRAZYBEEF4FS)
103 #define USE_RX_FLYSKY
104 #define RX_CHANNELS_AETR
105 #define RX_SPI_DEFAULT_PROTOCOL RX_SPI_A7105_FLYSKY_2A
106 #define FLYSKY_2A_CHANNEL_COUNT 14
107 #define RX_SPI_EXTI_PIN PA14
108 #define USE_RX_FLYSKY_SPI_LED
109 #define RX_SPI_LED_PIN PB9
111 #elif defined(CRAZYBEEF4FR)
112 #define RX_SPI_EXTI_PIN PC14
113 #define RX_SPI_LED_PIN PB9
114 #define USE_RX_FRSKY_SPI_D
115 #define USE_RX_FRSKY_SPI_X
116 #define USE_RX_SFHSS_SPI
117 #define USE_RX_REDPINE_SPI
118 #define RX_SPI_DEFAULT_PROTOCOL RX_SPI_FRSKY_X
119 #define USE_RX_FRSKY_SPI_TELEMETRY
121 #else // MATEKF411RX
122 #define RX_CC2500_SPI_DISABLE_CHIP_DETECTION
123 #define RX_SPI_EXTI_PIN PC14
124 #define RX_SPI_LED_PIN PB9
125 #define RX_SPI_LED_INVERTED
127 #define USE_RX_CC2500_SPI_PA_LNA
128 #define RX_CC2500_SPI_TX_EN_PIN PA8
129 #define RX_CC2500_SPI_LNA_EN_PIN PA13
131 #define USE_RX_CC2500_SPI_DIVERSITY
132 #define RX_CC2500_SPI_ANT_SEL_PIN PA14
134 #define USE_RX_FRSKY_SPI_D
135 #define USE_RX_FRSKY_SPI_X
136 #define USE_RX_SFHSS_SPI
137 #define USE_RX_REDPINE_SPI
138 #define RX_SPI_DEFAULT_PROTOCOL RX_SPI_FRSKY_X
139 #define USE_RX_FRSKY_SPI_TELEMETRY
140 #endif
141 #endif // CRAZYBEEF4DX
143 // *************** UART *****************************
144 #define USE_VCP
146 #define USE_UART1
147 #define UART1_TX_PIN PA9
148 #define UART1_RX_PIN PA10
150 #define USE_UART2
151 #define UART2_TX_PIN PA2
152 #define UART2_RX_PIN PA3
154 #define USE_SOFTSERIAL1
156 #define SERIAL_PORT_COUNT 4
158 // *************** ADC *****************************
159 #define USE_ADC
160 #define ADC_INSTANCE ADC1 // Default added
161 #define ADC1_DMA_OPT 0 // DMA 2 Stream 0 Channel 0
163 #define VBAT_ADC_PIN PB0
164 #define CURRENT_METER_ADC_PIN PB1
166 #define USE_ESCSERIAL
168 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY )
169 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
170 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
171 #define CURRENT_METER_SCALE_DEFAULT 179
173 #define TARGET_IO_PORTA 0xffff
174 #define TARGET_IO_PORTB 0xffff
175 #define TARGET_IO_PORTC 0xffff
176 #define TARGET_IO_PORTD (BIT(2))
178 #define USABLE_TIMER_CHANNEL_COUNT 9
179 #define USED_TIMERS ( TIM_N(1)|TIM_N(2)|TIM_N(4)|TIM_N(5)|TIM_N(9))