Fix UARTS and LPUART
[betaflight.git] / src / main / target / STM32_UNIFIED / target.h
blob0b4f29659411656588c0d1e8eadb1ebb4ee884fb
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
23 #if defined(STM32F405)
24 #define TARGET_BOARD_IDENTIFIER "S405"
26 #define USBD_PRODUCT_STRING "Betaflight STM32F405"
28 #define USE_I2C_DEVICE_1
29 #define USE_I2C_DEVICE_2
30 #define USE_I2C_DEVICE_3
32 #define USE_UART1
33 #define USE_UART2
34 #define USE_UART3
35 #define USE_UART4
36 #define USE_UART5
37 #define USE_UART6
39 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 6)
41 #define USE_INVERTER
43 #define USE_SPI_DEVICE_1
44 #define USE_SPI_DEVICE_2
45 #define USE_SPI_DEVICE_3
47 #define TARGET_IO_PORTA 0xffff
48 #define TARGET_IO_PORTB 0xffff
49 #define TARGET_IO_PORTC 0xffff
50 #define TARGET_IO_PORTD 0xffff
51 #define TARGET_IO_PORTE 0xffff
52 #define TARGET_IO_PORTF 0xffff
54 #elif defined(STM32F411)
55 #define TARGET_BOARD_IDENTIFIER "S411"
57 #define USBD_PRODUCT_STRING "Betaflight STM32F411"
59 #define USE_I2C_DEVICE_1
60 #define USE_I2C_DEVICE_2
61 #define USE_I2C_DEVICE_3
63 #define USE_UART1
64 #define USE_UART2
65 #define USE_UART6
67 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 3)
69 #define USE_INVERTER
71 #define USE_SPI_DEVICE_1
72 #define USE_SPI_DEVICE_2
73 #define USE_SPI_DEVICE_3
75 #define TARGET_IO_PORTA 0xffff
76 #define TARGET_IO_PORTB 0xffff
77 #define TARGET_IO_PORTC 0xffff
78 #define TARGET_IO_PORTD 0xffff
79 #define TARGET_IO_PORTE 0xffff
81 #elif defined(STM32F7X2)
82 #define TARGET_BOARD_IDENTIFIER "S7X2"
84 #define USBD_PRODUCT_STRING "Betaflight STM32F7x2"
86 #define USE_I2C_DEVICE_1
87 #define USE_I2C_DEVICE_2
88 #define USE_I2C_DEVICE_3
90 #define USE_UART1
91 #define USE_UART2
92 #define USE_UART3
93 #define USE_UART4
94 #define USE_UART5
95 #define USE_UART6
97 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 6)
99 #define USE_SPI_DEVICE_1
100 #define USE_SPI_DEVICE_2
101 #define USE_SPI_DEVICE_3
103 #define TARGET_IO_PORTA 0xffff
104 #define TARGET_IO_PORTB 0xffff
105 #define TARGET_IO_PORTC 0xffff
106 #define TARGET_IO_PORTD 0xffff
107 #define TARGET_IO_PORTE 0xffff
108 #define TARGET_IO_PORTF 0xffff
110 #elif defined(STM32F745)
111 #define TARGET_BOARD_IDENTIFIER "S745"
113 #define USBD_PRODUCT_STRING "Betaflight STM32F745"
115 #define USE_I2C_DEVICE_1
116 #define USE_I2C_DEVICE_2
117 #define USE_I2C_DEVICE_3
118 #define USE_I2C_DEVICE_4
120 #define USE_UART1
121 #define USE_UART2
122 #define USE_UART3
123 #define USE_UART4
124 #define USE_UART5
125 #define USE_UART6
126 #define USE_UART7
127 #define USE_UART8
129 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 8)
131 #define USE_SPI_DEVICE_1
132 #define USE_SPI_DEVICE_2
133 #define USE_SPI_DEVICE_3
134 #define USE_SPI_DEVICE_4
136 #define TARGET_IO_PORTA 0xffff
137 #define TARGET_IO_PORTB 0xffff
138 #define TARGET_IO_PORTC 0xffff
139 #define TARGET_IO_PORTD 0xffff
140 #define TARGET_IO_PORTE 0xffff
141 #define TARGET_IO_PORTF 0xffff
143 #elif defined(STM32G47X)
144 #define TARGET_BOARD_IDENTIFIER "SG47"
146 #define USBD_PRODUCT_STRING "Betaflight STM32G47x"
148 #define USE_I2C_DEVICE_1
149 #define USE_I2C_DEVICE_2
150 #define USE_I2C_DEVICE_3
151 #define USE_I2C_DEVICE_4
153 #define USE_UART1
154 #define USE_UART2
155 #define USE_UART3
156 #define USE_UART4
157 #define USE_UART5
158 #define USE_LPUART1
160 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 6)
162 #define USE_SPI_DEVICE_1
163 #define USE_SPI_DEVICE_2
164 #define USE_SPI_DEVICE_3
165 #define USE_SPI_DEVICE_4
167 #define TARGET_IO_PORTA 0xffff
168 #define TARGET_IO_PORTB 0xffff
169 #define TARGET_IO_PORTC 0xffff
170 #define TARGET_IO_PORTD 0xffff
171 #define TARGET_IO_PORTE 0xffff
172 #define TARGET_IO_PORTF 0xffff
174 #elif defined(STM32H743)
175 #define TARGET_BOARD_IDENTIFIER "SH74"
177 #define USBD_PRODUCT_STRING "Betaflight STM32H743"
179 #define USE_I2C_DEVICE_1
180 #define USE_I2C_DEVICE_2
181 #define USE_I2C_DEVICE_3
182 #define USE_I2C_DEVICE_4
184 #define USE_UART1
185 #define USE_UART2
186 #define USE_UART3
187 #define USE_UART4
188 #define USE_UART5
189 #define USE_UART6
190 #define USE_UART7
191 #define USE_UART8
192 #define USE_LPUART1
194 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 9)
196 #define USE_SPI_DEVICE_1
197 #define USE_SPI_DEVICE_2
198 #define USE_SPI_DEVICE_3
199 #define USE_SPI_DEVICE_4
200 #define USE_SPI_DEVICE_5
201 #define USE_SPI_DEVICE_6
203 #define TARGET_IO_PORTA 0xffff
204 #define TARGET_IO_PORTB 0xffff
205 #define TARGET_IO_PORTC 0xffff
206 #define TARGET_IO_PORTD 0xffff
207 #define TARGET_IO_PORTE 0xffff
208 #define TARGET_IO_PORTF 0xffff
209 #define TARGET_IO_PORTG 0xffff
211 #elif !defined(UNIT_TEST)
213 #error "No resources defined for this Unified Target."
215 #endif
217 // Treat the target as unified, and expect manufacturer id / board name
218 // to be supplied when the board is configured for the first time
219 #define USE_UNIFIED_TARGET
221 #define USE_BEEPER
223 // MPU interrupt
224 #define USE_EXTI
225 #define USE_MPU_DATA_READY_SIGNAL
226 #define USE_GYRO_EXTI
228 #define USE_ACC
229 #define USE_GYRO
231 #define USE_ACC_MPU6500
232 #define USE_GYRO_MPU6500
233 #define USE_ACC_SPI_MPU6000
234 #define USE_GYRO_SPI_MPU6000
235 #define USE_ACC_SPI_MPU6500
236 #define USE_GYRO_SPI_MPU6500
237 #define USE_ACC_SPI_ICM20689
238 #define USE_GYRO_SPI_ICM20689
239 #define USE_ACCGYRO_LSM6DSO
240 #define USE_ACCGYRO_BMI270
242 #if !defined(STM32F411xE)
243 #define USE_GYRO_SPI_ICM42605
244 #define USE_GYRO_SPI_ICM42688P
245 #define USE_ACC_SPI_ICM42605
246 #define USE_ACC_SPI_ICM42688P
247 #endif
249 #define USE_MAG
250 #define USE_MAG_DATA_READY_SIGNAL
251 #define USE_MAG_HMC5883
252 #define USE_MAG_SPI_HMC5883
253 #define USE_MAG_QMC5883
254 #define USE_MAG_LIS3MDL
255 #define USE_MAG_AK8963
256 #define USE_MAG_MPU925X_AK8963
257 #define USE_MAG_SPI_AK8963
258 #define USE_MAG_AK8975
260 #define USE_BARO
261 #define USE_BARO_MS5611
262 #define USE_BARO_SPI_MS5611
263 #define USE_BARO_BMP280
264 #define USE_BARO_SPI_BMP280
265 #define USE_BARO_BMP388
266 #define USE_BARO_SPI_BMP388
267 #define USE_BARO_LPS
268 #define USE_BARO_SPI_LPS
269 #define USE_BARO_QMP6988
270 #define USE_BARO_SPI_QMP6988
271 #define USE_BARO_DPS310
272 #define USE_BARO_SPI_DPS310
274 #define USE_SDCARD
275 #define USE_SDCARD_SPI
276 #if !defined(STM32G4)
277 // G4 support needs fixing
278 #define USE_SDCARD_SDIO
279 #endif
281 #define USE_FLASHFS
282 #define USE_FLASH_TOOLS
283 #define USE_FLASH_M25P16
284 #define USE_FLASH_W25N01G // 1Gb NAND flash support
285 #define USE_FLASH_W25M // Stacked die support
286 #define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
287 #define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
289 #define USE_MAX7456
291 #define USE_SPI
292 #define SPI_FULL_RECONFIGURABILITY
294 #define USE_I2C
295 #define I2C_FULL_RECONFIGURABILITY
297 #define USE_VCP
299 #define USE_SOFTSERIAL1
300 #define USE_SOFTSERIAL2
302 #define UNIFIED_SERIAL_PORT_COUNT 3
304 #define USE_USB_DETECT
306 #define USE_ESCSERIAL
308 #define USE_ADC
310 #define USE_RX_SPI
312 #define USE_RX_FRSKY_SPI_D
313 #define USE_RX_FRSKY_SPI_X
314 #define USE_RX_SFHSS_SPI
315 #define USE_RX_REDPINE_SPI
316 #define USE_RX_FRSKY_SPI_TELEMETRY
317 #define USE_RX_CC2500_SPI_PA_LNA
318 #define USE_RX_CC2500_SPI_DIVERSITY
320 #define USE_RX_FLYSKY
321 #define USE_RX_FLYSKY_SPI_LED
323 #define USE_RX_SPEKTRUM
324 #define USE_RX_SPEKTRUM_TELEMETRY
326 #define USE_CUSTOM_DEFAULTS
328 // Additional drivers included for targets with > 512KB of flash
329 #if (TARGET_FLASH_SIZE > 512)
330 #define USE_ACC_MPU6050
331 #define USE_GYRO_MPU6050
333 #define USE_BARO_BMP085
335 #define USE_VTX_RTC6705
336 #define USE_VTX_RTC6705_SOFTSPI
338 #define USE_TRANSPONDER
340 #define USE_RANGEFINDER
341 #define USE_RANGEFINDER_HCSR04
342 #define USE_RANGEFINDER_TF
344 #define USE_RX_EXPRESSLRS
345 #define USE_RX_SX1280
346 #define USE_RX_SX127X
348 #endif