CONFIG: Fix blackbox (#12511)
[betaflight.git] / src / main / target / common_pre.h
blob0e8324c37dfbaf6a071263b3e7e683aac3cbb2b2
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
25 The purpose of this file is to enable the firmware "gates" for features and drivers
26 prior to entering the target.h.
28 CLOUD_BUILD is used to signify that the build is a user requested build and that the
29 features to be enabled will be defined ALREADY.
31 CORE_BUILD is used to signify that the build is a user requested build and that the
32 features to be enabled will be the minimal set, and all the drivers should be present.
34 If neither of the above are present then the build should simply be a baseline build
35 for continuous integration, i.e. the compilation of the majority of features and drivers
36 dependent on the size of the flash available.
38 NOTE: for 4.5 we will be removing any conditions related to specific MCU types, instead
39 these should be defined in the target.h or in a file that is imported by target.h (in the
40 case of common settings for a given MCU group)
44 #define USE_PARAMETER_GROUPS
45 // type conversion warnings.
46 // -Wconversion can be turned on to enable the process of eliminating these warnings
47 //#pragma GCC diagnostic warning "-Wconversion"
48 #pragma GCC diagnostic ignored "-Wsign-conversion"
49 // -Wpadded can be turned on to check padding of structs
50 //#pragma GCC diagnostic warning "-Wpadded"
52 #if !defined(CLOUD_BUILD) && !defined(SITL)
53 #define USE_DSHOT
54 #endif
56 #ifdef USE_DSHOT
57 #define USE_DSHOT_BITBANG
58 #define USE_DSHOT_TELEMETRY
59 #define USE_DSHOT_TELEMETRY_STATS
60 #endif
62 #define USE_MOTOR
63 #define USE_DMA
64 #define USE_TIMER
66 #define USE_CLI
67 #define USE_SERIAL_PASSTHROUGH
68 #define USE_GYRO_REGISTER_DUMP // Adds gyroregisters command to cli to dump configured register values
69 #define USE_IMU_CALC
71 // all the settings for classic build
72 #if !defined(CLOUD_BUILD) && !defined(SITL)
74 // if no board config is provided, include all drivers
75 #if !defined(USE_CONFIG)
77 #define USE_MAG
79 #if !defined(USE_BARO) && !defined(USE_FAKE_BARO)
80 #define USE_BARO
82 #define USE_BARO_MS5611
83 #define USE_BARO_SPI_MS5611
84 #define USE_BARO_BMP280
85 #define USE_BARO_SPI_BMP280
86 #define USE_BARO_BMP388
87 #define USE_BARO_SPI_BMP388
88 #define USE_BARO_LPS
89 #define USE_BARO_SPI_LPS
90 #define USE_BARO_QMP6988
91 #define USE_BARO_SPI_QMP6988
92 #define USE_BARO_DPS310
93 #define USE_BARO_SPI_DPS310
94 #define USE_BARO_BMP085
95 #define USE_BARO_2SMBP_02B
96 #define USE_BARO_SPI_2SMBP_02B
97 #endif
99 #if !defined(USE_GYRO) && !defined(USE_ACC)
100 #define USE_ACC
101 #define USE_GYRO
103 #define USE_ACC_MPU6500
104 #define USE_GYRO_MPU6500
105 #define USE_ACC_SPI_MPU6000
106 #define USE_GYRO_SPI_MPU6000
107 #define USE_ACC_SPI_MPU6500
108 #define USE_GYRO_SPI_MPU6500
109 #define USE_ACC_SPI_ICM20689
110 #define USE_GYRO_SPI_ICM20689
111 #define USE_ACCGYRO_LSM6DSO
112 #define USE_ACCGYRO_BMI270
113 #define USE_GYRO_SPI_ICM42605
114 #define USE_GYRO_SPI_ICM42688P
115 #define USE_ACC_SPI_ICM42605
116 #define USE_ACC_SPI_ICM42688P
118 #if defined(STM32F405) || defined(STM32F745) || defined(STM32G4) || defined(STM32H7)
119 #define USE_ACC_MPU6050
120 #define USE_GYRO_MPU6050
121 #define USE_ACCGYRO_BMI160
122 #endif
123 #endif // ACC GYRO inclusion
125 #if !defined(USE_FLASH_CHIP)
127 #if !defined(USE_EXST) && !defined(USE_FLASH)
128 #define USE_FLASH
129 #endif
131 #if defined(USE_FLASH)
133 #if !defined(USE_EXST)
134 #define USE_FLASHFS
135 #define USE_FLASH_TOOLS
136 #define USE_FLASH_M25P16
137 #define USE_FLASH_W25N01G // 1Gb NAND flash support
138 #define USE_FLASH_W25M // Stacked die support
139 #define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
140 #define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
141 #define USE_FLASH_W25Q128FV // 16MB Winbond 25Q128
142 #endif // USE_EXST
144 #endif // USE_FLASH
145 #endif // USE_FLASH_CHIP
147 #if !defined(USE_MAX7456)
148 #define USE_MAX7456
149 #endif
151 #if !defined(USE_RX_SPI)
152 #define USE_RX_SPI
154 #define USE_RX_CC2500
155 #define USE_RX_EXPRESSLRS
156 #define USE_RX_SX1280
157 #define USE_RX_SX127X
158 #endif // !USE_RX_SPI
160 #if !defined(USE_EXST) && !defined(USE_SDCARD)
161 #define USE_SDCARD
162 #endif
164 #endif // !defined(USE_CONFIG)
166 #if defined(STM32F405) || defined(STM32F745) || defined(STM32H7)
167 #define USE_VTX_RTC6705
168 #define USE_VTX_RTC6705_SOFTSPI
170 #define USE_TRANSPONDER
172 #define USE_RANGEFINDER
173 #define USE_RANGEFINDER_HCSR04
174 #define USE_RANGEFINDER_TF
175 #endif
177 #define USE_RX_PPM
178 #define USE_RX_PWM
180 #define USE_PINIO
182 #if !defined(USE_SERIAL_RX)
184 #define USE_SERIALRX
185 #define USE_SERIALRX_CRSF // Team Black Sheep Crossfire protocol
186 #define USE_SERIALRX_GHST // ImmersionRC Ghost Protocol
187 #define USE_SERIALRX_IBUS // FlySky and Turnigy receivers
188 #define USE_SERIALRX_SBUS // Frsky and Futaba receivers
189 #define USE_SERIALRX_SPEKTRUM // SRXL, DSM2 and DSMX protocol
190 #define USE_SERIALRX_FPORT // FrSky FPort
191 #define USE_SERIALRX_XBUS // JR
192 #define USE_SERIALRX_SRXL2 // Spektrum SRXL2 protocol
194 #endif // !defined(USE_SERIAL_RX)
196 #if !defined(USE_TELEMETRY)
197 #define USE_TELEMETRY
199 #define USE_TELEMETRY_FRSKY_HUB
200 #define USE_TELEMETRY_SMARTPORT
201 #define USE_TELEMETRY_CRSF
202 #define USE_TELEMETRY_GHST
203 #define USE_TELEMETRY_SRXL
205 #endif // !defined(USE_TELEMETRY)
207 #define USE_SERVOS
209 #define USE_VTX
210 #define USE_OSD
211 #define USE_OSD_SD
212 #define USE_OSD_HD
213 #define USE_BLACKBOX
215 #if TARGET_FLASH_SIZE > 512
217 #if defined(USE_SERIALRX)
219 #define USE_SERIALRX_JETIEXBUS
220 #define USE_SERIALRX_SUMD // Graupner Hott protocol
221 #define USE_SERIALRX_SUMH // Graupner legacy protocol
223 #endif // USE_SERIALRX
225 #if defined(USE_TELEMETRY)
227 #define USE_TELEMETRY_IBUS
228 #define USE_TELEMETRY_IBUS_EXTENDED
229 #define USE_TELEMETRY_JETIEXBUS
230 #define USE_TELEMETRY_MAVLINK
231 #define USE_TELEMETRY_HOTT
232 #define USE_TELEMETRY_LTM
234 #endif // USE_TELEMETRY
236 #define USE_BATTERY_CONTINUE
237 #define USE_DASHBOARD
238 #define USE_EMFAT_AUTORUN
239 #define USE_EMFAT_ICON
240 #define USE_ESCSERIAL_SIMONK
241 #define USE_GPS
242 #define USE_GPS_PLUS_CODES
243 #define USE_LED_STRIP
244 #define USE_SERIAL_4WAY_SK_BOOTLOADER
245 #endif
247 #endif // !defined(CLOUD_BUILD)
249 #if !defined(LED_MAX_STRIP_LENGTH)
250 #ifdef USE_LED_STRIP_64
251 #define LED_MAX_STRIP_LENGTH 64
252 #else
253 #define LED_MAX_STRIP_LENGTH 32
254 #endif
255 #endif // # !defined(LED_MAX_STRIP_LENGTH)
257 #if defined(USE_LED_STRIP)
258 #define USE_LED_STRIP_STATUS_MODE
259 #endif
261 #if defined(USE_SDCARD)
262 #define USE_SDCARD_SPI
263 #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
264 #define USE_SDCARD_SDIO
265 #endif
266 #endif
268 #if defined(USE_PINIO)
269 #define USE_PINIOBOX
270 #define USE_PIN_PULL_UP_DOWN
271 #endif
273 #if defined(USE_VTX)
274 #define USE_VTX_COMMON
275 #define USE_VTX_CONTROL
276 #define USE_VTX_SMARTAUDIO
277 #define USE_VTX_TRAMP
278 #define USE_VTX_MSP
279 #define USE_VTX_TABLE
280 #endif // USE_VTX
282 #define USE_HUFFMAN
284 #define PID_PROFILE_COUNT 4
285 #define CONTROL_RATE_PROFILE_COUNT 4
287 #define USE_CLI_BATCH
288 #define USE_RESOURCE_MGMT
290 #define USE_RUNAWAY_TAKEOFF // Runaway Takeoff Prevention (anti-taz)
292 #define USE_GYRO_OVERFLOW_CHECK
293 #define USE_YAW_SPIN_RECOVERY
295 #ifdef USE_DSHOT
296 #define USE_DSHOT_DMAR
297 #endif
299 #define USE_MSP_OVER_TELEMETRY
301 #define USE_VIRTUAL_CURRENT_METER
302 #define USE_ESC_SENSOR
303 #define USE_SERIAL_4WAY_BLHELI_BOOTLOADER
304 #define USE_RCDEVICE
306 #define USE_GYRO_LPF2
307 #define USE_DYN_LPF
308 #define USE_D_MIN
310 #define USE_THROTTLE_BOOST
311 #define USE_INTEGRATED_YAW_CONTROL
313 #define USE_ITERM_RELAX
314 #define USE_RC_SMOOTHING_FILTER
315 #define USE_THRUST_LINEARIZATION
316 #define USE_TPA_MODE
318 #ifdef USE_SERIALRX_SPEKTRUM
319 #define USE_SPEKTRUM_BIND
320 #define USE_SPEKTRUM_BIND_PLUG
321 #define USE_SPEKTRUM_REAL_RSSI
322 #define USE_SPEKTRUM_FAKE_RSSI
323 #define USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
324 #define USE_SPEKTRUM_VTX_CONTROL
325 #define USE_SPEKTRUM_VTX_TELEMETRY
326 #define USE_SPEKTRUM_CMS_TELEMETRY
327 #endif // USE_SERIALRX_SPEKTRUM
329 #define USE_BOARD_INFO
330 #define USE_RTC_TIME
331 #define USE_ESC_SENSOR_INFO
333 #define USE_RX_MSP
334 #define USE_RX_RSSI_DBM
335 #define USE_RX_RSNR
336 #define USE_RX_LINK_QUALITY_INFO
337 #define USE_RX_MSP_OVERRIDE
338 #define USE_RX_LINK_UPLINK_POWER
340 #define USE_AIRMODE_LPF
341 #define USE_GYRO_DLPF_EXPERIMENTAL
342 #define USE_MULTI_GYRO
343 #define USE_SENSOR_NAMES
344 #define USE_UNCOMMON_MIXERS
345 #define USE_SIGNATURE
346 #define USE_ABSOLUTE_CONTROL
347 #define USE_HOTT_TEXTMODE
348 #define USE_ESC_SENSOR_TELEMETRY
349 #define USE_TELEMETRY_SENSORS_DISABLED_DETAILS
350 #define USE_PERSISTENT_STATS
351 #define USE_PROFILE_NAMES
352 #define USE_FEEDFORWARD
353 #define USE_CUSTOM_BOX_NAMES
354 #define USE_BATTERY_VOLTAGE_SAG_COMPENSATION
355 #define USE_SIMPLIFIED_TUNING
356 #define USE_CRAFTNAME_MSGS
358 #if !defined(CORE_BUILD)
359 // CORE_BUILD is only hardware drivers, and the bare minimum
360 // any thing defined here will be in the standard (git hub actions)
361 // builds or included in CLOUD_BUILD by default.
363 #if !defined(USE_LAUNCH_CONTROL)
364 #define USE_LAUNCH_CONTROL
365 #endif
367 #endif // !defined(CORE_BUILD)
369 #ifdef USE_GPS
370 #define USE_GPS_NMEA
371 #define USE_GPS_UBLOX
372 #define USE_GPS_RESCUE
373 #endif // USE_GPS
376 #if (defined(USE_OSD_HD) || defined(USE_OSD_SD)) && !defined(USE_OSD)
377 // If either USE_OSD_SD for USE_OSD_HD are defined, ensure that USE_OSD is also defined
378 #define USE_OSD
379 #endif
382 #if defined(USE_OSD)
384 #if !defined(USE_OSD_HD) && !defined(USE_OSD_SD)
385 // If USE_OSD is defined without specifying SD or HD, then support both
386 #define USE_OSD_SD
387 #define USE_OSD_HD
388 #endif
390 #if !defined(USE_OSD_SD) && defined(USE_MAX7456)
391 // If USE_OSD_SD isn't defined then explicitly exclude MAX7456 support
392 #undef USE_MAX7456
393 #endif
395 #define USE_CANVAS
396 #define USE_CMS
397 #define USE_CMS_FAILSAFE_MENU
398 #define USE_EXTENDED_CMS_MENUS
399 #define USE_MSP_DISPLAYPORT
400 #define USE_OSD_OVER_MSP_DISPLAYPORT
401 #define USE_OSD_ADJUSTMENTS
402 #define USE_OSD_PROFILES
403 #define USE_OSD_STICK_OVERLAY
405 #if defined(USE_GPS)
406 #define USE_CMS_GPS_RESCUE_MENU
407 #endif
409 #endif // defined(USE_OSD)
412 #if defined(USE_SERIALRX_CRSF)
414 #define USE_CRSF_V3
416 #if defined(USE_TELEMETRY_CRSF) && defined(USE_CMS)
417 #define USE_CRSF_CMS_TELEMETRY
418 #define USE_CRSF_LINK_STATISTICS
419 #endif
421 #endif // defined(USE_SERIALRX_CRSF)