Merge pull request #11714 from VitroidFPV/my-new-code
[betaflight.git] / src / main / target / REVO / target.h
blobb6b613f57efb93fd33553d2f88cc1544db48d5e6
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 #define USE_LATE_TASK_STATISTICS
25 #if defined(AIRBOTF4)
26 #define TARGET_BOARD_IDENTIFIER "AIR4"
27 #define USBD_PRODUCT_STRING "AirbotF4"
29 #elif defined(AIRBOTF4SD)
30 #define TARGET_BOARD_IDENTIFIER "A4SD"
31 #define USBD_PRODUCT_STRING "AirbotF4SD"
33 #elif defined(SOULF4)
34 #define TARGET_BOARD_IDENTIFIER "SOUL"
35 #define USBD_PRODUCT_STRING "DemonSoulF4"
37 #elif defined(PODIUMF4)
38 #define TARGET_BOARD_IDENTIFIER "PODI"
39 #define USBD_PRODUCT_STRING "PodiumF4"
41 #elif defined(ELINF405)
42 #define TARGET_BOARD_IDENTIFIER "ELIN"
43 #define USBD_PRODUCT_STRING "ElinF405"
45 #else
46 #define TARGET_BOARD_IDENTIFIER "REVO"
47 #define USBD_PRODUCT_STRING "Revolution"
49 #endif
51 #define LED0_PIN PB5
52 #if defined(PODIUMF4)
53 #define LED1_PIN PB4
54 #define LED2_PIN PB6
55 #endif
57 // Disable LED1, conflicts with AirbotF4/Flip32F4 beeper
58 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
59 #define USE_BEEPER
60 #define BEEPER_PIN PB4
61 #define BEEPER_INVERTED
62 #elif defined(SOULF4)
63 #define USE_BEEPER
64 #define BEEPER_PIN PB6
65 #define BEEPER_INVERTED
66 #elif defined(ELINF405)
67 #define USE_BEEPER
68 #define BEEPER_PIN PB4
69 #else
70 #define LED1_PIN PB4
71 // Leave beeper here but with none as io - so disabled unless mapped.
72 #define USE_BEEPER
73 #define BEEPER_PIN NONE
74 #endif
77 // PC0 used as inverter select GPIO
78 #ifdef AIRBOTF4SD
79 #define INVERTER_PIN_UART6 PD2
80 #else
81 #define INVERTER_PIN_UART1 PC0
82 #endif
84 #define USE_GYRO
85 #define USE_ACC
87 #ifdef AIRBOTF4SD
88 #define USE_GYRO_SPI_MPU6000
89 #define USE_ACC_SPI_MPU6000
90 #define USE_GYRO_SPI_MPU6500
91 #define USE_ACC_SPI_MPU6500
93 #define GYRO_1_CS_PIN PB13
94 #define GYRO_2_CS_PIN PA4
95 #define GYRO_1_SPI_INSTANCE SPI1
96 #define GYRO_2_SPI_INSTANCE SPI1
98 #define GYRO_1_ALIGN CW270_DEG
99 #define GYRO_2_ALIGN CW270_DEG
101 #elif defined(SOULF4)
103 #define USE_GYRO_SPI_MPU6000
104 #define GYRO_1_ALIGN CW180_DEG
106 #define USE_ACC_SPI_MPU6000
108 #define GYRO_1_CS_PIN PA4
109 #define GYRO_1_SPI_INSTANCE SPI1
111 #elif defined(PODIUMF4)
113 #define USE_GYRO_SPI_MPU6500
114 #define GYRO_1_ALIGN CW0_DEG
116 #define USE_ACC_SPI_MPU6500
118 #define GYRO_1_CS_PIN PA4
119 #define GYRO_1_SPI_INSTANCE SPI1
121 #elif defined(ELINF405)
123 #define USE_GYRO_SPI_MPU6500
124 #define GYRO_1_ALIGN CW0_DEG
125 #define GYRO_1_CS_PIN PA4
126 #define GYRO_1_SPI_INSTANCE SPI1
128 #define USE_ACC_SPI_MPU6500
131 #else
133 #define USE_GYRO_SPI_MPU6000
134 #define USE_GYRO_SPI_MPU6500
135 #define USE_ACC_SPI_MPU6000
136 #define USE_ACC_SPI_MPU6500
137 #define GYRO_1_CS_PIN PA4
138 #define GYRO_1_SPI_INSTANCE SPI1
139 #define GYRO_1_ALIGN CW270_DEG
141 #endif
143 // MPU6000 interrupts
144 #define GYRO_1_EXTI_PIN PC4
146 #if defined(ELINF405)
148 #define USE_OSD
149 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_SOFTSERIAL)
150 #define USE_MAX7456
151 #define MAX7456_SPI_INSTANCE SPI2
152 #define MAX7456_SPI_CS_PIN PC8
154 #define USE_BARO
155 #define USE_BARO_MS5611
156 #define USE_BARO_BMP085
157 #define USE_BARO_BMP280
159 #define USE_MAG
160 #define USE_MAG_HMC5883
161 #define USE_MAG_QMC5883
162 #define USE_MAG_AK8963
163 #define USE_MAG_AK8975
165 #else
167 #define GYRO_2_EXTI_PIN NONE
169 // Configure MAG and BARO unconditionally.
170 #define USE_MAG
171 #define USE_MAG_HMC5883
172 #define USE_MAG_QMC5883
173 #define MAG_HMC5883_ALIGN CW90_DEG
175 #define USE_BARO
176 #define USE_BARO_MS5611
177 #define USE_BARO_BMP085
178 #define USE_BARO_BMP280
180 #endif
182 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
183 #define USE_BARO_SPI_BMP280
184 #define BARO_SPI_INSTANCE SPI1
185 #define BARO_CS_PIN PC13
186 #endif
188 #if defined(AIRBOTF4SD)
189 // SDCARD support for AIRBOTF4SD
190 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
191 #define USE_SDCARD
192 #define USE_SDCARD_SPI
193 #define SDCARD_DETECT_INVERTED
194 #define SDCARD_DETECT_PIN PC0
195 #define SDCARD_SPI_INSTANCE SPI3
196 #define SDCARD_SPI_CS_PIN SPI3_NSS_PIN
197 #define SPI3_TX_DMA_OPT 0 // DMA 1 Stream 5 Channel 0
199 #else
201 #define FLASH_CS_PIN PB3
202 #define FLASH_SPI_INSTANCE SPI3
203 #define USE_FLASHFS
204 #define USE_FLASH_M25P16
206 #endif // AIRBOTF4SD
209 #define USE_VCP
210 #if defined(PODIUMF4)
211 #define USE_USB_DETECT
212 #define USB_DETECT_PIN PA8
213 #else
214 #define USE_USB_DETECT
215 #define USB_DETECT_PIN PC5
216 #endif
218 #define USE_UART1
219 #define UART1_RX_PIN PA10
220 #define UART1_TX_PIN PA9
222 #define USE_UART3
223 #define UART3_RX_PIN PB11
224 #define UART3_TX_PIN PB10
226 #if defined(REVO) || defined(ELINF405)
227 #define USE_UART4
228 #define UART4_RX_PIN PA1
229 #define UART4_TX_PIN PA0
230 #endif // REVO
232 #define USE_UART6
233 #define UART6_RX_PIN PC7
234 #define UART6_TX_PIN PC6
236 #if defined(ELINF405)
237 #define PINIO1_PIN PC13
238 #define PINIO2_PIN PC14
240 #define DEFAULT_MIXER MIXER_QUADX
241 #define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
242 #define USE_TARGET_CONFIG
243 #define SOFTSERIAL1_TX_PIN PC9
244 #define SOFTSERIAL2_RX_PIN PA8
246 #else
248 #define PINIO1_PIN PC8 // DTR pin
250 #endif
252 #define USE_SOFTSERIAL1
253 #define USE_SOFTSERIAL2
255 #if defined(REVO) || defined(ELINF405)
256 #define SERIAL_PORT_COUNT 7 //VCP, USART1, USART3, UART4, USART6, SOFTSERIAL x 2
257 #else
258 #define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIAL x 2
259 #endif
261 #define USE_ESCSERIAL
262 #if defined(ELINF405)
263 #define ESCSERIAL_TIMER_TX_PIN PB6
264 #else
265 #define ESCSERIAL_TIMER_TX_PIN PB14 // (HARDARE=0,PPM)
266 #endif
268 #define USE_SPI
270 #if defined(ELINF405)
271 #define USE_SPI_DEVICE_1
272 #define SPI1_NSS_PIN PA4
273 #define SPI1_SCK_PIN PA5
274 #define SPI1_MISO_PIN PA6
275 #define SPI1_MOSI_PIN PA7
277 #define USE_SPI_DEVICE_2
278 #define SPI2_NSS_PIN PB12
279 #define SPI2_SCK_PIN PB13
280 #define SPI2_MISO_PIN PB14
281 #define SPI2_MOSI_PIN PB15
282 #else
284 #define USE_SPI_DEVICE_1
286 #endif
288 #define USE_SPI_DEVICE_3
289 #define SPI3_NSS_PIN PB3
290 #define SPI3_SCK_PIN PC10
291 #define SPI3_MISO_PIN PC11
292 #define SPI3_MOSI_PIN PC12
294 #define USE_I2C
295 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
296 // On AIRBOTF4 and AIRBOTF4SD, I2C2 and I2C3 are configurable
297 #define USE_I2C_DEVICE_2
298 #define I2C2_SCL NONE // PB10, shared with UART3TX
299 #define I2C2_SDA NONE // PB11, shared with UART3RX
300 #define USE_I2C_DEVICE_3
301 #define I2C3_SCL NONE // PA8, PWM6
302 #define I2C3_SDA NONE // PC9, CH6
303 #define I2C_DEVICE (I2CDEV_2)
304 #else
305 #define USE_I2C_DEVICE_1
306 #define I2C_DEVICE (I2CDEV_1)
307 #define I2C1_SCL PB8
308 #define I2C1_SDA PB9
309 #endif
311 #define USE_ADC
312 #if !defined(PODIUMF4)
313 #define CURRENT_METER_ADC_PIN PC1
314 #define VBAT_ADC_PIN PC2
315 #else
316 #define VBAT_ADC_PIN PC3
317 #endif
319 #if defined(ELINF405)
320 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
321 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
322 #endif
324 #if defined(AIRBOTF4SD)
325 #define RSSI_ADC_PIN PA0
326 #endif
328 #define USE_TRANSPONDER
330 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
331 #if defined(PODIUMF4)
332 #define SERIALRX_PROVIDER SERIALRX_SBUS
333 #define SERIALRX_UART SERIAL_PORT_USART6
334 #define DEFAULT_FEATURES FEATURE_TELEMETRY
335 #elif defined(ELINF405)
336 #define SERIALRX_PROVIDER SERIALRX_SBUS
337 #define SERIALRX_UART SERIAL_PORT_USART1
338 #endif
340 #define TARGET_IO_PORTA 0xffff
341 #define TARGET_IO_PORTB 0xffff
342 #define TARGET_IO_PORTC 0xffff
343 #define TARGET_IO_PORTD (BIT(2))
345 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
346 #define USABLE_TIMER_CHANNEL_COUNT 13
347 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) )
348 #elif defined(ELINF405)
349 #define USABLE_TIMER_CHANNEL_COUNT 9
350 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(11) )
351 #else
352 #define USABLE_TIMER_CHANNEL_COUNT 12
353 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) )
354 #endif