Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
board.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #pragma once
18 
19 /*
20  * Board identifier.
21  */
22 #define BOARD_PX4FMU
23 #define BOARD_NAME "Pixhawk PX4 FMU v 4.0"
24 
25 /*
26  * Board oscillators-related settings.
27  */
28 #if !defined(STM32_LSECLK)
29 #define STM32_LSECLK 0
30 #endif
31 
32 #if !defined(STM32_HSECLK)
33 #define STM32_HSECLK 24000000U
34 #endif
35 
36 /*
37  * Board voltages.
38  * Required for performance limits calculation.
39  */
40 #define STM32_VDD 300U
41 
42 /*
43  * MCU type as defined in the ST header.
44  */
45 #define STM32F427xx
46 
47 /*
48  * IO pins assignments.
49  */
50 #define USART4_TX 0U
51 #define USART4_RX 1U
52 #define VOLT_SENS 2U
53 #define CURRENT_SENS 3U
54 #define VDD_5V_SENS 4U
55 #define MPU9250_SCK 5U
56 #define MPU9250_MISO 6U
57 #define MPU9250_MOSI 7U
58 #define _8266_RTS 8U
59 #define USB_VBUS 9U
60 #define FRSKY_INV 10U
61 #define OTG_FS_DM 11U
62 #define OTG_FS_DP 12U
63 #define SWDIO 13U
64 #define SWCLK 14U
65 #define ALARM 15U
66 
67 #define _RC_INPUT 0U
68 #define LED_GREEN 1U
69 #define BOOT1 2U
70 #define LED_BLUE 3U
71 #define _8266_GPIO2 4U
72 #define VDD_BRICK_VALID 5U
73 #define USART1_TX 6U
74 #define USART1_RX 7U
75 #define I2C1_SCL 8U
76 #define I2C1_SDA 9U
77 #define FRAM_SCK 10U
78 #define LED_RED 11U
79 #define CAN2_RX 12U
80 #define CAN2_TX 13U
81 #define FRAM_MISO 14U
82 #define FRAM_MOSI 15U
83 
84 #define VBUS_VALID 0U
85 #define RSSI_IN 1U
86 #define MPU9250_CS 2U
87 #define LED_SAFETY 3U
88 #define SAFETY_SW_IN 4U
89 #define VDD_3V3_EN 5U
90 #define RC_OUTPUT 6U
91 #define RC_INPUT 7U
92 #define SDMMC1_D0 8U
93 #define SDMMC1_D1 9U
94 #define SDMMC1_D2 10U
95 #define SDMMC1_D3 11U
96 #define SDMMC1_CK 12U
97 #define SBUS_INV 13U
98 #define _20608_DRDY 14U
99 #define _20608_CS 15U
100 
101 #define CAN1_RX 0U
102 #define CAN1_TX 1U
103 #define SDMMC1_CMD 2U
104 #define USART2_CTS 3U
105 #define USART2_RTS 4U
106 #define USART2_TX 5U
107 #define USART2_RX 6U
108 #define BARO_CS 7U
109 #define USART3_TX 8U
110 #define USART3_RX 9U
111 #define FRAM_CS 10U
112 #define USART3_CTS 11U
113 #define USART3_RTS 12U
114 #define SRV5_TIM4_CH2 13U
115 #define SRV6_TIM4_CH3 14U
116 #define MPU9250_DRDY 15U
117 
118 #define UART8_RX 0U
119 #define UART8_TX 1U
120 #define _8266_GPIO0 2U
121 #define VDD_3V3_SENS_EN 3U
122 #define SPEKTRUM_POWER 4U
123 #define _8266_PD 5U
124 #define _8266_RST 6U
125 #define UART7_RX 7U
126 #define UART7_TX 8U
127 #define SRV4_TIM1_CH1 9U
128 #define _8266_CTS 10U
129 #define SRV3_TIM1_CH2 11U
130 #define HMC5983_DRDY 12U
131 #define SRV2_TIM1_CH3 13U
132 #define SRV1_TIM1_CH4 14U
133 #define HMC_5983 15U
134 
135 #define PF00 0U
136 #define PF01 1U
137 #define PF02 2U
138 #define PF03 3U
139 #define PF04 4U
140 #define PF05 5U
141 #define PF06 6U
142 #define PF07 7U
143 #define PF08 8U
144 #define PF09 9U
145 #define PF10 10U
146 #define PF11 11U
147 #define PF12 12U
148 #define PF13 13U
149 #define PF14 14U
150 #define PF15 15U
151 
152 #define PG00 0U
153 #define PG01 1U
154 #define PG02 2U
155 #define PG03 3U
156 #define PG04 4U
157 #define PG05 5U
158 #define PG06 6U
159 #define PG07 7U
160 #define PG08 8U
161 #define PG09 9U
162 #define PG10 10U
163 #define PG11 11U
164 #define PG12 12U
165 #define PG13 13U
166 #define PG14 14U
167 #define PG15 15U
168 
169 #define OSC_IN 0U
170 #define OSC_OUT 1U
171 #define PH02 2U
172 #define PH03 3U
173 #define PH04 4U
174 #define PH05 5U
175 #define PH06 6U
176 #define PH07 7U
177 #define PH08 8U
178 #define PH09 9U
179 #define PH10 10U
180 #define PH11 11U
181 #define PH12 12U
182 #define PH13 13U
183 #define PH14 14U
184 #define PH15 15U
185 
186 #define PI00 0U
187 #define PI01 1U
188 #define PI02 2U
189 #define PI03 3U
190 #define PI04 4U
191 #define PI05 5U
192 #define PI06 6U
193 #define PI07 7U
194 #define PI08 8U
195 #define PI09 9U
196 #define PI10 10U
197 #define PI11 11U
198 #define PI12 12U
199 #define PI13 13U
200 #define PI14 14U
201 #define PI15 15U
202 
203 #define PJ00 0U
204 #define PJ01 1U
205 #define PJ02 2U
206 #define PJ03 3U
207 #define PJ04 4U
208 #define PJ05 5U
209 #define PJ06 6U
210 #define PJ07 7U
211 #define PJ08 8U
212 #define PJ09 9U
213 #define PJ10 10U
214 #define PJ11 11U
215 #define PJ12 12U
216 #define PJ13 13U
217 #define PJ14 14U
218 #define PJ15 15U
219 
220 #define PK00 0U
221 #define PK01 1U
222 #define PK02 2U
223 #define PK03 3U
224 #define PK04 4U
225 #define PK05 5U
226 #define PK06 6U
227 #define PK07 7U
228 #define PK08 8U
229 #define PK09 9U
230 #define PK10 10U
231 #define PK11 11U
232 #define PK12 12U
233 #define PK13 13U
234 #define PK14 14U
235 #define PK15 15U
236 
237 /*
238  * IO lines assignments.
239  */
240 #define LINE_USART4_TX PAL_LINE(GPIOA, 0U)
241 #define LINE_USART4_RX PAL_LINE(GPIOA, 1U)
242 #define LINE_VOLT_SENS PAL_LINE(GPIOA, 2U)
243 #define LINE_CURRENT_SENS PAL_LINE(GPIOA, 3U)
244 #define LINE_VDD_5V_SENS PAL_LINE(GPIOA, 4U)
245 #define LINE_MPU9250_SCK PAL_LINE(GPIOA, 5U)
246 #define LINE_MPU9250_MISO PAL_LINE(GPIOA, 6U)
247 #define LINE_MPU9250_MOSI PAL_LINE(GPIOA, 7U)
248 #define LINE__8266_RTS PAL_LINE(GPIOA, 8U)
249 #define LINE_USB_VBUS PAL_LINE(GPIOA, 9U)
250 #define LINE_FRSKY_INV PAL_LINE(GPIOA, 10U)
251 #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
252 #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
253 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
254 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
255 #define LINE_ALARM PAL_LINE(GPIOA, 15U)
256 
257 #define LINE__RC_INPUT PAL_LINE(GPIOB, 0U)
258 #define LINE_LED_GREEN PAL_LINE(GPIOB, 1U)
259 #define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
260 #define LINE_LED_BLUE PAL_LINE(GPIOB, 3U)
261 #define LINE__8266_GPIO2 PAL_LINE(GPIOB, 4U)
262 #define LINE_VDD_BRICK_VALID PAL_LINE(GPIOB, 5U)
263 #define LINE_USART1_TX PAL_LINE(GPIOB, 6U)
264 #define LINE_USART1_RX PAL_LINE(GPIOB, 7U)
265 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
266 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 9U)
267 #define LINE_FRAM_SCK PAL_LINE(GPIOB, 10U)
268 #define LINE_LED_RED PAL_LINE(GPIOB, 11U)
269 #define LINE_CAN2_RX PAL_LINE(GPIOB, 12U)
270 #define LINE_CAN2_TX PAL_LINE(GPIOB, 13U)
271 #define LINE_FRAM_MISO PAL_LINE(GPIOB, 14U)
272 #define LINE_FRAM_MOSI PAL_LINE(GPIOB, 15U)
273 
274 #define LINE_VBUS_VALID PAL_LINE(GPIOC, 0U)
275 #define LINE_RSSI_IN PAL_LINE(GPIOC, 1U)
276 #define LINE_MPU9250_CS PAL_LINE(GPIOC, 2U)
277 #define LINE_LED_SAFETY PAL_LINE(GPIOC, 3U)
278 #define LINE_SAFETY_SW_IN PAL_LINE(GPIOC, 4U)
279 #define LINE_VDD_3V3_EN PAL_LINE(GPIOC, 5U)
280 #define LINE_RC_OUTPUT PAL_LINE(GPIOC, 6U)
281 #define LINE_RC_INPUT PAL_LINE(GPIOC, 7U)
282 #define LINE_SDMMC1_D0 PAL_LINE(GPIOC, 8U)
283 #define LINE_SDMMC1_D1 PAL_LINE(GPIOC, 9U)
284 #define LINE_SDMMC1_D2 PAL_LINE(GPIOC, 10U)
285 #define LINE_SDMMC1_D3 PAL_LINE(GPIOC, 11U)
286 #define LINE_SDMMC1_CK PAL_LINE(GPIOC, 12U)
287 #define LINE_SBUS_INV PAL_LINE(GPIOC, 13U)
288 #define LINE__20608_DRDY PAL_LINE(GPIOC, 14U)
289 #define LINE__20608_CS PAL_LINE(GPIOC, 15U)
290 
291 #define LINE_CAN1_RX PAL_LINE(GPIOD, 0U)
292 #define LINE_CAN1_TX PAL_LINE(GPIOD, 1U)
293 #define LINE_SDMMC1_CMD PAL_LINE(GPIOD, 2U)
294 #define LINE_USART2_CTS PAL_LINE(GPIOD, 3U)
295 #define LINE_USART2_RTS PAL_LINE(GPIOD, 4U)
296 #define LINE_USART2_TX PAL_LINE(GPIOD, 5U)
297 #define LINE_USART2_RX PAL_LINE(GPIOD, 6U)
298 #define LINE_BARO_CS PAL_LINE(GPIOD, 7U)
299 #define LINE_USART3_TX PAL_LINE(GPIOD, 8U)
300 #define LINE_USART3_RX PAL_LINE(GPIOD, 9U)
301 #define LINE_FRAM_CS PAL_LINE(GPIOD, 10U)
302 #define LINE_USART3_CTS PAL_LINE(GPIOD, 11U)
303 #define LINE_USART3_RTS PAL_LINE(GPIOD, 12U)
304 #define LINE_SRV5_TIM4_CH2 PAL_LINE(GPIOD, 13U)
305 #define LINE_SRV6_TIM4_CH3 PAL_LINE(GPIOD, 14U)
306 #define LINE_MPU9250_DRDY PAL_LINE(GPIOD, 15U)
307 
308 #define LINE_UART8_RX PAL_LINE(GPIOE, 0U)
309 #define LINE_UART8_TX PAL_LINE(GPIOE, 1U)
310 #define LINE__8266_GPIO0 PAL_LINE(GPIOE, 2U)
311 #define LINE_VDD_3V3_SENS_EN PAL_LINE(GPIOE, 3U)
312 #define LINE_SPEKTRUM_POWER PAL_LINE(GPIOE, 4U)
313 #define LINE__8266_PD PAL_LINE(GPIOE, 5U)
314 #define LINE__8266_RST PAL_LINE(GPIOE, 6U)
315 #define LINE_UART7_RX PAL_LINE(GPIOE, 7U)
316 #define LINE_UART7_TX PAL_LINE(GPIOE, 8U)
317 #define LINE_SRV4_TIM1_CH1 PAL_LINE(GPIOE, 9U)
318 #define LINE__8266_CTS PAL_LINE(GPIOE, 10U)
319 #define LINE_SRV3_TIM1_CH2 PAL_LINE(GPIOE, 11U)
320 #define LINE_HMC5983_DRDY PAL_LINE(GPIOE, 12U)
321 #define LINE_SRV2_TIM1_CH3 PAL_LINE(GPIOE, 13U)
322 #define LINE_SRV1_TIM1_CH4 PAL_LINE(GPIOE, 14U)
323 #define LINE_HMC_5983 PAL_LINE(GPIOE, 15U)
324 
325 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
326 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
327 
328 
329 /*
330  * I/O ports initial setup, this configuration is established soon after reset
331  * in the initialization code.
332  * Please refer to the STM32 Reference Manual for details.
333  */
334 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
335 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
336 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
337 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
338 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
339 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
340 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
341 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
342 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
343 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
344 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
345 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
346 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
347 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
348 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
349 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
350 
351 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(USART4_TX) | \
352  PIN_MODE_ALTERNATE(USART4_RX) | \
353  PIN_MODE_ANALOG(VOLT_SENS) | \
354  PIN_MODE_ANALOG(CURRENT_SENS) | \
355  PIN_MODE_ANALOG(VDD_5V_SENS) | \
356  PIN_MODE_ALTERNATE(MPU9250_SCK) | \
357  PIN_MODE_ALTERNATE(MPU9250_MISO) | \
358  PIN_MODE_ALTERNATE(MPU9250_MOSI) | \
359  PIN_MODE_INPUT(_8266_RTS) | \
360  PIN_MODE_INPUT(USB_VBUS) | \
361  PIN_MODE_OUTPUT(FRSKY_INV) | \
362  PIN_MODE_ALTERNATE(OTG_FS_DM) | \
363  PIN_MODE_ALTERNATE(OTG_FS_DP) | \
364  PIN_MODE_ALTERNATE(SWDIO) | \
365  PIN_MODE_ALTERNATE(SWCLK) | \
366  PIN_MODE_OUTPUT(ALARM))
367 
368 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(USART4_TX) | \
369  PIN_OTYPE_PUSHPULL(USART4_RX) | \
370  PIN_OTYPE_PUSHPULL(VOLT_SENS) | \
371  PIN_OTYPE_PUSHPULL(CURRENT_SENS) | \
372  PIN_OTYPE_PUSHPULL(VDD_5V_SENS) | \
373  PIN_OTYPE_PUSHPULL(MPU9250_SCK) | \
374  PIN_OTYPE_PUSHPULL(MPU9250_MISO) | \
375  PIN_OTYPE_PUSHPULL(MPU9250_MOSI) | \
376  PIN_OTYPE_OPENDRAIN(_8266_RTS) | \
377  PIN_OTYPE_OPENDRAIN(USB_VBUS) | \
378  PIN_OTYPE_PUSHPULL(FRSKY_INV) | \
379  PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
380  PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
381  PIN_OTYPE_PUSHPULL(SWDIO) | \
382  PIN_OTYPE_PUSHPULL(SWCLK) | \
383  PIN_OTYPE_PUSHPULL(ALARM))
384 
385 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(USART4_TX) | \
386  PIN_OSPEED_SPEED_HIGH(USART4_RX) | \
387  PIN_OSPEED_SPEED_VERYLOW(VOLT_SENS) | \
388  PIN_OSPEED_SPEED_VERYLOW(CURRENT_SENS) | \
389  PIN_OSPEED_SPEED_VERYLOW(VDD_5V_SENS) | \
390  PIN_OSPEED_SPEED_HIGH(MPU9250_SCK) | \
391  PIN_OSPEED_SPEED_HIGH(MPU9250_MISO) | \
392  PIN_OSPEED_SPEED_HIGH(MPU9250_MOSI) | \
393  PIN_OSPEED_SPEED_VERYLOW(_8266_RTS) | \
394  PIN_OSPEED_SPEED_VERYLOW(USB_VBUS) | \
395  PIN_OSPEED_SPEED_VERYLOW(FRSKY_INV) | \
396  PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
397  PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
398  PIN_OSPEED_SPEED_HIGH(SWDIO) | \
399  PIN_OSPEED_SPEED_HIGH(SWCLK) | \
400  PIN_OSPEED_SPEED_VERYLOW(ALARM))
401 
402 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(USART4_TX) | \
403  PIN_PUPDR_FLOATING(USART4_RX) | \
404  PIN_PUPDR_FLOATING(VOLT_SENS) | \
405  PIN_PUPDR_FLOATING(CURRENT_SENS) | \
406  PIN_PUPDR_FLOATING(VDD_5V_SENS) | \
407  PIN_PUPDR_FLOATING(MPU9250_SCK) | \
408  PIN_PUPDR_FLOATING(MPU9250_MISO) | \
409  PIN_PUPDR_FLOATING(MPU9250_MOSI) | \
410  PIN_PUPDR_PULLDOWN(_8266_RTS) | \
411  PIN_PUPDR_PULLDOWN(USB_VBUS) | \
412  PIN_PUPDR_FLOATING(FRSKY_INV) | \
413  PIN_PUPDR_FLOATING(OTG_FS_DM) | \
414  PIN_PUPDR_FLOATING(OTG_FS_DP) | \
415  PIN_PUPDR_FLOATING(SWDIO) | \
416  PIN_PUPDR_FLOATING(SWCLK) | \
417  PIN_PUPDR_FLOATING(ALARM))
418 
419 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_HIGH(USART4_TX) | \
420  PIN_ODR_LEVEL_HIGH(USART4_RX) | \
421  PIN_ODR_LEVEL_LOW(VOLT_SENS) | \
422  PIN_ODR_LEVEL_LOW(CURRENT_SENS) | \
423  PIN_ODR_LEVEL_LOW(VDD_5V_SENS) | \
424  PIN_ODR_LEVEL_HIGH(MPU9250_SCK) | \
425  PIN_ODR_LEVEL_HIGH(MPU9250_MISO) | \
426  PIN_ODR_LEVEL_HIGH(MPU9250_MOSI) | \
427  PIN_ODR_LEVEL_HIGH(_8266_RTS) | \
428  PIN_ODR_LEVEL_LOW(USB_VBUS) | \
429  PIN_ODR_LEVEL_HIGH(FRSKY_INV) | \
430  PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
431  PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
432  PIN_ODR_LEVEL_HIGH(SWDIO) | \
433  PIN_ODR_LEVEL_HIGH(SWCLK) | \
434  PIN_ODR_LEVEL_HIGH(ALARM))
435 
436 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(USART4_TX, 8) | \
437  PIN_AFIO_AF(USART4_RX, 8) | \
438  PIN_AFIO_AF(VOLT_SENS, 0) | \
439  PIN_AFIO_AF(CURRENT_SENS, 0) | \
440  PIN_AFIO_AF(VDD_5V_SENS, 0) | \
441  PIN_AFIO_AF(MPU9250_SCK, 5) | \
442  PIN_AFIO_AF(MPU9250_MISO, 5) | \
443  PIN_AFIO_AF(MPU9250_MOSI, 5))
444 
445 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(_8266_RTS, 0) | \
446  PIN_AFIO_AF(USB_VBUS, 0) | \
447  PIN_AFIO_AF(FRSKY_INV, 0) | \
448  PIN_AFIO_AF(OTG_FS_DM, 10) | \
449  PIN_AFIO_AF(OTG_FS_DP, 10) | \
450  PIN_AFIO_AF(SWDIO, 0) | \
451  PIN_AFIO_AF(SWCLK, 0) | \
452  PIN_AFIO_AF(ALARM, 0))
453 
454 #define VAL_GPIOB_MODER (PIN_MODE_INPUT(_RC_INPUT) | \
455  PIN_MODE_OUTPUT(LED_GREEN) | \
456  PIN_MODE_INPUT(BOOT1) | \
457  PIN_MODE_OUTPUT(LED_BLUE) | \
458  PIN_MODE_INPUT(_8266_GPIO2) | \
459  PIN_MODE_INPUT(VDD_BRICK_VALID) | \
460  PIN_MODE_ALTERNATE(USART1_TX) | \
461  PIN_MODE_ALTERNATE(USART1_RX) | \
462  PIN_MODE_ALTERNATE(I2C1_SCL) | \
463  PIN_MODE_ALTERNATE(I2C1_SDA) | \
464  PIN_MODE_ALTERNATE(FRAM_SCK) | \
465  PIN_MODE_OUTPUT(LED_RED) | \
466  PIN_MODE_ALTERNATE(CAN2_RX) | \
467  PIN_MODE_ALTERNATE(CAN2_TX) | \
468  PIN_MODE_ALTERNATE(FRAM_MISO) | \
469  PIN_MODE_ALTERNATE(FRAM_MOSI))
470 
471 #define VAL_GPIOB_OTYPER (PIN_OTYPE_OPENDRAIN(_RC_INPUT) | \
472  PIN_OTYPE_PUSHPULL(LED_GREEN) | \
473  PIN_OTYPE_OPENDRAIN(BOOT1) | \
474  PIN_OTYPE_PUSHPULL(LED_BLUE) | \
475  PIN_OTYPE_OPENDRAIN(_8266_GPIO2) | \
476  PIN_OTYPE_OPENDRAIN(VDD_BRICK_VALID) | \
477  PIN_OTYPE_PUSHPULL(USART1_TX) | \
478  PIN_OTYPE_PUSHPULL(USART1_RX) | \
479  PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
480  PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
481  PIN_OTYPE_PUSHPULL(FRAM_SCK) | \
482  PIN_OTYPE_PUSHPULL(LED_RED) | \
483  PIN_OTYPE_PUSHPULL(CAN2_RX) | \
484  PIN_OTYPE_PUSHPULL(CAN2_TX) | \
485  PIN_OTYPE_PUSHPULL(FRAM_MISO) | \
486  PIN_OTYPE_PUSHPULL(FRAM_MOSI))
487 
488 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(_RC_INPUT) | \
489  PIN_OSPEED_SPEED_VERYLOW(LED_GREEN) | \
490  PIN_OSPEED_SPEED_VERYLOW(BOOT1) | \
491  PIN_OSPEED_SPEED_VERYLOW(LED_BLUE) | \
492  PIN_OSPEED_SPEED_VERYLOW(_8266_GPIO2) | \
493  PIN_OSPEED_SPEED_VERYLOW(VDD_BRICK_VALID) | \
494  PIN_OSPEED_SPEED_HIGH(USART1_TX) | \
495  PIN_OSPEED_SPEED_HIGH(USART1_RX) | \
496  PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
497  PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
498  PIN_OSPEED_SPEED_HIGH(FRAM_SCK) | \
499  PIN_OSPEED_SPEED_VERYLOW(LED_RED) | \
500  PIN_OSPEED_SPEED_HIGH(CAN2_RX) | \
501  PIN_OSPEED_SPEED_HIGH(CAN2_TX) | \
502  PIN_OSPEED_SPEED_HIGH(FRAM_MISO) | \
503  PIN_OSPEED_SPEED_HIGH(FRAM_MOSI))
504 
505 #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLDOWN(_RC_INPUT) | \
506  PIN_PUPDR_FLOATING(LED_GREEN) | \
507  PIN_PUPDR_PULLDOWN(BOOT1) | \
508  PIN_PUPDR_FLOATING(LED_BLUE) | \
509  PIN_PUPDR_PULLDOWN(_8266_GPIO2) | \
510  PIN_PUPDR_PULLDOWN(VDD_BRICK_VALID) | \
511  PIN_PUPDR_FLOATING(USART1_TX) | \
512  PIN_PUPDR_FLOATING(USART1_RX) | \
513  PIN_PUPDR_PULLUP(I2C1_SCL) | \
514  PIN_PUPDR_PULLUP(I2C1_SDA) | \
515  PIN_PUPDR_FLOATING(FRAM_SCK) | \
516  PIN_PUPDR_FLOATING(LED_RED) | \
517  PIN_PUPDR_FLOATING(CAN2_RX) | \
518  PIN_PUPDR_FLOATING(CAN2_TX) | \
519  PIN_PUPDR_FLOATING(FRAM_MISO) | \
520  PIN_PUPDR_FLOATING(FRAM_MOSI))
521 
522 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_HIGH(_RC_INPUT) | \
523  PIN_ODR_LEVEL_LOW(LED_GREEN) | \
524  PIN_ODR_LEVEL_HIGH(BOOT1) | \
525  PIN_ODR_LEVEL_LOW(LED_BLUE) | \
526  PIN_ODR_LEVEL_HIGH(_8266_GPIO2) | \
527  PIN_ODR_LEVEL_HIGH(VDD_BRICK_VALID) | \
528  PIN_ODR_LEVEL_HIGH(USART1_TX) | \
529  PIN_ODR_LEVEL_HIGH(USART1_RX) | \
530  PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
531  PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
532  PIN_ODR_LEVEL_HIGH(FRAM_SCK) | \
533  PIN_ODR_LEVEL_LOW(LED_RED) | \
534  PIN_ODR_LEVEL_HIGH(CAN2_RX) | \
535  PIN_ODR_LEVEL_HIGH(CAN2_TX) | \
536  PIN_ODR_LEVEL_HIGH(FRAM_MISO) | \
537  PIN_ODR_LEVEL_HIGH(FRAM_MOSI))
538 
539 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(_RC_INPUT, 0) | \
540  PIN_AFIO_AF(LED_GREEN, 0) | \
541  PIN_AFIO_AF(BOOT1, 0) | \
542  PIN_AFIO_AF(LED_BLUE, 0) | \
543  PIN_AFIO_AF(_8266_GPIO2, 0) | \
544  PIN_AFIO_AF(VDD_BRICK_VALID, 0) | \
545  PIN_AFIO_AF(USART1_TX, 7) | \
546  PIN_AFIO_AF(USART1_RX, 7))
547 
548 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(I2C1_SCL, 4) | \
549  PIN_AFIO_AF(I2C1_SDA, 4) | \
550  PIN_AFIO_AF(FRAM_SCK, 5) | \
551  PIN_AFIO_AF(LED_RED, 0) | \
552  PIN_AFIO_AF(CAN2_RX, 9) | \
553  PIN_AFIO_AF(CAN2_TX, 9) | \
554  PIN_AFIO_AF(FRAM_MISO, 5) | \
555  PIN_AFIO_AF(FRAM_MOSI, 5))
556 
557 #define VAL_GPIOC_MODER (PIN_MODE_INPUT(VBUS_VALID) | \
558  PIN_MODE_INPUT(RSSI_IN) | \
559  PIN_MODE_OUTPUT(MPU9250_CS) | \
560  PIN_MODE_OUTPUT(LED_SAFETY) | \
561  PIN_MODE_INPUT(SAFETY_SW_IN) | \
562  PIN_MODE_OUTPUT(VDD_3V3_EN) | \
563  PIN_MODE_INPUT(RC_OUTPUT) | \
564  PIN_MODE_ALTERNATE(RC_INPUT) | \
565  PIN_MODE_ALTERNATE(SDMMC1_D0) | \
566  PIN_MODE_ALTERNATE(SDMMC1_D1) | \
567  PIN_MODE_ALTERNATE(SDMMC1_D2) | \
568  PIN_MODE_ALTERNATE(SDMMC1_D3) | \
569  PIN_MODE_ALTERNATE(SDMMC1_CK) | \
570  PIN_MODE_OUTPUT(SBUS_INV) | \
571  PIN_MODE_INPUT(_20608_DRDY) | \
572  PIN_MODE_OUTPUT(_20608_CS))
573 
574 #define VAL_GPIOC_OTYPER (PIN_OTYPE_OPENDRAIN(VBUS_VALID) | \
575  PIN_OTYPE_OPENDRAIN(RSSI_IN) | \
576  PIN_OTYPE_PUSHPULL(MPU9250_CS) | \
577  PIN_OTYPE_PUSHPULL(LED_SAFETY) | \
578  PIN_OTYPE_OPENDRAIN(SAFETY_SW_IN) | \
579  PIN_OTYPE_PUSHPULL(VDD_3V3_EN) | \
580  PIN_OTYPE_OPENDRAIN(RC_OUTPUT) | \
581  PIN_OTYPE_PUSHPULL(RC_INPUT) | \
582  PIN_OTYPE_PUSHPULL(SDMMC1_D0) | \
583  PIN_OTYPE_PUSHPULL(SDMMC1_D1) | \
584  PIN_OTYPE_PUSHPULL(SDMMC1_D2) | \
585  PIN_OTYPE_PUSHPULL(SDMMC1_D3) | \
586  PIN_OTYPE_PUSHPULL(SDMMC1_CK) | \
587  PIN_OTYPE_PUSHPULL(SBUS_INV) | \
588  PIN_OTYPE_OPENDRAIN(_20608_DRDY) | \
589  PIN_OTYPE_PUSHPULL(_20608_CS))
590 
591 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(VBUS_VALID) | \
592  PIN_OSPEED_SPEED_VERYLOW(RSSI_IN) | \
593  PIN_OSPEED_SPEED_HIGH(MPU9250_CS) | \
594  PIN_OSPEED_SPEED_VERYLOW(LED_SAFETY) | \
595  PIN_OSPEED_SPEED_VERYLOW(SAFETY_SW_IN) | \
596  PIN_OSPEED_SPEED_VERYLOW(VDD_3V3_EN) | \
597  PIN_OSPEED_SPEED_VERYLOW(RC_OUTPUT) | \
598  PIN_OSPEED_SPEED_HIGH(RC_INPUT) | \
599  PIN_OSPEED_SPEED_HIGH(SDMMC1_D0) | \
600  PIN_OSPEED_SPEED_HIGH(SDMMC1_D1) | \
601  PIN_OSPEED_SPEED_HIGH(SDMMC1_D2) | \
602  PIN_OSPEED_SPEED_HIGH(SDMMC1_D3) | \
603  PIN_OSPEED_SPEED_HIGH(SDMMC1_CK) | \
604  PIN_OSPEED_SPEED_VERYLOW(SBUS_INV) | \
605  PIN_OSPEED_SPEED_VERYLOW(_20608_DRDY) | \
606  PIN_OSPEED_SPEED_HIGH(_20608_CS))
607 
608 #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLDOWN(VBUS_VALID) | \
609  PIN_PUPDR_PULLDOWN(RSSI_IN) | \
610  PIN_PUPDR_FLOATING(MPU9250_CS) | \
611  PIN_PUPDR_FLOATING(LED_SAFETY) | \
612  PIN_PUPDR_FLOATING(SAFETY_SW_IN) | \
613  PIN_PUPDR_FLOATING(VDD_3V3_EN) | \
614  PIN_PUPDR_PULLDOWN(RC_OUTPUT) | \
615  PIN_PUPDR_FLOATING(RC_INPUT) | \
616  PIN_PUPDR_PULLUP(SDMMC1_D0) | \
617  PIN_PUPDR_PULLUP(SDMMC1_D1) | \
618  PIN_PUPDR_PULLUP(SDMMC1_D2) | \
619  PIN_PUPDR_PULLUP(SDMMC1_D3) | \
620  PIN_PUPDR_PULLUP(SDMMC1_CK) | \
621  PIN_PUPDR_FLOATING(SBUS_INV) | \
622  PIN_PUPDR_PULLDOWN(_20608_DRDY) | \
623  PIN_PUPDR_FLOATING(_20608_CS))
624 
625 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_HIGH(VBUS_VALID) | \
626  PIN_ODR_LEVEL_HIGH(RSSI_IN) | \
627  PIN_ODR_LEVEL_HIGH(MPU9250_CS) | \
628  PIN_ODR_LEVEL_LOW(LED_SAFETY) | \
629  PIN_ODR_LEVEL_LOW(SAFETY_SW_IN) | \
630  PIN_ODR_LEVEL_HIGH(VDD_3V3_EN) | \
631  PIN_ODR_LEVEL_HIGH(RC_OUTPUT) | \
632  PIN_ODR_LEVEL_HIGH(RC_INPUT) | \
633  PIN_ODR_LEVEL_HIGH(SDMMC1_D0) | \
634  PIN_ODR_LEVEL_HIGH(SDMMC1_D1) | \
635  PIN_ODR_LEVEL_HIGH(SDMMC1_D2) | \
636  PIN_ODR_LEVEL_HIGH(SDMMC1_D3) | \
637  PIN_ODR_LEVEL_HIGH(SDMMC1_CK) | \
638  PIN_ODR_LEVEL_HIGH(SBUS_INV) | \
639  PIN_ODR_LEVEL_HIGH(_20608_DRDY) | \
640  PIN_ODR_LEVEL_HIGH(_20608_CS))
641 
642 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(VBUS_VALID, 0) | \
643  PIN_AFIO_AF(RSSI_IN, 0) | \
644  PIN_AFIO_AF(MPU9250_CS, 0) | \
645  PIN_AFIO_AF(LED_SAFETY, 0) | \
646  PIN_AFIO_AF(SAFETY_SW_IN, 0) | \
647  PIN_AFIO_AF(VDD_3V3_EN, 0) | \
648  PIN_AFIO_AF(RC_OUTPUT, 0) | \
649  PIN_AFIO_AF(RC_INPUT, 8))
650 
651 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(SDMMC1_D0, 12) | \
652  PIN_AFIO_AF(SDMMC1_D1, 12) | \
653  PIN_AFIO_AF(SDMMC1_D2, 12) | \
654  PIN_AFIO_AF(SDMMC1_D3, 12) | \
655  PIN_AFIO_AF(SDMMC1_CK, 12) | \
656  PIN_AFIO_AF(SBUS_INV, 0) | \
657  PIN_AFIO_AF(_20608_DRDY, 0) | \
658  PIN_AFIO_AF(_20608_CS, 0))
659 
660 #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(CAN1_RX) | \
661  PIN_MODE_ALTERNATE(CAN1_TX) | \
662  PIN_MODE_ALTERNATE(SDMMC1_CMD) | \
663  PIN_MODE_INPUT(USART2_CTS) | \
664  PIN_MODE_INPUT(USART2_RTS) | \
665  PIN_MODE_ALTERNATE(USART2_TX) | \
666  PIN_MODE_ALTERNATE(USART2_RX) | \
667  PIN_MODE_OUTPUT(BARO_CS) | \
668  PIN_MODE_ALTERNATE(USART3_TX) | \
669  PIN_MODE_ALTERNATE(USART3_RX) | \
670  PIN_MODE_OUTPUT(FRAM_CS) | \
671  PIN_MODE_INPUT(USART3_CTS) | \
672  PIN_MODE_INPUT(USART3_RTS) | \
673  PIN_MODE_INPUT(SRV5_TIM4_CH2) | \
674  PIN_MODE_INPUT(SRV6_TIM4_CH3) | \
675  PIN_MODE_INPUT(MPU9250_DRDY))
676 
677 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(CAN1_RX) | \
678  PIN_OTYPE_PUSHPULL(CAN1_TX) | \
679  PIN_OTYPE_PUSHPULL(SDMMC1_CMD) | \
680  PIN_OTYPE_OPENDRAIN(USART2_CTS) | \
681  PIN_OTYPE_OPENDRAIN(USART2_RTS) | \
682  PIN_OTYPE_PUSHPULL(USART2_TX) | \
683  PIN_OTYPE_PUSHPULL(USART2_RX) | \
684  PIN_OTYPE_PUSHPULL(BARO_CS) | \
685  PIN_OTYPE_PUSHPULL(USART3_TX) | \
686  PIN_OTYPE_PUSHPULL(USART3_RX) | \
687  PIN_OTYPE_PUSHPULL(FRAM_CS) | \
688  PIN_OTYPE_OPENDRAIN(USART3_CTS) | \
689  PIN_OTYPE_OPENDRAIN(USART3_RTS) | \
690  PIN_OTYPE_OPENDRAIN(SRV5_TIM4_CH2) | \
691  PIN_OTYPE_OPENDRAIN(SRV6_TIM4_CH3) | \
692  PIN_OTYPE_OPENDRAIN(MPU9250_DRDY))
693 
694 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_HIGH(CAN1_RX) | \
695  PIN_OSPEED_SPEED_HIGH(CAN1_TX) | \
696  PIN_OSPEED_SPEED_HIGH(SDMMC1_CMD) | \
697  PIN_OSPEED_SPEED_VERYLOW(USART2_CTS) | \
698  PIN_OSPEED_SPEED_VERYLOW(USART2_RTS) | \
699  PIN_OSPEED_SPEED_HIGH(USART2_TX) | \
700  PIN_OSPEED_SPEED_HIGH(USART2_RX) | \
701  PIN_OSPEED_SPEED_HIGH(BARO_CS) | \
702  PIN_OSPEED_SPEED_HIGH(USART3_TX) | \
703  PIN_OSPEED_SPEED_HIGH(USART3_RX) | \
704  PIN_OSPEED_SPEED_HIGH(FRAM_CS) | \
705  PIN_OSPEED_SPEED_VERYLOW(USART3_CTS) | \
706  PIN_OSPEED_SPEED_VERYLOW(USART3_RTS) | \
707  PIN_OSPEED_SPEED_VERYLOW(SRV5_TIM4_CH2) | \
708  PIN_OSPEED_SPEED_VERYLOW(SRV6_TIM4_CH3) | \
709  PIN_OSPEED_SPEED_VERYLOW(MPU9250_DRDY))
710 
711 #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(CAN1_RX) | \
712  PIN_PUPDR_FLOATING(CAN1_TX) | \
713  PIN_PUPDR_PULLUP(SDMMC1_CMD) | \
714  PIN_PUPDR_PULLDOWN(USART2_CTS) | \
715  PIN_PUPDR_PULLDOWN(USART2_RTS) | \
716  PIN_PUPDR_FLOATING(USART2_TX) | \
717  PIN_PUPDR_FLOATING(USART2_RX) | \
718  PIN_PUPDR_FLOATING(BARO_CS) | \
719  PIN_PUPDR_FLOATING(USART3_TX) | \
720  PIN_PUPDR_FLOATING(USART3_RX) | \
721  PIN_PUPDR_FLOATING(FRAM_CS) | \
722  PIN_PUPDR_PULLDOWN(USART3_CTS) | \
723  PIN_PUPDR_PULLDOWN(USART3_RTS) | \
724  PIN_PUPDR_PULLDOWN(SRV5_TIM4_CH2) | \
725  PIN_PUPDR_PULLDOWN(SRV6_TIM4_CH3) | \
726  PIN_PUPDR_FLOATING(MPU9250_DRDY))
727 
728 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_HIGH(CAN1_RX) | \
729  PIN_ODR_LEVEL_HIGH(CAN1_TX) | \
730  PIN_ODR_LEVEL_HIGH(SDMMC1_CMD) | \
731  PIN_ODR_LEVEL_HIGH(USART2_CTS) | \
732  PIN_ODR_LEVEL_HIGH(USART2_RTS) | \
733  PIN_ODR_LEVEL_HIGH(USART2_TX) | \
734  PIN_ODR_LEVEL_HIGH(USART2_RX) | \
735  PIN_ODR_LEVEL_HIGH(BARO_CS) | \
736  PIN_ODR_LEVEL_HIGH(USART3_TX) | \
737  PIN_ODR_LEVEL_HIGH(USART3_RX) | \
738  PIN_ODR_LEVEL_HIGH(FRAM_CS) | \
739  PIN_ODR_LEVEL_HIGH(USART3_CTS) | \
740  PIN_ODR_LEVEL_HIGH(USART3_RTS) | \
741  PIN_ODR_LEVEL_HIGH(SRV5_TIM4_CH2) | \
742  PIN_ODR_LEVEL_HIGH(SRV6_TIM4_CH3) | \
743  PIN_ODR_LEVEL_LOW(MPU9250_DRDY))
744 
745 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(CAN1_RX, 9) | \
746  PIN_AFIO_AF(CAN1_TX, 9) | \
747  PIN_AFIO_AF(SDMMC1_CMD, 12) | \
748  PIN_AFIO_AF(USART2_CTS, 0) | \
749  PIN_AFIO_AF(USART2_RTS, 0) | \
750  PIN_AFIO_AF(USART2_TX, 7) | \
751  PIN_AFIO_AF(USART2_RX, 7) | \
752  PIN_AFIO_AF(BARO_CS, 0))
753 
754 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(USART3_TX, 7) | \
755  PIN_AFIO_AF(USART3_RX, 7) | \
756  PIN_AFIO_AF(FRAM_CS, 0) | \
757  PIN_AFIO_AF(USART3_CTS, 0) | \
758  PIN_AFIO_AF(USART3_RTS, 0) | \
759  PIN_AFIO_AF(SRV5_TIM4_CH2, 0) | \
760  PIN_AFIO_AF(SRV6_TIM4_CH3, 0) | \
761  PIN_AFIO_AF(MPU9250_DRDY, 0))
762 
763 #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(UART8_RX) | \
764  PIN_MODE_ALTERNATE(UART8_TX) | \
765  PIN_MODE_INPUT(_8266_GPIO0) | \
766  PIN_MODE_OUTPUT(VDD_3V3_SENS_EN) | \
767  PIN_MODE_OUTPUT(SPEKTRUM_POWER) | \
768  PIN_MODE_INPUT(_8266_PD) | \
769  PIN_MODE_INPUT(_8266_RST) | \
770  PIN_MODE_ALTERNATE(UART7_RX) | \
771  PIN_MODE_ALTERNATE(UART7_TX) | \
772  PIN_MODE_INPUT(SRV4_TIM1_CH1) | \
773  PIN_MODE_INPUT(_8266_CTS) | \
774  PIN_MODE_INPUT(SRV3_TIM1_CH2) | \
775  PIN_MODE_INPUT(HMC5983_DRDY) | \
776  PIN_MODE_INPUT(SRV2_TIM1_CH3) | \
777  PIN_MODE_INPUT(SRV1_TIM1_CH4) | \
778  PIN_MODE_OUTPUT(HMC_5983))
779 
780 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(UART8_RX) | \
781  PIN_OTYPE_PUSHPULL(UART8_TX) | \
782  PIN_OTYPE_OPENDRAIN(_8266_GPIO0) | \
783  PIN_OTYPE_PUSHPULL(VDD_3V3_SENS_EN) | \
784  PIN_OTYPE_PUSHPULL(SPEKTRUM_POWER) | \
785  PIN_OTYPE_OPENDRAIN(_8266_PD) | \
786  PIN_OTYPE_OPENDRAIN(_8266_RST) | \
787  PIN_OTYPE_PUSHPULL(UART7_RX) | \
788  PIN_OTYPE_PUSHPULL(UART7_TX) | \
789  PIN_OTYPE_OPENDRAIN(SRV4_TIM1_CH1) | \
790  PIN_OTYPE_OPENDRAIN(_8266_CTS) | \
791  PIN_OTYPE_OPENDRAIN(SRV3_TIM1_CH2) | \
792  PIN_OTYPE_OPENDRAIN(HMC5983_DRDY) | \
793  PIN_OTYPE_OPENDRAIN(SRV2_TIM1_CH3) | \
794  PIN_OTYPE_OPENDRAIN(SRV1_TIM1_CH4) | \
795  PIN_OTYPE_PUSHPULL(HMC_5983))
796 
797 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART8_RX) | \
798  PIN_OSPEED_SPEED_HIGH(UART8_TX) | \
799  PIN_OSPEED_SPEED_VERYLOW(_8266_GPIO0) | \
800  PIN_OSPEED_SPEED_VERYLOW(VDD_3V3_SENS_EN) | \
801  PIN_OSPEED_SPEED_VERYLOW(SPEKTRUM_POWER) | \
802  PIN_OSPEED_SPEED_VERYLOW(_8266_PD) | \
803  PIN_OSPEED_SPEED_VERYLOW(_8266_RST) | \
804  PIN_OSPEED_SPEED_HIGH(UART7_RX) | \
805  PIN_OSPEED_SPEED_HIGH(UART7_TX) | \
806  PIN_OSPEED_SPEED_VERYLOW(SRV4_TIM1_CH1) | \
807  PIN_OSPEED_SPEED_VERYLOW(_8266_CTS) | \
808  PIN_OSPEED_SPEED_VERYLOW(SRV3_TIM1_CH2) | \
809  PIN_OSPEED_SPEED_VERYLOW(HMC5983_DRDY) | \
810  PIN_OSPEED_SPEED_VERYLOW(SRV2_TIM1_CH3) | \
811  PIN_OSPEED_SPEED_VERYLOW(SRV1_TIM1_CH4) | \
812  PIN_OSPEED_SPEED_HIGH(HMC_5983))
813 
814 #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(UART8_RX) | \
815  PIN_PUPDR_FLOATING(UART8_TX) | \
816  PIN_PUPDR_PULLDOWN(_8266_GPIO0) | \
817  PIN_PUPDR_FLOATING(VDD_3V3_SENS_EN) | \
818  PIN_PUPDR_FLOATING(SPEKTRUM_POWER) | \
819  PIN_PUPDR_PULLDOWN(_8266_PD) | \
820  PIN_PUPDR_PULLDOWN(_8266_RST) | \
821  PIN_PUPDR_FLOATING(UART7_RX) | \
822  PIN_PUPDR_FLOATING(UART7_TX) | \
823  PIN_PUPDR_PULLDOWN(SRV4_TIM1_CH1) | \
824  PIN_PUPDR_PULLDOWN(_8266_CTS) | \
825  PIN_PUPDR_PULLDOWN(SRV3_TIM1_CH2) | \
826  PIN_PUPDR_FLOATING(HMC5983_DRDY) | \
827  PIN_PUPDR_PULLDOWN(SRV2_TIM1_CH3) | \
828  PIN_PUPDR_PULLDOWN(SRV1_TIM1_CH4) | \
829  PIN_PUPDR_FLOATING(HMC_5983))
830 
831 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_HIGH(UART8_RX) | \
832  PIN_ODR_LEVEL_HIGH(UART8_TX) | \
833  PIN_ODR_LEVEL_HIGH(_8266_GPIO0) | \
834  PIN_ODR_LEVEL_HIGH(VDD_3V3_SENS_EN) | \
835  PIN_ODR_LEVEL_HIGH(SPEKTRUM_POWER) | \
836  PIN_ODR_LEVEL_HIGH(_8266_PD) | \
837  PIN_ODR_LEVEL_HIGH(_8266_RST) | \
838  PIN_ODR_LEVEL_HIGH(UART7_RX) | \
839  PIN_ODR_LEVEL_HIGH(UART7_TX) | \
840  PIN_ODR_LEVEL_HIGH(SRV4_TIM1_CH1) | \
841  PIN_ODR_LEVEL_HIGH(_8266_CTS) | \
842  PIN_ODR_LEVEL_HIGH(SRV3_TIM1_CH2) | \
843  PIN_ODR_LEVEL_LOW(HMC5983_DRDY) | \
844  PIN_ODR_LEVEL_HIGH(SRV2_TIM1_CH3) | \
845  PIN_ODR_LEVEL_HIGH(SRV1_TIM1_CH4) | \
846  PIN_ODR_LEVEL_HIGH(HMC_5983))
847 
848 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(UART8_RX, 8) | \
849  PIN_AFIO_AF(UART8_TX, 8) | \
850  PIN_AFIO_AF(_8266_GPIO0, 0) | \
851  PIN_AFIO_AF(VDD_3V3_SENS_EN, 0) | \
852  PIN_AFIO_AF(SPEKTRUM_POWER, 0) | \
853  PIN_AFIO_AF(_8266_PD, 0) | \
854  PIN_AFIO_AF(_8266_RST, 0) | \
855  PIN_AFIO_AF(UART7_RX, 8))
856 
857 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(UART7_TX, 8) | \
858  PIN_AFIO_AF(SRV4_TIM1_CH1, 0) | \
859  PIN_AFIO_AF(_8266_CTS, 0) | \
860  PIN_AFIO_AF(SRV3_TIM1_CH2, 0) | \
861  PIN_AFIO_AF(HMC5983_DRDY, 0) | \
862  PIN_AFIO_AF(SRV2_TIM1_CH3, 0) | \
863  PIN_AFIO_AF(SRV1_TIM1_CH4, 0) | \
864  PIN_AFIO_AF(HMC_5983, 0))
865 
866 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
867  PIN_MODE_INPUT(PF01) | \
868  PIN_MODE_INPUT(PF02) | \
869  PIN_MODE_INPUT(PF03) | \
870  PIN_MODE_INPUT(PF04) | \
871  PIN_MODE_INPUT(PF05) | \
872  PIN_MODE_INPUT(PF06) | \
873  PIN_MODE_INPUT(PF07) | \
874  PIN_MODE_INPUT(PF08) | \
875  PIN_MODE_INPUT(PF09) | \
876  PIN_MODE_INPUT(PF10) | \
877  PIN_MODE_INPUT(PF11) | \
878  PIN_MODE_INPUT(PF12) | \
879  PIN_MODE_INPUT(PF13) | \
880  PIN_MODE_INPUT(PF14) | \
881  PIN_MODE_INPUT(PF15))
882 
883 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
884  PIN_OTYPE_PUSHPULL(PF01) | \
885  PIN_OTYPE_PUSHPULL(PF02) | \
886  PIN_OTYPE_PUSHPULL(PF03) | \
887  PIN_OTYPE_PUSHPULL(PF04) | \
888  PIN_OTYPE_PUSHPULL(PF05) | \
889  PIN_OTYPE_PUSHPULL(PF06) | \
890  PIN_OTYPE_PUSHPULL(PF07) | \
891  PIN_OTYPE_PUSHPULL(PF08) | \
892  PIN_OTYPE_PUSHPULL(PF09) | \
893  PIN_OTYPE_PUSHPULL(PF10) | \
894  PIN_OTYPE_PUSHPULL(PF11) | \
895  PIN_OTYPE_PUSHPULL(PF12) | \
896  PIN_OTYPE_PUSHPULL(PF13) | \
897  PIN_OTYPE_PUSHPULL(PF14) | \
898  PIN_OTYPE_PUSHPULL(PF15))
899 
900 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
901  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
902  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
903  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
904  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
905  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
906  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
907  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
908  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
909  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
910  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
911  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
912  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
913  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
914  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
915  PIN_OSPEED_SPEED_VERYLOW(PF15))
916 
917 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
918  PIN_PUPDR_PULLDOWN(PF01) | \
919  PIN_PUPDR_PULLDOWN(PF02) | \
920  PIN_PUPDR_PULLDOWN(PF03) | \
921  PIN_PUPDR_PULLDOWN(PF04) | \
922  PIN_PUPDR_PULLDOWN(PF05) | \
923  PIN_PUPDR_PULLDOWN(PF06) | \
924  PIN_PUPDR_PULLDOWN(PF07) | \
925  PIN_PUPDR_PULLDOWN(PF08) | \
926  PIN_PUPDR_PULLDOWN(PF09) | \
927  PIN_PUPDR_PULLDOWN(PF10) | \
928  PIN_PUPDR_PULLDOWN(PF11) | \
929  PIN_PUPDR_PULLDOWN(PF12) | \
930  PIN_PUPDR_PULLDOWN(PF13) | \
931  PIN_PUPDR_PULLDOWN(PF14) | \
932  PIN_PUPDR_PULLDOWN(PF15))
933 
934 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
935  PIN_ODR_LEVEL_LOW(PF01) | \
936  PIN_ODR_LEVEL_LOW(PF02) | \
937  PIN_ODR_LEVEL_LOW(PF03) | \
938  PIN_ODR_LEVEL_LOW(PF04) | \
939  PIN_ODR_LEVEL_LOW(PF05) | \
940  PIN_ODR_LEVEL_LOW(PF06) | \
941  PIN_ODR_LEVEL_LOW(PF07) | \
942  PIN_ODR_LEVEL_LOW(PF08) | \
943  PIN_ODR_LEVEL_LOW(PF09) | \
944  PIN_ODR_LEVEL_LOW(PF10) | \
945  PIN_ODR_LEVEL_LOW(PF11) | \
946  PIN_ODR_LEVEL_LOW(PF12) | \
947  PIN_ODR_LEVEL_LOW(PF13) | \
948  PIN_ODR_LEVEL_LOW(PF14) | \
949  PIN_ODR_LEVEL_LOW(PF15))
950 
951 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
952  PIN_AFIO_AF(PF01, 0) | \
953  PIN_AFIO_AF(PF02, 0) | \
954  PIN_AFIO_AF(PF03, 0) | \
955  PIN_AFIO_AF(PF04, 0) | \
956  PIN_AFIO_AF(PF05, 0) | \
957  PIN_AFIO_AF(PF06, 0) | \
958  PIN_AFIO_AF(PF07, 0))
959 
960 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
961  PIN_AFIO_AF(PF09, 0) | \
962  PIN_AFIO_AF(PF10, 0) | \
963  PIN_AFIO_AF(PF11, 0) | \
964  PIN_AFIO_AF(PF12, 0) | \
965  PIN_AFIO_AF(PF13, 0) | \
966  PIN_AFIO_AF(PF14, 0) | \
967  PIN_AFIO_AF(PF15, 0))
968 
969 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
970  PIN_MODE_INPUT(PG01) | \
971  PIN_MODE_INPUT(PG02) | \
972  PIN_MODE_INPUT(PG03) | \
973  PIN_MODE_INPUT(PG04) | \
974  PIN_MODE_INPUT(PG05) | \
975  PIN_MODE_INPUT(PG06) | \
976  PIN_MODE_INPUT(PG07) | \
977  PIN_MODE_INPUT(PG08) | \
978  PIN_MODE_INPUT(PG09) | \
979  PIN_MODE_INPUT(PG10) | \
980  PIN_MODE_INPUT(PG11) | \
981  PIN_MODE_INPUT(PG12) | \
982  PIN_MODE_INPUT(PG13) | \
983  PIN_MODE_INPUT(PG14) | \
984  PIN_MODE_INPUT(PG15))
985 
986 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
987  PIN_OTYPE_PUSHPULL(PG01) | \
988  PIN_OTYPE_PUSHPULL(PG02) | \
989  PIN_OTYPE_PUSHPULL(PG03) | \
990  PIN_OTYPE_PUSHPULL(PG04) | \
991  PIN_OTYPE_PUSHPULL(PG05) | \
992  PIN_OTYPE_PUSHPULL(PG06) | \
993  PIN_OTYPE_PUSHPULL(PG07) | \
994  PIN_OTYPE_PUSHPULL(PG08) | \
995  PIN_OTYPE_PUSHPULL(PG09) | \
996  PIN_OTYPE_PUSHPULL(PG10) | \
997  PIN_OTYPE_PUSHPULL(PG11) | \
998  PIN_OTYPE_PUSHPULL(PG12) | \
999  PIN_OTYPE_PUSHPULL(PG13) | \
1000  PIN_OTYPE_PUSHPULL(PG14) | \
1001  PIN_OTYPE_PUSHPULL(PG15))
1002 
1003 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
1004  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
1005  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
1006  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
1007  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
1008  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1009  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1010  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1011  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1012  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1013  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1014  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1015  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1016  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1017  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1018  PIN_OSPEED_SPEED_VERYLOW(PG15))
1019 
1020 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1021  PIN_PUPDR_PULLDOWN(PG01) | \
1022  PIN_PUPDR_PULLDOWN(PG02) | \
1023  PIN_PUPDR_PULLDOWN(PG03) | \
1024  PIN_PUPDR_PULLDOWN(PG04) | \
1025  PIN_PUPDR_PULLDOWN(PG05) | \
1026  PIN_PUPDR_PULLDOWN(PG06) | \
1027  PIN_PUPDR_PULLDOWN(PG07) | \
1028  PIN_PUPDR_PULLDOWN(PG08) | \
1029  PIN_PUPDR_PULLDOWN(PG09) | \
1030  PIN_PUPDR_PULLDOWN(PG10) | \
1031  PIN_PUPDR_PULLDOWN(PG11) | \
1032  PIN_PUPDR_PULLDOWN(PG12) | \
1033  PIN_PUPDR_PULLDOWN(PG13) | \
1034  PIN_PUPDR_PULLDOWN(PG14) | \
1035  PIN_PUPDR_PULLDOWN(PG15))
1036 
1037 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1038  PIN_ODR_LEVEL_LOW(PG01) | \
1039  PIN_ODR_LEVEL_LOW(PG02) | \
1040  PIN_ODR_LEVEL_LOW(PG03) | \
1041  PIN_ODR_LEVEL_LOW(PG04) | \
1042  PIN_ODR_LEVEL_LOW(PG05) | \
1043  PIN_ODR_LEVEL_LOW(PG06) | \
1044  PIN_ODR_LEVEL_LOW(PG07) | \
1045  PIN_ODR_LEVEL_LOW(PG08) | \
1046  PIN_ODR_LEVEL_LOW(PG09) | \
1047  PIN_ODR_LEVEL_LOW(PG10) | \
1048  PIN_ODR_LEVEL_LOW(PG11) | \
1049  PIN_ODR_LEVEL_LOW(PG12) | \
1050  PIN_ODR_LEVEL_LOW(PG13) | \
1051  PIN_ODR_LEVEL_LOW(PG14) | \
1052  PIN_ODR_LEVEL_LOW(PG15))
1053 
1054 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1055  PIN_AFIO_AF(PG01, 0) | \
1056  PIN_AFIO_AF(PG02, 0) | \
1057  PIN_AFIO_AF(PG03, 0) | \
1058  PIN_AFIO_AF(PG04, 0) | \
1059  PIN_AFIO_AF(PG05, 0) | \
1060  PIN_AFIO_AF(PG06, 0) | \
1061  PIN_AFIO_AF(PG07, 0))
1062 
1063 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1064  PIN_AFIO_AF(PG09, 0) | \
1065  PIN_AFIO_AF(PG10, 0) | \
1066  PIN_AFIO_AF(PG11, 0) | \
1067  PIN_AFIO_AF(PG12, 0) | \
1068  PIN_AFIO_AF(PG13, 0) | \
1069  PIN_AFIO_AF(PG14, 0) | \
1070  PIN_AFIO_AF(PG15, 0))
1071 
1072 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1073  PIN_MODE_ALTERNATE(OSC_OUT) | \
1074  PIN_MODE_INPUT(PH02) | \
1075  PIN_MODE_INPUT(PH03) | \
1076  PIN_MODE_INPUT(PH04) | \
1077  PIN_MODE_INPUT(PH05) | \
1078  PIN_MODE_INPUT(PH06) | \
1079  PIN_MODE_INPUT(PH07) | \
1080  PIN_MODE_INPUT(PH08) | \
1081  PIN_MODE_INPUT(PH09) | \
1082  PIN_MODE_INPUT(PH10) | \
1083  PIN_MODE_INPUT(PH11) | \
1084  PIN_MODE_INPUT(PH12) | \
1085  PIN_MODE_INPUT(PH13) | \
1086  PIN_MODE_INPUT(PH14) | \
1087  PIN_MODE_INPUT(PH15))
1088 
1089 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1090  PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1091  PIN_OTYPE_PUSHPULL(PH02) | \
1092  PIN_OTYPE_PUSHPULL(PH03) | \
1093  PIN_OTYPE_PUSHPULL(PH04) | \
1094  PIN_OTYPE_PUSHPULL(PH05) | \
1095  PIN_OTYPE_PUSHPULL(PH06) | \
1096  PIN_OTYPE_PUSHPULL(PH07) | \
1097  PIN_OTYPE_PUSHPULL(PH08) | \
1098  PIN_OTYPE_PUSHPULL(PH09) | \
1099  PIN_OTYPE_PUSHPULL(PH10) | \
1100  PIN_OTYPE_PUSHPULL(PH11) | \
1101  PIN_OTYPE_PUSHPULL(PH12) | \
1102  PIN_OTYPE_PUSHPULL(PH13) | \
1103  PIN_OTYPE_PUSHPULL(PH14) | \
1104  PIN_OTYPE_PUSHPULL(PH15))
1105 
1106 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1107  PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1108  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1109  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1110  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1111  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1112  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1113  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1114  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1115  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1116  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1117  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1118  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1119  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1120  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1121  PIN_OSPEED_SPEED_VERYLOW(PH15))
1122 
1123 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1124  PIN_PUPDR_FLOATING(OSC_OUT) | \
1125  PIN_PUPDR_PULLDOWN(PH02) | \
1126  PIN_PUPDR_PULLDOWN(PH03) | \
1127  PIN_PUPDR_PULLDOWN(PH04) | \
1128  PIN_PUPDR_PULLDOWN(PH05) | \
1129  PIN_PUPDR_PULLDOWN(PH06) | \
1130  PIN_PUPDR_PULLDOWN(PH07) | \
1131  PIN_PUPDR_PULLDOWN(PH08) | \
1132  PIN_PUPDR_PULLDOWN(PH09) | \
1133  PIN_PUPDR_PULLDOWN(PH10) | \
1134  PIN_PUPDR_PULLDOWN(PH11) | \
1135  PIN_PUPDR_PULLDOWN(PH12) | \
1136  PIN_PUPDR_PULLDOWN(PH13) | \
1137  PIN_PUPDR_PULLDOWN(PH14) | \
1138  PIN_PUPDR_PULLDOWN(PH15))
1139 
1140 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1141  PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1142  PIN_ODR_LEVEL_LOW(PH02) | \
1143  PIN_ODR_LEVEL_LOW(PH03) | \
1144  PIN_ODR_LEVEL_LOW(PH04) | \
1145  PIN_ODR_LEVEL_LOW(PH05) | \
1146  PIN_ODR_LEVEL_LOW(PH06) | \
1147  PIN_ODR_LEVEL_LOW(PH07) | \
1148  PIN_ODR_LEVEL_LOW(PH08) | \
1149  PIN_ODR_LEVEL_LOW(PH09) | \
1150  PIN_ODR_LEVEL_LOW(PH10) | \
1151  PIN_ODR_LEVEL_LOW(PH11) | \
1152  PIN_ODR_LEVEL_LOW(PH12) | \
1153  PIN_ODR_LEVEL_LOW(PH13) | \
1154  PIN_ODR_LEVEL_LOW(PH14) | \
1155  PIN_ODR_LEVEL_LOW(PH15))
1156 
1157 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1158  PIN_AFIO_AF(OSC_OUT, 0) | \
1159  PIN_AFIO_AF(PH02, 0) | \
1160  PIN_AFIO_AF(PH03, 0) | \
1161  PIN_AFIO_AF(PH04, 0) | \
1162  PIN_AFIO_AF(PH05, 0) | \
1163  PIN_AFIO_AF(PH06, 0) | \
1164  PIN_AFIO_AF(PH07, 0))
1165 
1166 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1167  PIN_AFIO_AF(PH09, 0) | \
1168  PIN_AFIO_AF(PH10, 0) | \
1169  PIN_AFIO_AF(PH11, 0) | \
1170  PIN_AFIO_AF(PH12, 0) | \
1171  PIN_AFIO_AF(PH13, 0) | \
1172  PIN_AFIO_AF(PH14, 0) | \
1173  PIN_AFIO_AF(PH15, 0))
1174 
1175 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1176  PIN_MODE_INPUT(PI01) | \
1177  PIN_MODE_INPUT(PI02) | \
1178  PIN_MODE_INPUT(PI03) | \
1179  PIN_MODE_INPUT(PI04) | \
1180  PIN_MODE_INPUT(PI05) | \
1181  PIN_MODE_INPUT(PI06) | \
1182  PIN_MODE_INPUT(PI07) | \
1183  PIN_MODE_INPUT(PI08) | \
1184  PIN_MODE_INPUT(PI09) | \
1185  PIN_MODE_INPUT(PI10) | \
1186  PIN_MODE_INPUT(PI11) | \
1187  PIN_MODE_INPUT(PI12) | \
1188  PIN_MODE_INPUT(PI13) | \
1189  PIN_MODE_INPUT(PI14) | \
1190  PIN_MODE_INPUT(PI15))
1191 
1192 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1193  PIN_OTYPE_PUSHPULL(PI01) | \
1194  PIN_OTYPE_PUSHPULL(PI02) | \
1195  PIN_OTYPE_PUSHPULL(PI03) | \
1196  PIN_OTYPE_PUSHPULL(PI04) | \
1197  PIN_OTYPE_PUSHPULL(PI05) | \
1198  PIN_OTYPE_PUSHPULL(PI06) | \
1199  PIN_OTYPE_PUSHPULL(PI07) | \
1200  PIN_OTYPE_PUSHPULL(PI08) | \
1201  PIN_OTYPE_PUSHPULL(PI09) | \
1202  PIN_OTYPE_PUSHPULL(PI10) | \
1203  PIN_OTYPE_PUSHPULL(PI11) | \
1204  PIN_OTYPE_PUSHPULL(PI12) | \
1205  PIN_OTYPE_PUSHPULL(PI13) | \
1206  PIN_OTYPE_PUSHPULL(PI14) | \
1207  PIN_OTYPE_PUSHPULL(PI15))
1208 
1209 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1210  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1211  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1212  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1213  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1214  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1215  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1216  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1217  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1218  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1219  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1220  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1221  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1222  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1223  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1224  PIN_OSPEED_SPEED_VERYLOW(PI15))
1225 
1226 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1227  PIN_PUPDR_PULLDOWN(PI01) | \
1228  PIN_PUPDR_PULLDOWN(PI02) | \
1229  PIN_PUPDR_PULLDOWN(PI03) | \
1230  PIN_PUPDR_PULLDOWN(PI04) | \
1231  PIN_PUPDR_PULLDOWN(PI05) | \
1232  PIN_PUPDR_PULLDOWN(PI06) | \
1233  PIN_PUPDR_PULLDOWN(PI07) | \
1234  PIN_PUPDR_PULLDOWN(PI08) | \
1235  PIN_PUPDR_PULLDOWN(PI09) | \
1236  PIN_PUPDR_PULLDOWN(PI10) | \
1237  PIN_PUPDR_PULLDOWN(PI11) | \
1238  PIN_PUPDR_PULLDOWN(PI12) | \
1239  PIN_PUPDR_PULLDOWN(PI13) | \
1240  PIN_PUPDR_PULLDOWN(PI14) | \
1241  PIN_PUPDR_PULLDOWN(PI15))
1242 
1243 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1244  PIN_ODR_LEVEL_LOW(PI01) | \
1245  PIN_ODR_LEVEL_LOW(PI02) | \
1246  PIN_ODR_LEVEL_LOW(PI03) | \
1247  PIN_ODR_LEVEL_LOW(PI04) | \
1248  PIN_ODR_LEVEL_LOW(PI05) | \
1249  PIN_ODR_LEVEL_LOW(PI06) | \
1250  PIN_ODR_LEVEL_LOW(PI07) | \
1251  PIN_ODR_LEVEL_LOW(PI08) | \
1252  PIN_ODR_LEVEL_LOW(PI09) | \
1253  PIN_ODR_LEVEL_LOW(PI10) | \
1254  PIN_ODR_LEVEL_LOW(PI11) | \
1255  PIN_ODR_LEVEL_LOW(PI12) | \
1256  PIN_ODR_LEVEL_LOW(PI13) | \
1257  PIN_ODR_LEVEL_LOW(PI14) | \
1258  PIN_ODR_LEVEL_LOW(PI15))
1259 
1260 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1261  PIN_AFIO_AF(PI01, 0) | \
1262  PIN_AFIO_AF(PI02, 0) | \
1263  PIN_AFIO_AF(PI03, 0) | \
1264  PIN_AFIO_AF(PI04, 0) | \
1265  PIN_AFIO_AF(PI05, 0) | \
1266  PIN_AFIO_AF(PI06, 0) | \
1267  PIN_AFIO_AF(PI07, 0))
1268 
1269 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1270  PIN_AFIO_AF(PI09, 0) | \
1271  PIN_AFIO_AF(PI10, 0) | \
1272  PIN_AFIO_AF(PI11, 0) | \
1273  PIN_AFIO_AF(PI12, 0) | \
1274  PIN_AFIO_AF(PI13, 0) | \
1275  PIN_AFIO_AF(PI14, 0) | \
1276  PIN_AFIO_AF(PI15, 0))
1277 
1278 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1279  PIN_MODE_INPUT(PJ01) | \
1280  PIN_MODE_INPUT(PJ02) | \
1281  PIN_MODE_INPUT(PJ03) | \
1282  PIN_MODE_INPUT(PJ04) | \
1283  PIN_MODE_INPUT(PJ05) | \
1284  PIN_MODE_INPUT(PJ06) | \
1285  PIN_MODE_INPUT(PJ07) | \
1286  PIN_MODE_INPUT(PJ08) | \
1287  PIN_MODE_INPUT(PJ09) | \
1288  PIN_MODE_INPUT(PJ10) | \
1289  PIN_MODE_INPUT(PJ11) | \
1290  PIN_MODE_INPUT(PJ12) | \
1291  PIN_MODE_INPUT(PJ13) | \
1292  PIN_MODE_INPUT(PJ14) | \
1293  PIN_MODE_INPUT(PJ15))
1294 
1295 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1296  PIN_OTYPE_PUSHPULL(PJ01) | \
1297  PIN_OTYPE_PUSHPULL(PJ02) | \
1298  PIN_OTYPE_PUSHPULL(PJ03) | \
1299  PIN_OTYPE_PUSHPULL(PJ04) | \
1300  PIN_OTYPE_PUSHPULL(PJ05) | \
1301  PIN_OTYPE_PUSHPULL(PJ06) | \
1302  PIN_OTYPE_PUSHPULL(PJ07) | \
1303  PIN_OTYPE_PUSHPULL(PJ08) | \
1304  PIN_OTYPE_PUSHPULL(PJ09) | \
1305  PIN_OTYPE_PUSHPULL(PJ10) | \
1306  PIN_OTYPE_PUSHPULL(PJ11) | \
1307  PIN_OTYPE_PUSHPULL(PJ12) | \
1308  PIN_OTYPE_PUSHPULL(PJ13) | \
1309  PIN_OTYPE_PUSHPULL(PJ14) | \
1310  PIN_OTYPE_PUSHPULL(PJ15))
1311 
1312 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1313  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1314  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1315  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1316  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1317  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1318  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1319  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1320  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1321  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1322  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1323  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1324  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1325  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1326  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1327  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1328 
1329 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1330  PIN_PUPDR_PULLDOWN(PJ01) | \
1331  PIN_PUPDR_PULLDOWN(PJ02) | \
1332  PIN_PUPDR_PULLDOWN(PJ03) | \
1333  PIN_PUPDR_PULLDOWN(PJ04) | \
1334  PIN_PUPDR_PULLDOWN(PJ05) | \
1335  PIN_PUPDR_PULLDOWN(PJ06) | \
1336  PIN_PUPDR_PULLDOWN(PJ07) | \
1337  PIN_PUPDR_PULLDOWN(PJ08) | \
1338  PIN_PUPDR_PULLDOWN(PJ09) | \
1339  PIN_PUPDR_PULLDOWN(PJ10) | \
1340  PIN_PUPDR_PULLDOWN(PJ11) | \
1341  PIN_PUPDR_PULLDOWN(PJ12) | \
1342  PIN_PUPDR_PULLDOWN(PJ13) | \
1343  PIN_PUPDR_PULLDOWN(PJ14) | \
1344  PIN_PUPDR_PULLDOWN(PJ15))
1345 
1346 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1347  PIN_ODR_LEVEL_LOW(PJ01) | \
1348  PIN_ODR_LEVEL_LOW(PJ02) | \
1349  PIN_ODR_LEVEL_LOW(PJ03) | \
1350  PIN_ODR_LEVEL_LOW(PJ04) | \
1351  PIN_ODR_LEVEL_LOW(PJ05) | \
1352  PIN_ODR_LEVEL_LOW(PJ06) | \
1353  PIN_ODR_LEVEL_LOW(PJ07) | \
1354  PIN_ODR_LEVEL_LOW(PJ08) | \
1355  PIN_ODR_LEVEL_LOW(PJ09) | \
1356  PIN_ODR_LEVEL_LOW(PJ10) | \
1357  PIN_ODR_LEVEL_LOW(PJ11) | \
1358  PIN_ODR_LEVEL_LOW(PJ12) | \
1359  PIN_ODR_LEVEL_LOW(PJ13) | \
1360  PIN_ODR_LEVEL_LOW(PJ14) | \
1361  PIN_ODR_LEVEL_LOW(PJ15))
1362 
1363 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1364  PIN_AFIO_AF(PJ01, 0) | \
1365  PIN_AFIO_AF(PJ02, 0) | \
1366  PIN_AFIO_AF(PJ03, 0) | \
1367  PIN_AFIO_AF(PJ04, 0) | \
1368  PIN_AFIO_AF(PJ05, 0) | \
1369  PIN_AFIO_AF(PJ06, 0) | \
1370  PIN_AFIO_AF(PJ07, 0))
1371 
1372 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1373  PIN_AFIO_AF(PJ09, 0) | \
1374  PIN_AFIO_AF(PJ10, 0) | \
1375  PIN_AFIO_AF(PJ11, 0) | \
1376  PIN_AFIO_AF(PJ12, 0) | \
1377  PIN_AFIO_AF(PJ13, 0) | \
1378  PIN_AFIO_AF(PJ14, 0) | \
1379  PIN_AFIO_AF(PJ15, 0))
1380 
1381 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1382  PIN_MODE_INPUT(PK01) | \
1383  PIN_MODE_INPUT(PK02) | \
1384  PIN_MODE_INPUT(PK03) | \
1385  PIN_MODE_INPUT(PK04) | \
1386  PIN_MODE_INPUT(PK05) | \
1387  PIN_MODE_INPUT(PK06) | \
1388  PIN_MODE_INPUT(PK07) | \
1389  PIN_MODE_INPUT(PK08) | \
1390  PIN_MODE_INPUT(PK09) | \
1391  PIN_MODE_INPUT(PK10) | \
1392  PIN_MODE_INPUT(PK11) | \
1393  PIN_MODE_INPUT(PK12) | \
1394  PIN_MODE_INPUT(PK13) | \
1395  PIN_MODE_INPUT(PK14) | \
1396  PIN_MODE_INPUT(PK15))
1397 
1398 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1399  PIN_OTYPE_PUSHPULL(PK01) | \
1400  PIN_OTYPE_PUSHPULL(PK02) | \
1401  PIN_OTYPE_PUSHPULL(PK03) | \
1402  PIN_OTYPE_PUSHPULL(PK04) | \
1403  PIN_OTYPE_PUSHPULL(PK05) | \
1404  PIN_OTYPE_PUSHPULL(PK06) | \
1405  PIN_OTYPE_PUSHPULL(PK07) | \
1406  PIN_OTYPE_PUSHPULL(PK08) | \
1407  PIN_OTYPE_PUSHPULL(PK09) | \
1408  PIN_OTYPE_PUSHPULL(PK10) | \
1409  PIN_OTYPE_PUSHPULL(PK11) | \
1410  PIN_OTYPE_PUSHPULL(PK12) | \
1411  PIN_OTYPE_PUSHPULL(PK13) | \
1412  PIN_OTYPE_PUSHPULL(PK14) | \
1413  PIN_OTYPE_PUSHPULL(PK15))
1414 
1415 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1416  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1417  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1418  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1419  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1420  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1421  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1422  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1423  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1424  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1425  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1426  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1427  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1428  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1429  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1430  PIN_OSPEED_SPEED_VERYLOW(PK15))
1431 
1432 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1433  PIN_PUPDR_PULLDOWN(PK01) | \
1434  PIN_PUPDR_PULLDOWN(PK02) | \
1435  PIN_PUPDR_PULLDOWN(PK03) | \
1436  PIN_PUPDR_PULLDOWN(PK04) | \
1437  PIN_PUPDR_PULLDOWN(PK05) | \
1438  PIN_PUPDR_PULLDOWN(PK06) | \
1439  PIN_PUPDR_PULLDOWN(PK07) | \
1440  PIN_PUPDR_PULLDOWN(PK08) | \
1441  PIN_PUPDR_PULLDOWN(PK09) | \
1442  PIN_PUPDR_PULLDOWN(PK10) | \
1443  PIN_PUPDR_PULLDOWN(PK11) | \
1444  PIN_PUPDR_PULLDOWN(PK12) | \
1445  PIN_PUPDR_PULLDOWN(PK13) | \
1446  PIN_PUPDR_PULLDOWN(PK14) | \
1447  PIN_PUPDR_PULLDOWN(PK15))
1448 
1449 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1450  PIN_ODR_LEVEL_LOW(PK01) | \
1451  PIN_ODR_LEVEL_LOW(PK02) | \
1452  PIN_ODR_LEVEL_LOW(PK03) | \
1453  PIN_ODR_LEVEL_LOW(PK04) | \
1454  PIN_ODR_LEVEL_LOW(PK05) | \
1455  PIN_ODR_LEVEL_LOW(PK06) | \
1456  PIN_ODR_LEVEL_LOW(PK07) | \
1457  PIN_ODR_LEVEL_LOW(PK08) | \
1458  PIN_ODR_LEVEL_LOW(PK09) | \
1459  PIN_ODR_LEVEL_LOW(PK10) | \
1460  PIN_ODR_LEVEL_LOW(PK11) | \
1461  PIN_ODR_LEVEL_LOW(PK12) | \
1462  PIN_ODR_LEVEL_LOW(PK13) | \
1463  PIN_ODR_LEVEL_LOW(PK14) | \
1464  PIN_ODR_LEVEL_LOW(PK15))
1465 
1466 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1467  PIN_AFIO_AF(PK01, 0) | \
1468  PIN_AFIO_AF(PK02, 0) | \
1469  PIN_AFIO_AF(PK03, 0) | \
1470  PIN_AFIO_AF(PK04, 0) | \
1471  PIN_AFIO_AF(PK05, 0) | \
1472  PIN_AFIO_AF(PK06, 0) | \
1473  PIN_AFIO_AF(PK07, 0))
1474 
1475 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1476  PIN_AFIO_AF(PK09, 0) | \
1477  PIN_AFIO_AF(PK10, 0) | \
1478  PIN_AFIO_AF(PK11, 0) | \
1479  PIN_AFIO_AF(PK12, 0) | \
1480  PIN_AFIO_AF(PK13, 0) | \
1481  PIN_AFIO_AF(PK14, 0) | \
1482  PIN_AFIO_AF(PK15, 0))
1483 
1484 #define AF_USART4_TX 8U
1485 #define AF_LINE_USART4_TX 8U
1486 #define AF_USART4_RX 8U
1487 #define AF_LINE_USART4_RX 8U
1488 #define AF_MPU9250_SCK 5U
1489 #define AF_LINE_MPU9250_SCK 5U
1490 #define AF_MPU9250_MISO 5U
1491 #define AF_LINE_MPU9250_MISO 5U
1492 #define AF_MPU9250_MOSI 5U
1493 #define AF_LINE_MPU9250_MOSI 5U
1494 #define AF_OTG_FS_DM 10U
1495 #define AF_LINE_OTG_FS_DM 10U
1496 #define AF_OTG_FS_DP 10U
1497 #define AF_LINE_OTG_FS_DP 10U
1498 #define AF_SWDIO 0U
1499 #define AF_LINE_SWDIO 0U
1500 #define AF_SWCLK 0U
1501 #define AF_LINE_SWCLK 0U
1502 #define AF_USART1_TX 7U
1503 #define AF_LINE_USART1_TX 7U
1504 #define AF_USART1_RX 7U
1505 #define AF_LINE_USART1_RX 7U
1506 #define AF_I2C1_SCL 4U
1507 #define AF_LINE_I2C1_SCL 4U
1508 #define AF_I2C1_SDA 4U
1509 #define AF_LINE_I2C1_SDA 4U
1510 #define AF_FRAM_SCK 5U
1511 #define AF_LINE_FRAM_SCK 5U
1512 #define AF_CAN2_RX 9U
1513 #define AF_LINE_CAN2_RX 9U
1514 #define AF_CAN2_TX 9U
1515 #define AF_LINE_CAN2_TX 9U
1516 #define AF_FRAM_MISO 5U
1517 #define AF_LINE_FRAM_MISO 5U
1518 #define AF_FRAM_MOSI 5U
1519 #define AF_LINE_FRAM_MOSI 5U
1520 #define AF_RC_INPUT 8U
1521 #define AF_LINE_RC_INPUT 8U
1522 #define AF_SDMMC1_D0 12U
1523 #define AF_LINE_SDMMC1_D0 12U
1524 #define AF_SDMMC1_D1 12U
1525 #define AF_LINE_SDMMC1_D1 12U
1526 #define AF_SDMMC1_D2 12U
1527 #define AF_LINE_SDMMC1_D2 12U
1528 #define AF_SDMMC1_D3 12U
1529 #define AF_LINE_SDMMC1_D3 12U
1530 #define AF_SDMMC1_CK 12U
1531 #define AF_LINE_SDMMC1_CK 12U
1532 #define AF_CAN1_RX 9U
1533 #define AF_LINE_CAN1_RX 9U
1534 #define AF_CAN1_TX 9U
1535 #define AF_LINE_CAN1_TX 9U
1536 #define AF_SDMMC1_CMD 12U
1537 #define AF_LINE_SDMMC1_CMD 12U
1538 #define AF_USART2_TX 7U
1539 #define AF_LINE_USART2_TX 7U
1540 #define AF_USART2_RX 7U
1541 #define AF_LINE_USART2_RX 7U
1542 #define AF_USART3_TX 7U
1543 #define AF_LINE_USART3_TX 7U
1544 #define AF_USART3_RX 7U
1545 #define AF_LINE_USART3_RX 7U
1546 #define AF_UART8_RX 8U
1547 #define AF_LINE_UART8_RX 8U
1548 #define AF_UART8_TX 8U
1549 #define AF_LINE_UART8_TX 8U
1550 #define AF_UART7_RX 8U
1551 #define AF_LINE_UART7_RX 8U
1552 #define AF_UART7_TX 8U
1553 #define AF_LINE_UART7_TX 8U
1554 #define AF_OSC_IN 0U
1555 #define AF_LINE_OSC_IN 0U
1556 #define AF_OSC_OUT 0U
1557 #define AF_LINE_OSC_OUT 0U
1558 
1559 
1560 #if !defined(_FROM_ASM_)
1561 #ifdef __cplusplus
1562 extern "C" {
1563 #endif
1564  void boardInit(void);
1565 #ifdef __cplusplus
1566 }
1567 #endif
1568 #endif /* _FROM_ASM_ */
1569 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:261