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/>.
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)
57 #define USE_DSHOT_BITBANG
58 #define USE_DSHOT_TELEMETRY
59 #define USE_DSHOT_TELEMETRY_STATS
67 #define USE_SERIAL_PASSTHROUGH
68 #define USE_GYRO_REGISTER_DUMP // Adds gyroregisters command to cli to dump configured register values
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)
79 #if !defined(USE_BARO) && !defined(USE_VIRTUAL_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
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 #define USE_BARO_LPS22DF
98 #define USE_BARO_SPI_LPS22DF
101 #if !defined(USE_GYRO) && !defined(USE_ACC)
105 #define USE_ACC_MPU6500
106 #define USE_GYRO_MPU6500
107 #define USE_ACC_SPI_MPU6000
108 #define USE_GYRO_SPI_MPU6000
109 #define USE_ACC_SPI_MPU6500
110 #define USE_GYRO_SPI_MPU6500
111 #define USE_ACC_SPI_ICM20689
112 #define USE_GYRO_SPI_ICM20689
113 #define USE_ACCGYRO_LSM6DSO
114 #define USE_ACCGYRO_BMI270
115 #define USE_GYRO_SPI_ICM42605
116 #define USE_GYRO_SPI_ICM42688P
117 #define USE_ACC_SPI_ICM42605
118 #define USE_ACC_SPI_ICM42688P
119 #define USE_ACCGYRO_LSM6DSV16X
121 #if TARGET_FLASH_SIZE > 512
122 #define USE_ACC_MPU6050
123 #define USE_GYRO_MPU6050
124 #define USE_ACCGYRO_BMI160
126 #endif // ACC GYRO inclusion
128 #if !defined(USE_FLASH_CHIP)
130 #if !defined(USE_EXST) && !defined(USE_FLASH)
134 #if defined(USE_FLASH)
136 #if !defined(USE_EXST)
138 #define USE_FLASH_TOOLS
139 #define USE_FLASH_M25P16
140 #define USE_FLASH_W25N01G // 1Gb NAND flash support
141 #define USE_FLASH_W25N02K // 2Gb NAND flash support
142 #define USE_FLASH_W25M // Stacked die support
143 #define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
144 #define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
145 #define USE_FLASH_W25Q128FV // 16MB Winbond 25Q128
146 #define USE_FLASH_PY25Q128HA // 16MB PUYA SEMI 25Q128
150 #endif // USE_FLASH_CHIP
152 #if !defined(USE_MAX7456)
156 #if !defined(USE_RX_SPI)
159 #define USE_RX_CC2500
160 #define USE_RX_EXPRESSLRS
161 #define USE_RX_SX1280
162 #define USE_RX_SX127X
163 #endif // !USE_RX_SPI
165 #if !defined(USE_EXST) && !defined(USE_SDCARD)
169 #endif // !defined(USE_CONFIG)
176 #if !defined(USE_SERIAL_RX)
179 #define USE_SERIALRX_CRSF // Team Black Sheep Crossfire protocol
180 #define USE_SERIALRX_GHST // ImmersionRC Ghost Protocol
181 #define USE_SERIALRX_IBUS // FlySky and Turnigy receivers
182 #define USE_SERIALRX_SBUS // Frsky and Futaba receivers
183 #define USE_SERIALRX_SPEKTRUM // SRXL, DSM2 and DSMX protocol
184 #define USE_SERIALRX_FPORT // FrSky FPort
185 #define USE_SERIALRX_XBUS // JR
186 #define USE_SERIALRX_SRXL2 // Spektrum SRXL2 protocol
188 #endif // !defined(USE_SERIAL_RX)
190 #if !defined(USE_TELEMETRY)
191 #define USE_TELEMETRY
193 #define USE_TELEMETRY_FRSKY_HUB
194 #define USE_TELEMETRY_SMARTPORT
195 #define USE_TELEMETRY_CRSF
196 #define USE_TELEMETRY_GHST
197 #define USE_TELEMETRY_SRXL
199 #endif // !defined(USE_TELEMETRY)
205 #if !defined(USE_OSD_SD) && !defined(USE_OSD_HD)
211 #if TARGET_FLASH_SIZE >= 1024
213 #if defined(USE_SERIALRX)
215 #define USE_SERIALRX_JETIEXBUS
216 #define USE_SERIALRX_SUMD // Graupner Hott protocol
217 #define USE_SERIALRX_SUMH // Graupner legacy protocol
219 #endif // USE_SERIALRX
221 #if defined(USE_TELEMETRY)
223 #define USE_TELEMETRY_IBUS
224 #define USE_TELEMETRY_IBUS_EXTENDED
225 #define USE_TELEMETRY_JETIEXBUS
226 #define USE_TELEMETRY_MAVLINK
227 #define USE_TELEMETRY_HOTT
228 #define USE_TELEMETRY_LTM
230 #endif // USE_TELEMETRY
232 #ifdef USE_DSHOT_TELEMETRY
233 #define USE_RPM_LIMIT
237 // Dependency for CMS is defined outside this block.
238 #define USE_OSD_QUICK_MENU
240 #define USE_SPEC_PREARM_SCREEN
243 #define USE_BATTERY_CONTINUE
244 #define USE_DASHBOARD
245 #define USE_EMFAT_AUTORUN
246 #define USE_EMFAT_ICON
247 #define USE_ESCSERIAL_SIMONK
248 #define USE_ALT_HOLD_MODE
250 #if !defined(USE_GPS)
254 #if !defined(USE_GPS_PLUS_CODES)
255 #define USE_GPS_PLUS_CODES
258 #if !defined(USE_LED_STRIP)
259 #define USE_LED_STRIP
262 #define USE_SERIAL_4WAY_SK_BOOTLOADER
264 #define USE_VTX_RTC6705
265 #define USE_VTX_RTC6705_SOFTSPI
267 #define USE_TRANSPONDER
269 #define USE_RANGEFINDER
270 #define USE_RANGEFINDER_HCSR04
271 #define USE_RANGEFINDER_TF
273 #endif // TARGET_FLASH_SIZE > 512
275 #endif // !defined(CLOUD_BUILD)
277 #if !defined(LED_STRIP_MAX_LENGTH)
278 #ifdef USE_LED_STRIP_64
279 #define LED_STRIP_MAX_LENGTH 64
281 #define LED_STRIP_MAX_LENGTH 32
283 #endif // # !defined(LED_STRIP_MAX_LENGTH)
285 #if defined(USE_LED_STRIP)
286 #define USE_LED_STRIP_STATUS_MODE
290 #define USE_VTX_COMMON
291 #define USE_VTX_CONTROL
292 #define USE_VTX_SMARTAUDIO
293 #define USE_VTX_TRAMP
295 #define USE_VTX_TABLE
300 #define PID_PROFILE_COUNT 4
301 #define CONTROL_RATE_PROFILE_COUNT 4
303 #define USE_CLI_BATCH
304 #define USE_RESOURCE_MGMT
306 #define USE_RUNAWAY_TAKEOFF // Runaway Takeoff Prevention (anti-taz)
308 #define USE_GYRO_OVERFLOW_CHECK
309 #define USE_YAW_SPIN_RECOVERY
312 #define USE_DSHOT_DMAR
315 #define USE_MSP_OVER_TELEMETRY
317 #define USE_VIRTUAL_CURRENT_METER
318 #define USE_ESC_SENSOR
319 #define USE_SERIAL_4WAY_BLHELI_BOOTLOADER
322 #define USE_GYRO_LPF2
326 #define USE_THROTTLE_BOOST
327 #define USE_INTEGRATED_YAW_CONTROL
329 #define USE_ITERM_RELAX
330 #define USE_RC_SMOOTHING_FILTER
331 #define USE_THRUST_LINEARIZATION
333 #ifdef USE_SERIALRX_SPEKTRUM
334 #define USE_SPEKTRUM_BIND
335 #define USE_SPEKTRUM_BIND_PLUG
336 #define USE_SPEKTRUM_REAL_RSSI
337 #define USE_SPEKTRUM_VIRTUAL_RSSI
338 #define USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
339 #define USE_SPEKTRUM_VTX_CONTROL
340 #define USE_SPEKTRUM_VTX_TELEMETRY
341 #define USE_SPEKTRUM_CMS_TELEMETRY
342 #endif // USE_SERIALRX_SPEKTRUM
344 #ifdef USE_TELEMETRY_SRXL
345 #ifndef USE_SERIALRX_SPEKTRUM
346 #define USE_SERIALRX_SPEKTRUM
347 #define USE_SPEKTRUM_VTX_CONTROL
348 #define USE_SPEKTRUM_VTX_TELEMETRY
349 #define USE_SPEKTRUM_CMS_TELEMETRY
350 #endif // USE_SERIALRX_SPEKTRUM
351 #endif // USE_TELEMETRY_SRXL
353 #define USE_BOARD_INFO
355 #define USE_ESC_SENSOR_INFO
358 #define USE_RX_RSSI_DBM
360 #define USE_RX_LINK_QUALITY_INFO
361 #define USE_RX_MSP_OVERRIDE
362 #define USE_RX_LINK_UPLINK_POWER
364 #define USE_AIRMODE_LPF
365 #define USE_GYRO_DLPF_EXPERIMENTAL
366 #define USE_MULTI_GYRO
367 #define USE_SENSOR_NAMES
368 #define USE_UNCOMMON_MIXERS
369 #define USE_SIGNATURE
370 #define USE_ABSOLUTE_CONTROL
371 #define USE_HOTT_TEXTMODE
372 #define USE_ESC_SENSOR_TELEMETRY
373 #define USE_TELEMETRY_SENSORS_DISABLED_DETAILS
374 #define USE_PERSISTENT_STATS
375 #define USE_PROFILE_NAMES
376 #define USE_FEEDFORWARD
377 #define USE_CUSTOM_BOX_NAMES
378 #define USE_BATTERY_VOLTAGE_SAG_COMPENSATION
379 #define USE_SIMPLIFIED_TUNING
380 #define USE_CRAFTNAME_MSGS
382 #if !defined(CORE_BUILD)
383 // CORE_BUILD is only hardware drivers, and the bare minimum
384 // any thing defined here will be in the standard (git hub actions)
385 // builds or included in CLOUD_BUILD by default.
387 #if !defined(USE_LAUNCH_CONTROL)
388 #define USE_LAUNCH_CONTROL
391 #endif // !defined(CORE_BUILD)
395 #define USE_GPS_UBLOX
396 #define USE_GPS_RESCUE
399 #if (defined(USE_OSD_HD) || defined(USE_OSD_SD)) && !defined(USE_OSD)
400 // If either USE_OSD_SD for USE_OSD_HD are defined, ensure that USE_OSD is also defined
406 #if !defined(USE_OSD_HD) && !defined(USE_OSD_SD)
407 // If USE_OSD is defined without specifying SD or HD, then support both
412 #if !defined(USE_OSD_SD) && defined(USE_MAX7456)
413 // If USE_OSD_SD isn't defined then explicitly exclude MAX7456 support
419 #define USE_CMS_FAILSAFE_MENU
420 #define USE_EXTENDED_CMS_MENUS
421 #define USE_MSP_DISPLAYPORT
422 #define USE_OSD_OVER_MSP_DISPLAYPORT
423 #define USE_OSD_ADJUSTMENTS
424 #define USE_OSD_PROFILES
425 #define USE_OSD_STICK_OVERLAY
428 #define USE_CMS_GPS_RESCUE_MENU
431 #endif // defined(USE_OSD)
433 #if defined(USE_SERIALRX_CRSF)
437 #if defined(USE_TELEMETRY_CRSF) && defined(USE_CMS)
438 #define USE_CRSF_CMS_TELEMETRY
439 #define USE_CRSF_LINK_STATISTICS
442 #endif // defined(USE_SERIALRX_CRSF)
444 // USE_RACE_PRO feature pack
447 #ifdef USE_DSHOT_TELEMETRY
448 #ifndef USE_RPM_LIMIT
449 #define USE_RPM_LIMIT
454 #ifndef USE_OSD_QUICK_MENU
455 #define USE_OSD_QUICK_MENU
460 #ifndef USE_SPEC_PREARM_SCREEN
461 #define USE_SPEC_PREARM_SCREEN
465 #endif // USE_RACE_PRO
473 #ifndef USE_ADVANCED_TPA
474 #define USE_ADVANCED_TPA
477 #undef USE_YAW_SPIN_RECOVERY
478 #undef USE_LAUNCH_CONTROL
479 #undef USE_ABSOLUTE_CONTROL
480 #undef USE_INTEGRATED_YAW_CONTROL
481 #undef USE_RUNAWAY_TAKEOFF