Fixed burst Dshot for pins that have no DMA available.
[betaflight.git] / src / main / platform.h
blob988e735706de84bbdcfa100d95a33b5cf3538471
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(STM32F722xx) || defined(STM32F745xx) || defined(STM32F746xx) || defined(STM32F765xx)
30 #include "stm32f7xx.h"
31 #include "stm32f7xx_hal.h"
32 #include "system_stm32f7xx.h"
34 #include "stm32f7xx_ll_spi.h"
35 #include "stm32f7xx_ll_gpio.h"
36 #include "stm32f7xx_ll_dma.h"
37 #include "stm32f7xx_ll_rcc.h"
38 #include "stm32f7xx_ll_bus.h"
39 #include "stm32f7xx_ll_tim.h"
40 #include "stm32f7xx_ll_system.h"
41 #include "drivers/stm32f7xx_ll_ex.h"
43 // Chip Unique ID on F7
44 #if defined(STM32F722xx)
45 #define U_ID_0 (*(uint32_t*)0x1ff07a10)
46 #define U_ID_1 (*(uint32_t*)0x1ff07a14)
47 #define U_ID_2 (*(uint32_t*)0x1ff07a18)
48 #else
49 #define U_ID_0 (*(uint32_t*)0x1ff0f420)
50 #define U_ID_1 (*(uint32_t*)0x1ff0f424)
51 #define U_ID_2 (*(uint32_t*)0x1ff0f428)
52 #endif
54 #ifndef STM32F7
55 #define STM32F7
56 #endif
58 #elif defined(STM32F40_41xxx) || defined (STM32F411xE) || defined (STM32F446xx)
60 #include "stm32f4xx.h"
62 // Chip Unique ID on F405
63 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
64 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
65 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
67 #ifndef STM32F4
68 #define STM32F4
69 #endif
71 #elif defined(STM32F303xC)
72 #include "stm32f30x_conf.h"
73 #include "stm32f30x_rcc.h"
74 #include "stm32f30x_gpio.h"
75 #include "core_cm4.h"
77 // Chip Unique ID on F303
78 #define U_ID_0 (*(uint32_t*)0x1FFFF7AC)
79 #define U_ID_1 (*(uint32_t*)0x1FFFF7B0)
80 #define U_ID_2 (*(uint32_t*)0x1FFFF7B4)
82 #ifndef STM32F3
83 #define STM32F3
84 #endif
86 #elif defined(STM32F10X)
88 #include "stm32f10x_conf.h"
89 #include "stm32f10x_gpio.h"
90 #include "core_cm3.h"
92 // Chip Unique ID on F103
93 #define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
94 #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
95 #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
97 #ifndef STM32F1
98 #define STM32F1
99 #endif
101 #elif defined(SIMULATOR_BUILD)
103 // Nop
105 #else // STM32F10X
106 #error "Invalid chipset specified. Update platform.h"
107 #endif
109 // MCU type names and IDs.
110 // IDs are permanent as it has dependency to configurator through MSP reporting
112 #if defined(SIMULATOR_BUILD)
113 #define MCU_TYPE_ID 0
114 #define MCU_TYPE_NAME "SIMULATOR"
115 #elif defined(STM32F1)
116 #define MCU_TYPE_ID 1
117 #define MCU_TYPE_NAME "F103"
118 #elif defined(STM32F3)
119 #define MCU_TYPE_ID 2
120 #define MCU_TYPE_NAME "F303"
121 #elif defined(STM32F40_41xxx)
122 #define MCU_TYPE_ID 3
123 #define MCU_TYPE_NAME "F40X"
124 #elif defined(STM32F411xE)
125 #define MCU_TYPE_ID 4
126 #define MCU_TYPE_NAME "F411"
127 #elif defined(STM32F446)
128 #define MCU_TYPE_ID 5
129 #define MCU_TYPE_NAME "F446"
130 #elif defined(STM32F722xx)
131 #define MCU_TYPE_ID 6
132 #define MCU_TYPE_NAME "F722"
133 #elif defined(STM32F745xx)
134 #define MCU_TYPE_ID 7
135 #define MCU_TYPE_NAME "F745"
136 #elif defined(STM32F746xx)
137 #define MCU_TYPE_ID 8
138 #define MCU_TYPE_NAME "F746"
139 #elif defined(STM32F765xx)
140 #define MCU_TYPE_ID 9
141 #define MCU_TYPE_NAME "F765"
142 #else
143 #define MCU_TYPE_ID 255
144 #define MCU_TYPE_NAME "Unknown MCU"
145 #endif
147 #include "target/common_pre.h"
148 #include "target.h"
149 #include "target/common_post.h"
150 #include "target/common_defaults_post.h"