forked from betaflight/betaflight
/
common_post.h
641 lines (535 loc) · 16 KB
/
common_post.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "build/version.h"
/*
The purpose of this file is to enable / disable any firmware "gates" for features and drivers
that require hardware resources that are either available or not available after the target.h
has been processed.
It should also be used to define anything that should be defined (and is required), but is not
already, to some sort of defaults.
CLOUD_BUILD and CORE_BUILD should not be referenced here.
NOTE: for 4.5 we will be removing any conditions related to specific MCU types, instead
these should be defined in the target.h or in a file that is imported by target.h (in the
case of common settings for a given MCU group)
*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
#define DEFAULT_AUX_CHANNEL_COUNT MAX_AUX_CHANNEL_COUNT
#else
#define DEFAULT_AUX_CHANNEL_COUNT 6
#endif
#ifdef USE_ITCM_RAM
#if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
#define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
#else
#define FAST_CODE __attribute__((section(".tcm_code")))
#endif
// Handle case where we'd prefer code to be in ITCM, but it won't fit on the F745
#ifdef STM32F745xx
#define FAST_CODE_PREF
#else
#define FAST_CODE_PREF __attribute__((section(".tcm_code")))
#endif
#define FAST_CODE_NOINLINE NOINLINE
#else
#define FAST_CODE
#define FAST_CODE_PREF
#define FAST_CODE_NOINLINE
#endif // USE_ITCM_RAM
#ifdef USE_CCM_CODE
#define CCM_CODE __attribute__((section(".ccm_code")))
#else
#define CCM_CODE
#endif
#ifdef USE_FAST_DATA
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
#else
#define FAST_DATA_ZERO_INIT
#define FAST_DATA
#endif // USE_FAST_DATA
/*
BEGIN HARDWARE INCLUSIONS
Simplified options for the moment, i.e. adding USE_MAG or USE_BARO and the entire driver suite is added.
In the future we can move to specific drivers being added only - to save flash space.
*/
#if defined(USE_MAG) && !defined(USE_VIRTUAL_MAG)
#ifndef USE_MAG_DATA_READY_SIGNAL
#define USE_MAG_DATA_READY_SIGNAL
#endif
#ifndef USE_MAG_HMC5883
#define USE_MAG_HMC5883
#endif
#ifndef USE_MAG_SPI_HMC5883
#define USE_MAG_SPI_HMC5883
#endif
#ifndef USE_MAG_QMC5883
#define USE_MAG_QMC5883
#endif
#ifndef USE_MAG_LIS2MDL
#define USE_MAG_LIS2MDL
#endif
#ifndef USE_MAG_LIS3MDL
#define USE_MAG_LIS3MDL
#endif
#ifndef USE_MAG_AK8963
#define USE_MAG_AK8963
#endif
#ifndef USE_MAG_MPU925X_AK8963
#define USE_MAG_MPU925X_AK8963
#endif
#ifndef USE_MAG_SPI_AK8963
#define USE_MAG_SPI_AK8963
#endif
#ifndef USE_MAG_AK8975
#define USE_MAG_AK8975
#endif
#ifndef USE_MAG_IST8310
#define USE_MAG_IST8310
#endif
#endif // END MAG HW defines
#if defined(USE_RX_CC2500)
#if !defined(USE_RX_SPI)
#define USE_RX_SPI
#endif
#define USE_RX_CC2500_SPI_PA_LNA
#define USE_RX_CC2500_SPI_DIVERSITY
#define USE_RX_SFHSS_SPI
#define USE_RX_REDPINE_SPI
#define USE_RX_FRSKY_SPI_D
#define USE_RX_FRSKY_SPI_X
#define USE_RX_FRSKY_SPI
#define USE_RX_FRSKY_SPI_TELEMETRY
#define USE_RX_FLYSKY
#define USE_RX_FLYSKY_SPI_LED
#define USE_RX_SPEKTRUM
#define USE_RX_SPEKTRUM_TELEMETRY
#endif // defined(USE_RX_CC2500)
#if defined(CAMERA_CONTROL_PIN) && defined(USE_VTX) && !defined(USE_CAMERA_CONTROL)
#define USE_CAMERA_CONTROL
#endif
/* END HARDWARE INCLUSIONS */
#if defined(USE_VTX_RTC6705_SOFTSPI)
#define USE_VTX_RTC6705
#endif
#ifndef USE_DSHOT
#undef USE_ESC_SENSOR
#endif
#ifndef USE_ESC_SENSOR
#undef USE_ESC_SENSOR_TELEMETRY
#endif
// XXX Followup implicit dependencies among DASHBOARD, display_xxx and USE_I2C.
// XXX This should eventually be cleaned up.
#ifndef USE_I2C
#undef USE_I2C_OLED_DISPLAY
#undef USE_DASHBOARD
#else
#ifdef USE_DASHBOARD
#define USE_I2C_OLED_DISPLAY
#endif
#endif
// Remove USE_BARO_BMP280 and USE_BARO_MS5611 if USE_I2C is not defined.
#if !defined(USE_I2C)
#if defined(USE_BARO_BMP280)
#undef USE_BARO_BMP280
#endif
#if defined(USE_BARO_MS5611)
#undef USE_BARO_MS5611
#endif
#endif
// Add VARIO if BARO or GPS is defined. Remove when none defined.
#if defined(USE_BARO) || defined(USE_GPS)
#ifndef USE_VARIO
#define USE_VARIO
#endif
#else
#undef USE_VARIO
#endif
#if !defined(USE_SERIALRX)
#undef USE_SERIALRX_CRSF
#undef USE_SERIALRX_GHST
#undef USE_SERIALRX_IBUS
#undef USE_SERIALRX_JETIEXBUS
#undef USE_SERIALRX_SBUS
#undef USE_SERIALRX_SPEKTRUM
#undef USE_SERIALRX_SUMD
#undef USE_SERIALRX_SUMH
#undef USE_SERIALRX_XBUS
#undef USE_SERIALRX_FPORT
#endif
#if !defined(USE_TELEMETRY)
#undef USE_TELEMETRY_CRSF
#undef USE_TELEMETRY_GHST
#undef USE_TELEMETRY_FRSKY_HUB
#undef USE_TELEMETRY_HOTT
#undef USE_TELEMETRY_IBUS
#undef USE_TELEMETRY_IBUS_EXTENDED
#undef USE_TELEMETRY_JETIEXBUS
#undef USE_TELEMETRY_LTM
#undef USE_TELEMETRY_MAVLINK
#undef USE_TELEMETRY_SMARTPORT
#undef USE_TELEMETRY_SRXL
#endif
#ifdef USE_SERIALRX_FPORT
#ifndef USE_TELEMETRY
#define USE_TELEMETRY
#endif
#ifndef USE_TELEMETRY_SMARTPORT
#define USE_TELEMETRY_SMARTPORT
#endif
#endif
#if defined(USE_TELEMETRY_IBUS_EXTENDED) && !defined(USE_TELEMETRY_IBUS)
#define USE_TELEMETRY_IBUS
#endif
#if !defined(USE_SERIALRX_CRSF)
#undef USE_TELEMETRY_CRSF
#undef USE_CRSF_LINK_STATISTICS
#undef USE_CRSF_V3
#endif
#if !defined(USE_RX_EXPRESSLRS) && !defined(USE_SERIALRX_CRSF)
#undef USE_RX_RSSI_DBM
#endif
#if !defined(USE_SERIALRX_GHST)
#undef USE_TELEMETRY_GHST
#endif
#if !defined(USE_TELEMETRY_CRSF) || !defined(USE_CMS)
#undef USE_CRSF_CMS_TELEMETRY
#endif
#if !defined(USE_TELEMETRY_CRSF)
#undef USE_CRSF_V3
#endif
#if !defined(USE_SERIALRX_JETIEXBUS)
#undef USE_TELEMETRY_JETIEXBUS
#endif
#if !defined(USE_TELEMETRY_IBUS)
#undef USE_TELEMETRY_IBUS_EXTENDED
#endif
// If USE_SERIALRX_SPEKTRUM was dropped by a target, drop all related options
#ifndef USE_SERIALRX_SPEKTRUM
#undef USE_SPEKTRUM_BIND
#undef USE_SPEKTRUM_BIND_PLUG
#undef USE_SPEKTRUM_REAL_RSSI
#undef USE_SPEKTRUM_VIRTUAL_RSSI
#undef USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
#undef USE_SPEKTRUM_VTX_CONTROL
#undef USE_SPEKTRUM_VTX_TELEMETRY
#undef USE_TELEMETRY_SRXL
#endif
#if !defined(USE_CMS) || !defined(USE_TELEMETRY_SRXL)
#undef USE_SPEKTRUM_CMS_TELEMETRY
#endif
#if defined(USE_SERIALRX_SBUS) || defined(USE_SERIALRX_FPORT)
#if !defined(USE_SBUS_CHANNELS)
#define USE_SBUS_CHANNELS
#endif
#endif
#if !defined(USE_TELEMETRY_SMARTPORT) && !defined(USE_TELEMETRY_CRSF) && !defined(USE_TELEMETRY_GHST)
#undef USE_MSP_OVER_TELEMETRY
#endif
#if !defined(USE_RX_MSP) && defined(USE_RX_MSP_OVERRIDE)
#undef USE_RX_MSP_OVERRIDE
#endif
/* If either VTX_CONTROL or VTX_COMMON is undefined then remove common code and device drivers */
#if !defined(USE_VTX_COMMON) || !defined(USE_VTX_CONTROL)
#undef USE_VTX_COMMON
#undef USE_VTX_CONTROL
#undef USE_VTX_TRAMP
#undef USE_VTX_SMARTAUDIO
#undef USE_VTX_TABLE
#undef USE_VTX_MSP
#endif
// Some target doesn't define USE_ADC which USE_ADC_INTERNAL depends on
#ifndef USE_ADC
#undef USE_ADC_INTERNAL
#endif
#if (defined(USE_SDCARD) || defined(USE_FLASH)) && !defined(USE_BLACKBOX)
#define USE_BLACKBOX
#endif
#ifdef USE_FLASH
#if !defined(USE_FLASH_TOOLS)
#define USE_FLASH_TOOLS
#endif
#if !defined(USE_FLASHFS)
#define USE_FLASHFS
#endif
#endif
#if (defined(USE_FLASH_W25M512) || defined(USE_FLASH_W25Q128FV)) && !defined(USE_FLASH_M25P16)
#if !defined(USE_FLASH_M25P16)
#define USE_FLASH_M25P16
#endif
#endif
#if defined(USE_FLASH_W25M02G) && !defined(USE_FLASH_W25N01G)
#if !defined(USE_FLASH_W25N01G)
#define USE_FLASH_W25N01G
#endif
#endif
#if (defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25N01G)) && !defined(USE_FLASH_W25M)
#if !defined(USE_FLASH_W25M)
#define USE_FLASH_W25M
#endif
#endif
#if defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25M) || defined(USE_FLASH_W25N01G) || defined(USE_FLASH_W25Q128FV)
#if !defined(USE_FLASH_CHIP)
#define USE_FLASH_CHIP
#endif
#endif
#if defined(USE_SPI) && (defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25M512) || defined(USE_FLASH_W25N01G) || defined(USE_FLASH_W25M02G))
#if !defined(USE_FLASH_SPI)
#define USE_FLASH_SPI
#endif
#endif
#if defined(USE_QUADSPI) && (defined(USE_FLASH_W25Q128FV) || defined(USE_FLASH_W25N01G))
#if !defined(USE_FLASH_QUADSPI)
#define USE_FLASH_QUADSPI
#endif
#endif
#if defined(USE_OCTOSPI) && defined(USE_FLASH_W25Q128FV)
#if !defined(USE_FLASH_OCTOSPI)
#define USE_FLASH_OCTOSPI
#endif
#endif
#ifndef USE_FLASH_CHIP
#undef USE_FLASH_TOOLS
#undef USE_FLASHFS
#endif
#if (!defined(USE_SDCARD) && !defined(USE_FLASHFS)) || !defined(USE_BLACKBOX)
#undef USE_USB_MSC
#endif
#if !defined(USE_SDCARD)
#undef USE_SDCARD_SDIO
#undef USE_SDCARD_SPI
#endif
#if !defined(USE_VCP)
#undef USE_USB_CDC_HID
#undef USE_USB_MSC
#endif
#if defined(USE_USB_CDC_HID) || defined(USE_USB_MSC)
#define USE_USB_ADVANCED_PROFILES
#endif
#if !defined(USE_OSD)
#undef USE_RX_LINK_QUALITY_INFO
#undef USE_OSD_PROFILES
#undef USE_OSD_STICK_OVERLAY
#undef USE_RX_LINK_UPLINK_POWER
#endif
// Older ACC/GYRO sensors use MPU6500 driver
#if !defined(USE_ACC_MPU6500) && (defined(USE_ACC_ICM20601) || defined(USE_ACC_ICM20602) || defined(USE_ACC_ICM20608G))
#define USE_ACC_MPU6500
#endif
#if !defined(USE_ACC_SPI_MPU6500) && (defined(USE_ACC_SPI_MPU9250) || defined(USE_ACC_SPI_ICM20601) || defined(USE_ACC_SPI_ICM20602) || defined(USE_ACC_SPI_ICM20608G))
#define USE_ACC_SPI_MPU6500
#endif
#if !defined(USE_GYRO_MPU6500) && (defined(USE_GYRO_ICM20601) || defined(USE_GYRO_ICM20602) || defined(USE_GYRO_ICM20608G))
#define USE_GYRO_MPU6500
#endif
#if !defined(USE_GYRO_SPI_MPU6500) && (defined(USE_GYRO_SPI_ICM20601) || defined(USE_GYRO_SPI_ICM20602) || defined(USE_GYRO_SPI_ICM20608G))
#define USE_GYRO_SPI_MPU6500
#endif
// Generate USE_SPI_GYRO or USE_I2C_GYRO
#if defined(USE_GYRO_L3G4200D) || defined(USE_GYRO_MPU3050) || defined(USE_GYRO_MPU6000) || defined(USE_GYRO_MPU6050) || defined(USE_GYRO_MPU6500)
#ifndef USE_I2C_GYRO
#define USE_I2C_GYRO
#endif
#endif
#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) || defined(USE_ACCGYRO_BMI160) || defined(USE_ACCGYRO_BMI270)
#ifndef USE_SPI_GYRO
#define USE_SPI_GYRO
#endif
#endif
#ifndef SIMULATOR_BUILD
#ifndef USE_ACC
#define USE_ACC
#endif
#ifndef USE_GYRO
#define USE_GYRO
#endif
#endif
// CX10 is a special case of SPI RX which requires XN297
#if defined(USE_RX_CX10)
#define USE_RX_XN297
#endif
// Setup crystal frequency on F4 for backward compatibility
// Should be set to zero for generic targets to ensure USB is working
// when unconfigured for targets with non-standard crystal.
// Can be set at runtime with with CLI parameter 'system_hse_mhz'.
#ifndef SYSTEM_HSE_MHZ
#define SYSTEM_HSE_MHZ 0
#endif
// Number of pins that needs pre-init
#ifdef USE_SPI
#ifndef SPI_PREINIT_COUNT
// 2 x 8 (GYROx2, BARO, MAG, MAX, FLASHx2, RX)
#define SPI_PREINIT_COUNT 16
#endif
#endif
#ifndef USE_BLACKBOX
#undef USE_USB_MSC
#endif
#if (!defined(USE_FLASHFS) || !defined(USE_RTC_TIME) || !defined(USE_USB_MSC) || !defined(USE_PERSISTENT_OBJECTS))
#undef USE_PERSISTENT_MSC_RTC
#endif
#if !defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER) && !defined(USE_SERIAL_4WAY_SK_BOOTLOADER)
#undef USE_SERIAL_4WAY_BLHELI_INTERFACE
#elif !defined(USE_SERIAL_4WAY_BLHELI_INTERFACE) && (defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER) || defined(USE_SERIAL_4WAY_SK_BOOTLOADER))
#ifndef USE_SERIAL_4WAY_BLHELI_INTERFACE
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
#endif
#endif
#if defined(USE_RX_PWM) || defined(USE_DSHOT) || defined(USE_LED_STRIP) || defined(USE_TRANSPONDER) || defined(USE_BEEPER) || defined(USE_SERIAL_4WAY_BLHELI_INTERFACE)
#ifndef USE_PWM_OUTPUT
#define USE_PWM_OUTPUT
#endif
#endif
#if !defined(USE_LED_STRIP)
#undef USE_LED_STRIP_STATUS_MODE
#endif
#if defined(USE_MAX7456) || defined(USE_FRSKYOSD) || defined(USE_MSP_DISPLAYPORT)
#ifndef USE_VIDEO_SYSTEM
#define USE_VIDEO_SYSTEM
#endif
#endif
#if defined(USE_LED_STRIP) && !defined(USE_LED_STRIP_STATUS_MODE)
#define USE_WS2811_SINGLE_COLOUR
#endif
#if defined(SIMULATOR_BUILD) || defined(UNIT_TEST)
// This feature uses 'arm_math.h', which does not exist for x86.
#undef USE_DYN_NOTCH_FILTER
#endif
#ifndef USE_CMS
#undef USE_CMS_FAILSAFE_MENU
#endif
#ifndef USE_DSHOT
#undef USE_DSHOT_TELEMETRY
#undef USE_DSHOT_BITBANG
#endif
#ifndef USE_DSHOT_TELEMETRY
#undef USE_RPM_FILTER
#undef USE_DSHOT_TELEMETRY_STATS
#undef USE_DYN_IDLE
#endif
#if !defined(USE_BOARD_INFO)
#undef USE_SIGNATURE
#endif
#if !defined(USE_ACC)
#undef USE_GPS_RESCUE
#undef USE_ACRO_TRAINER
#endif
#if (!defined(USE_GPS_RESCUE) || !defined(USE_CMS_FAILSAFE_MENU))
#undef USE_CMS_GPS_RESCUE_MENU
#endif
#ifndef USE_BEEPER
#undef BEEPER_PIN
#undef BEEPER_PWM_HZ
#endif
#if defined(USE_DMA_SPEC)
#define USE_TIMER_DMA
#else
#undef USE_TIMER_MGMT
#endif
#if defined(USE_TIMER_MGMT)
#undef USED_TIMERS
#endif
#if !defined(USE_RANGEFINDER)
#undef USE_RANGEFINDER_HCSR04
#undef USE_RANGEFINDER_SRF10
#undef USE_RANGEFINDER_HCSR04_I2C
#undef USE_RANGEFINDER_VL53L0X
#undef USE_RANGEFINDER_UIB
#undef USE_RANGEFINDER_TF
#endif
#ifndef USE_GPS_RESCUE
#undef USE_CMS_GPS_RESCUE_MENU
#endif
#if defined(CONFIG_IN_RAM) || defined(CONFIG_IN_FILE) || defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_SDCARD) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH)
#ifndef EEPROM_SIZE
#define EEPROM_SIZE 4096
#endif
extern uint8_t eepromData[EEPROM_SIZE];
#define __config_start (*eepromData)
#define __config_end (*ARRAYEND(eepromData))
#else
#ifndef CONFIG_IN_FLASH
#define CONFIG_IN_FLASH
#endif
extern uint8_t __config_start; // configured via linker script when building binaries.
extern uint8_t __config_end;
#endif
#if defined(USE_EXST) && !defined(RAMBASED)
#define USE_FLASH_BOOT_LOADER
#endif
#if defined(USE_FLASH_MEMORY_MAPPED)
#if !defined(USE_RAM_CODE)
#define USE_RAM_CODE
#endif
#define MMFLASH_CODE RAM_CODE
#define MMFLASH_CODE_NOINLINE RAM_CODE NOINLINE
#define MMFLASH_DATA FAST_DATA
#define MMFLASH_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
#else
#define MMFLASH_CODE
#define MMFLASH_CODE_NOINLINE
#define MMFLASH_DATA
#define MMFLASH_DATA_ZERO_INIT
#endif
#ifdef USE_RAM_CODE
// RAM_CODE for methods that need to be in RAM, but don't need to be in the fastest type of memory.
// Note: if code is marked as RAM_CODE it *MUST* be in RAM, there is no alternative unlike functions marked with FAST_CODE/CCM_CODE
#define RAM_CODE __attribute__((section(".ram_code")))
#endif
#ifndef USE_ITERM_RELAX
#undef USE_ABSOLUTE_CONTROL
#endif
#if defined(USE_RX_EXPRESSLRS)
// ELRS depends on CRSF telemetry
#if !defined(USE_TELEMETRY)
#define USE_TELEMETRY
#endif
#if !defined(USE_TELEMETRY_CRSF)
#define USE_TELEMETRY_CRSF
#endif
#if !defined(USE_CRSF_LINK_STATISTICS)
#define USE_CRSF_LINK_STATISTICS
#endif
#if !defined(USE_SERIALRX_CRSF)
#define USE_SERIALRX_CRSF
#endif
#endif
#if defined(USE_RX_SPI) || defined(USE_SERIALRX_SRXL2) || defined(USE_SERIALRX_CRSF)
#define USE_RX_BIND
#endif
#ifndef USE_GPS
#undef USE_GPS_PLUS_CODES
#undef USE_GPS_LAP_TIMER
#endif
#ifdef USE_GPS_LAP_TIMER
#define USE_CMS_GPS_LAP_TIMER_MENU
#endif
// Enable PINIO by default if any PIN is defined
#if !defined(USE_PINIO) && (defined(PINIO1_BOX) || defined(PINIO2_BOX) || defined(PINIO3_BOX) || defined(PINIO4_BOX))
#define USE_PINIO
#endif
#ifdef USE_PINIO
#ifndef USE_PINIOBOX
#define USE_PINIOBOX
#endif
#ifndef USE_PIN_PULL_UP_DOWN
#define USE_PIN_PULL_UP_DOWN
#endif
#endif // USE_PINIO