Cleanup of defines for motor protocols (#11993)
[betaflight.git] / src / main / platform.h
blob3b3e19dd441b0e19c37d80004e11d87f1bcf3e90
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 #define NOINLINE __attribute__((noinline))
25 #if !defined(UNIT_TEST) && !defined(SIMULATOR_BUILD) && !(USBD_DEBUG_LEVEL > 0)
26 #pragma GCC poison sprintf snprintf
27 #endif
29 #if defined(STM32G474xx)
30 #include "stm32g4xx.h"
31 #include "stm32g4xx_hal.h"
32 #include "system_stm32g4xx.h"
34 #include "stm32g4xx_ll_spi.h"
35 #include "stm32g4xx_ll_gpio.h"
36 #include "stm32g4xx_ll_dma.h"
37 #include "stm32g4xx_ll_rcc.h"
38 #include "stm32g4xx_ll_bus.h"
39 #include "stm32g4xx_ll_tim.h"
40 #include "stm32g4xx_ll_system.h"
41 #include "drivers/stm32g4xx_ll_ex.h"
43 // Chip Unique ID on G4
44 #define U_ID_0 (*(uint32_t*)UID_BASE)
45 #define U_ID_1 (*(uint32_t*)(UID_BASE + 4))
46 #define U_ID_2 (*(uint32_t*)(UID_BASE + 8))
48 #ifndef STM32G4
49 #define STM32G4
50 #endif
52 #elif defined(STM32H743xx) || defined(STM32H750xx) || defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H723xx) || defined(STM32H725xx) || defined(STM32H730xx)
53 #include "stm32h7xx.h"
54 #include "stm32h7xx_hal.h"
55 #include "system_stm32h7xx.h"
57 #include "stm32h7xx_ll_spi.h"
58 #include "stm32h7xx_ll_gpio.h"
59 #include "stm32h7xx_ll_dma.h"
60 #include "stm32h7xx_ll_rcc.h"
61 #include "stm32h7xx_ll_bus.h"
62 #include "stm32h7xx_ll_tim.h"
63 #include "stm32h7xx_ll_system.h"
64 #include "drivers/stm32h7xx_ll_ex.h"
66 // Chip Unique ID on H7
67 #define U_ID_0 (*(uint32_t*)UID_BASE)
68 #define U_ID_1 (*(uint32_t*)(UID_BASE + 4))
69 #define U_ID_2 (*(uint32_t*)(UID_BASE + 8))
71 #ifndef STM32H7
72 #define STM32H7
73 #endif
75 #elif defined(STM32F722xx) || defined(STM32F745xx) || defined(STM32F746xx) || defined(STM32F765xx)
76 #include "stm32f7xx.h"
77 #include "stm32f7xx_hal.h"
78 #include "system_stm32f7xx.h"
80 #include "stm32f7xx_ll_spi.h"
81 #include "stm32f7xx_ll_gpio.h"
82 #include "stm32f7xx_ll_dma.h"
83 #include "stm32f7xx_ll_rcc.h"
84 #include "stm32f7xx_ll_bus.h"
85 #include "stm32f7xx_ll_tim.h"
86 #include "stm32f7xx_ll_system.h"
87 #include "drivers/stm32f7xx_ll_ex.h"
89 // Chip Unique ID on F7
90 #define U_ID_0 (*(uint32_t*)UID_BASE)
91 #define U_ID_1 (*(uint32_t*)(UID_BASE + 4))
92 #define U_ID_2 (*(uint32_t*)(UID_BASE + 8))
94 #ifndef STM32F7
95 #define STM32F7
96 #endif
98 #elif defined(STM32F40_41xxx) || defined (STM32F411xE) || defined (STM32F446xx)
100 #include "stm32f4xx.h"
102 // Chip Unique ID on F405
103 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
104 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
105 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
107 #ifndef STM32F4
108 #define STM32F4
109 #endif
111 #elif defined(SIMULATOR_BUILD)
113 // Nop
115 #else
116 #error "Invalid chipset specified. Update platform.h"
117 #endif
119 #include "target/common_pre.h"
121 #ifdef __BOARD__
122 #include "board.h"
123 #endif
125 #include "target.h"
126 #include "target/common_post.h"
127 #include "target/common_defaults_post.h"