vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / target / common_post.h
blobfddd8b2a906789ff22e81e68102aa11afda78da6
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 // Touch up configuration
20 #pragma once
22 // Config storage in memory-mapped flash
23 extern uint8_t __config_start;
24 extern uint8_t __config_end;
26 // Backward compatibility for I2C OLED display
27 #if !defined(USE_I2C)
28 # undef USE_DASHBOARD
29 # undef USE_OLED_UG2864
30 #endif
33 // Make sure DEFAULT_I2C_BUS is valid
34 #ifndef DEFAULT_I2C_BUS
36 #if defined(USE_I2C_DEVICE_1)
37 #define DEFAULT_I2C_BUS BUS_I2C1
38 #elif defined(USE_I2C_DEVICE_2)
39 #define DEFAULT_I2C_BUS BUS_I2C2
40 #elif defined(USE_I2C_DEVICE_3)
41 #define DEFAULT_I2C_BUS BUS_I2C3
42 #elif defined(USE_I2C_DEVICE_4)
43 #define DEFAULT_I2C_BUS BUS_I2C4
44 #endif
46 #endif
48 // Airspeed sensors
49 #if defined(USE_PITOT) && defined(DEFAULT_I2C_BUS)
51 #ifndef PITOT_I2C_BUS
52 #define PITOT_I2C_BUS DEFAULT_I2C_BUS
53 #endif
55 #endif
57 // Temperature sensors
58 #if !defined(TEMPERATURE_I2C_BUS) && defined(DEFAULT_I2C_BUS)
59 #define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS
60 #endif
62 // Rangefinder sensors
63 #if !defined(RANGEFINDER_I2C_BUS) && defined(DEFAULT_I2C_BUS)
64 #define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS
65 #endif
67 // Enable MSP_DISPLAYPORT for F3 targets without builtin OSD,
68 // since it's used to display CMS on MWOSD
69 #if !defined(USE_MSP_DISPLAYPORT) && !defined(USE_OSD)
70 #define USE_MSP_DISPLAYPORT
71 #endif
73 #if defined(USE_OSD)
74 #define USE_CANVAS
75 #endif
77 // Enable MSP BARO & MAG drivers if BARO and MAG sensors are compiled in
78 #if defined(USE_MAG)
79 #define USE_MAG_MSP
81 #if defined(USE_MAG_ALL)
83 #define USE_MAG_HMC5883
84 #define USE_MAG_IST8310
85 #define USE_MAG_LIS3MDL
86 #define USE_MAG_MAG3110
87 #define USE_MAG_QMC5883
89 //#if (MCU_FLASH_SIZE > 512)
90 #define USE_MAG_AK8963
91 #define USE_MAG_AK8975
92 #define USE_MAG_IST8308
93 #define USE_MAG_MLX90393
95 #if defined(USE_IMU_MPU9250)
96 #define USE_MAG_MPU9250
97 #endif
99 #define USE_MAG_RM3100
100 #define USE_MAG_VCM5883
101 //#endif // MCU_FLASH_SIZE
103 #endif // USE_MAG_ALL
105 #if defined(DEFAULT_I2C_BUS) && !defined(MAG_I2C_BUS)
106 #define MAG_I2C_BUS DEFAULT_I2C_BUS
107 #endif
109 #endif // USE_MAG
111 #if defined(USE_BARO)
112 #define USE_BARO_MSP
114 #if defined(USE_BARO_ALL)
115 #define USE_BARO_BMP085
116 #define USE_BARO_BMP280
117 #define USE_BARO_BMP388
118 #define USE_BARO_DPS310
119 #define USE_BARO_LPS25H
120 #define USE_BARO_MS5607
121 #define USE_BARO_MS5611
122 //#define USE_BARO_SPI_BMP280
123 #define USE_BARO_SPL06
124 #endif
126 #if defined(DEFAULT_I2C_BUS) && !defined(BARO_I2C_BUS)
127 #define BARO_I2C_BUS DEFAULT_I2C_BUS
128 #endif
130 #endif
132 #ifdef USE_ESC_SENSOR
133 #define USE_RPM_FILTER
134 #endif
136 #ifndef BEEPER_PWM_FREQUENCY
137 #define BEEPER_PWM_FREQUENCY 2500
138 #endif
140 #define USE_ARM_MATH // try to use FPU functions
142 #if defined(SITL_BUILD) || defined(UNIT_TEST)
143 // This feature uses 'arm_math.h', which does not exist for x86.
144 #undef USE_DYNAMIC_FILTERS
145 #undef USE_ARM_MATH
146 #endif
148 #if defined(CONFIG_IN_RAM) || defined(CONFIG_IN_FILE) || defined(CONFIG_IN_EXTERNAL_FLASH)
149 #ifndef EEPROM_SIZE
150 #define EEPROM_SIZE 8192
151 #endif
152 extern uint8_t eepromData[EEPROM_SIZE];
153 #define __config_start (*eepromData)
154 #define __config_end (*ARRAYEND(eepromData))
155 #else
156 #ifndef CONFIG_IN_FLASH
157 #define CONFIG_IN_FLASH
158 #endif
159 extern uint8_t __config_start; // configured via linker script when building binaries.
160 extern uint8_t __config_end;
161 #endif