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)
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 // Touch up configuration
25 #include "build/version.h"
29 BEGIN HARDWARE INCLUSIONS
31 Simplified options for the moment, i.e. adding USE_MAG or USE_BARO and the entire driver suite is added.
32 In the future we can move to specific drivers being added only - to save flash space.
35 #if defined(USE_MAG) && !defined(USE_FAKE_MAG)
36 #define USE_MAG_DATA_READY_SIGNAL
37 #define USE_MAG_HMC5883
38 #define USE_MAG_SPI_HMC5883
39 #define USE_MAG_QMC5883
40 #define USE_MAG_LIS3MDL
41 #define USE_MAG_AK8963
42 #define USE_MAG_MPU925X_AK8963
43 #define USE_MAG_SPI_AK8963
44 #define USE_MAG_AK8975
47 #if defined(USE_BARO) && !defined(USE_FAKE_BARO)
48 #define USE_BARO_MS5611
49 #define USE_BARO_SPI_MS5611
50 #define USE_BARO_BMP280
51 #define USE_BARO_SPI_BMP280
52 #define USE_BARO_BMP388
53 #define USE_BARO_SPI_BMP388
55 #define USE_BARO_SPI_LPS
56 #define USE_BARO_QMP6988
57 #define USE_BARO_SPI_QMP6988
58 #define USE_BARO_DPS310
59 #define USE_BARO_SPI_DPS310
60 #define USE_BARO_BMP085
63 #if defined(USE_RX_SPI)
65 #define USE_RX_FRSKY_SPI_D
66 #define USE_RX_FRSKY_SPI_X
67 #define USE_RX_SFHSS_SPI
68 #define USE_RX_REDPINE_SPI
69 #define USE_RX_FRSKY_SPI_TELEMETRY
70 #define USE_RX_CC2500_SPI_PA_LNA
71 #define USE_RX_CC2500_SPI_DIVERSITY
74 #define USE_RX_FLYSKY_SPI_LED
76 #define USE_RX_SPEKTRUM
77 #define USE_RX_SPEKTRUM_TELEMETRY
79 #endif // defined(USE_RX_SPI)
82 /* END HARDWARE INCLUSIONS */
84 #if defined(USE_VTX_RTC6705_SOFTSPI)
85 #define USE_VTX_RTC6705
92 #ifndef USE_ESC_SENSOR
93 #undef USE_ESC_SENSOR_TELEMETRY
96 // XXX Followup implicit dependencies among DASHBOARD, display_xxx and USE_I2C.
97 // XXX This should eventually be cleaned up.
99 #undef USE_I2C_OLED_DISPLAY
103 #define USE_I2C_OLED_DISPLAY
107 // Remove USE_BARO_BMP280 and USE_BARO_MS5611 if USE_I2C is not defined.
108 #if !defined(USE_I2C)
109 #if defined(USE_BARO_BMP280)
110 #undef USE_BARO_BMP280
112 #if defined(USE_BARO_MS5611)
113 #undef USE_BARO_MS5611
117 #if !defined(USE_BARO) && !defined(USE_GPS)
121 #if defined(USE_BARO) && !defined(BARO_EOC_PIN)
122 #define BARO_EOC_PIN NONE
125 #if !defined(USE_SERIALRX)
126 #undef USE_SERIALRX_CRSF
127 #undef USE_SERIALRX_IBUS
128 #undef USE_SERIALRX_JETIEXBUS
129 #undef USE_SERIALRX_SBUS
130 #undef USE_SERIALRX_SPEKTRUM
131 #undef USE_SERIALRX_SUMD
132 #undef USE_SERIALRX_SUMH
133 #undef USE_SERIALRX_XBUS
134 #undef USE_SERIALRX_FPORT
137 #if !defined(USE_TELEMETRY)
138 #undef USE_TELEMETRY_CRSF
139 #undef USE_TELEMETRY_GHST
140 #undef USE_TELEMETRY_FRSKY_HUB
141 #undef USE_TELEMETRY_HOTT
142 #undef USE_TELEMETRY_IBUS
143 #undef USE_TELEMETRY_IBUS_EXTENDED
144 #undef USE_TELEMETRY_JETIEXBUS
145 #undef USE_TELEMETRY_LTM
146 #undef USE_TELEMETRY_MAVLINK
147 #undef USE_TELEMETRY_SMARTPORT
148 #undef USE_TELEMETRY_SRXL
149 #undef USE_SERIALRX_FPORT
152 #if !defined(USE_SERIALRX_CRSF)
153 #undef USE_TELEMETRY_CRSF
154 #undef USE_CRSF_LINK_STATISTICS
158 #if !defined(USE_RX_EXPRESSLRS) && !defined(USE_SERIALRX_CRSF)
159 #undef USE_RX_RSSI_DBM
162 #if !defined(USE_SERIALRX_GHST)
163 #undef USE_TELEMETRY_GHST
166 #if !defined(USE_TELEMETRY_CRSF) || !defined(USE_CMS)
167 #undef USE_CRSF_CMS_TELEMETRY
170 #if !defined(USE_SERIALRX_JETIEXBUS)
171 #undef USE_TELEMETRY_JETIEXBUS
174 #if !defined(USE_TELEMETRY_IBUS)
175 #undef USE_TELEMETRY_IBUS_EXTENDED
178 // If USE_SERIALRX_SPEKTRUM was dropped by a target, drop all related options
179 #ifndef USE_SERIALRX_SPEKTRUM
180 #undef USE_SPEKTRUM_BIND
181 #undef USE_SPEKTRUM_BIND_PLUG
182 #undef USE_SPEKTRUM_REAL_RSSI
183 #undef USE_SPEKTRUM_FAKE_RSSI
184 #undef USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
185 #undef USE_SPEKTRUM_VTX_CONTROL
186 #undef USE_SPEKTRUM_VTX_TELEMETRY
187 #undef USE_TELEMETRY_SRXL
190 #if !defined(USE_CMS) || !defined(USE_TELEMETRY_SRXL)
191 #undef USE_SPEKTRUM_CMS_TELEMETRY
194 #if defined(USE_SERIALRX_SBUS) || defined(USE_SERIALRX_FPORT)
195 #define USE_SBUS_CHANNELS
198 #if !defined(USE_TELEMETRY_SMARTPORT) && !defined(USE_TELEMETRY_CRSF)
199 #undef USE_MSP_OVER_TELEMETRY
202 #if !defined(USE_RX_MSP) && defined(USE_RX_MSP_OVERRIDE)
203 #undef USE_RX_MSP_OVERRIDE
206 /* If either VTX_CONTROL or VTX_COMMON is undefined then remove common code and device drivers */
207 #if !defined(USE_VTX_COMMON) || !defined(USE_VTX_CONTROL)
208 #undef USE_VTX_COMMON
209 #undef USE_VTX_CONTROL
211 #undef USE_VTX_SMARTAUDIO
216 #if defined(USE_RX_FRSKY_SPI_D) || defined(USE_RX_FRSKY_SPI_X) || defined(USE_RX_REDPINE_SPI)
217 #define USE_RX_CC2500
218 #define USE_RX_FRSKY_SPI
221 #if defined(USE_RX_SFHSS_SPI)
222 #define USE_RX_CC2500
225 #if !defined(USE_RX_CC2500)
226 #undef USE_RX_CC2500_SPI_PA_LNA
229 #if !defined(USE_RX_CC2500_SPI_PA_LNA)
230 #undef USE_RX_CC2500_SPI_DIVERSITY
233 // Burst dshot to default off if not configured explicitly by target
234 #ifndef ENABLE_DSHOT_DMAR
235 #define ENABLE_DSHOT_DMAR DSHOT_DMAR_OFF
238 // Some target doesn't define USE_ADC which USE_ADC_INTERNAL depends on
240 #undef USE_ADC_INTERNAL
245 #define USE_FLASH_TOOLS
248 #if defined(USE_FLASH_W25M512) || defined(USE_FLASH_W25Q128FV)
249 #define USE_FLASH_M25P16
252 #if defined(USE_FLASH_W25M02G)
253 #define USE_FLASH_W25N01G
256 #if defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25N01G)
257 #define USE_FLASH_W25M
258 #define USE_FLASH_CHIP
261 #ifndef USE_FLASH_CHIP
265 #if (!defined(USE_SDCARD) && !defined(USE_FLASHFS)) || !defined(USE_BLACKBOX)
269 #if !defined(USE_SDCARD)
270 #undef USE_SDCARD_SDIO
271 #undef USE_SDCARD_SPI
274 #if !defined(USE_VCP)
275 #undef USE_USB_CDC_HID
279 #if defined(USE_USB_CDC_HID) || defined(USE_USB_MSC)
280 #define USE_USB_ADVANCED_PROFILES
283 #if !defined(USE_OSD)
284 #undef USE_RX_LINK_QUALITY_INFO
285 #undef USE_OSD_PROFILES
286 #undef USE_OSD_STICK_OVERLAY
287 #undef USE_RX_LINK_UPLINK_POWER
290 // Generate USE_SPI_GYRO or USE_I2C_GYRO
291 #if defined(USE_GYRO_L3G4200D) || defined(USE_GYRO_MPU3050) || defined(USE_GYRO_MPU6000) || defined(USE_GYRO_MPU6050) || defined(USE_GYRO_MPU6500)
295 #if defined(USE_GYRO_SPI_ICM20689) || defined(USE_GYRO_SPI_MPU6000) || defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU9250) || defined(USE_GYRO_L3GD20) || defined(USE_GYRO_SPI_ICM42605) || defined(USE_GYRO_SPI_ICM42688P)
299 // CX10 is a special case of SPI RX which requires XN297
300 #if defined(USE_RX_CX10)
304 // Setup crystal frequency on F4 for backward compatibility
305 // Should be set to zero for generic targets to ensure USB is working
306 // when unconfigured for targets with non-standard crystal.
307 // Can be set at runtime with with CLI parameter 'system_hse_value'.
308 #define SYSTEM_HSE_VALUE 0
310 // Number of pins that needs pre-init
312 #ifndef SPI_PREINIT_COUNT
313 // 2 x 8 (GYROx2, BARO, MAG, MAX, FLASHx2, RX)
314 #define SPI_PREINIT_COUNT 16
322 #if (!defined(USE_FLASHFS) || !defined(USE_RTC_TIME) || !defined(USE_USB_MSC) || !defined(USE_PERSISTENT_OBJECTS))
323 #undef USE_PERSISTENT_MSC_RTC
326 #if !defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER) && !defined(USE_SERIAL_4WAY_SK_BOOTLOADER)
327 #undef USE_SERIAL_4WAY_BLHELI_INTERFACE
328 #elif !defined(USE_SERIAL_4WAY_BLHELI_INTERFACE) && (defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER) || defined(USE_SERIAL_4WAY_SK_BOOTLOADER))
329 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
332 #if !defined(USE_PWM_OUTPUT)
333 #undef USE_SERIAL_4WAY_BLHELI_INTERFACE // implementation requires USE_PWM_OUTPUT to find motor outputs.
336 #if !defined(USE_LED_STRIP)
337 #undef USE_LED_STRIP_STATUS_MODE
340 #if defined(USE_LED_STRIP) && !defined(USE_LED_STRIP_STATUS_MODE)
341 #define USE_WS2811_SINGLE_COLOUR
344 #if defined(SIMULATOR_BUILD) || defined(UNIT_TEST)
345 // This feature uses 'arm_math.h', which does not exist for x86.
346 #undef USE_DYN_NOTCH_FILTER
350 #undef USE_CMS_FAILSAFE_MENU
354 #undef USE_DSHOT_TELEMETRY
355 #undef USE_DSHOT_BITBANG
358 #ifndef USE_DSHOT_TELEMETRY
359 #undef USE_RPM_FILTER
360 #undef USE_DSHOT_TELEMETRY_STATS
363 #if !defined(USE_BOARD_INFO)
367 #if !defined(USE_ACC)
368 #undef USE_GPS_RESCUE
369 #undef USE_ACRO_TRAINER
372 #if (!defined(USE_GPS_RESCUE) || !defined(USE_CMS_FAILSAFE_MENU))
373 #undef USE_CMS_GPS_RESCUE_MENU
381 #if defined(USE_PWM) || defined(USE_DSHOT) || defined(USE_LED_STRIP) || defined(USE_TRANSPONDER) || defined(USE_BEEPER)
382 #define USE_PWM_OUTPUT
385 #if defined(USE_DSHOT) || defined(USE_LED_STRIP) || defined(USE_TRANSPONDER)
386 #define USE_TIMER_DMA
391 #if !defined(USE_DMA_SPEC)
392 #undef USE_TIMER_MGMT
395 #if defined(USE_TIMER_MGMT)
399 #if !defined(USE_RANGEFINDER)
400 #undef USE_RANGEFINDER_HCSR04
401 #undef USE_RANGEFINDER_SRF10
402 #undef USE_RANGEFINDER_HCSR04_I2C
403 #undef USE_RANGEFINDER_VL53L0X
404 #undef USE_RANGEFINDER_UIB
405 #undef USE_RANGEFINDER_TF
408 #ifndef USE_GPS_RESCUE
409 #undef USE_CMS_GPS_RESCUE_MENU
412 // TODO: Remove this once HAL support is fixed for ESCSERIAL
417 #if defined(CONFIG_IN_RAM) || defined(CONFIG_IN_FILE) || defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_SDCARD)
419 #define EEPROM_SIZE 4096
421 extern uint8_t eepromData
[EEPROM_SIZE
];
422 #define __config_start (*eepromData)
423 #define __config_end (*ARRAYEND(eepromData))
425 #ifndef CONFIG_IN_FLASH
426 #define CONFIG_IN_FLASH
428 extern uint8_t __config_start
; // configured via linker script when building binaries.
429 extern uint8_t __config_end
;
432 #if defined(USE_EXST) && !defined(RAMBASED)
433 #define USE_FLASH_BOOT_LOADER
436 #if !defined(USE_RPM_FILTER)
440 #ifndef USE_ITERM_RELAX
441 #undef USE_ABSOLUTE_CONTROL
444 #if defined(USE_CUSTOM_DEFAULTS)
445 #define USE_CUSTOM_DEFAULTS_ADDRESS
448 #if defined(USE_RX_EXPRESSLRS) && defined(STM32F411)
449 #define RX_SPI_DEFAULT_PROTOCOL RX_SPI_EXPRESSLRS
450 #define RX_EXPRESSLRS_TIMER_INSTANCE TIM5
453 #if defined(USE_RX_SPI) || defined (USE_SERIALRX_SRXL2)
458 #undef USE_GPS_PLUS_CODES