Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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_KAKUTE_F7
23 #define BOARD_NAME "HOLYBRO KAKUTE F7"
24 
25 /*
26  * Board oscillators-related settings.
27  */
28 #if !defined(STM32_HSECLK)
29 #define STM32_HSECLK 8000000U
30 #endif
31 
32 #if !defined(STM32_LSECLK)
33 #define STM32_LSECLK 32768U
34 #endif
35 
36 #define STM32_LSEDRV (3U << 3U)
37 
38 /*
39  * Board voltages.
40  * Required for performance limits calculation.
41  */
42 #define STM32_VDD 300U
43 
44 /*
45  * MCU type as defined in the ST header.
46  */
47 #define STM32F745xx
48 
49 /*
50  * IO pins assignments.
51  */
52 #define UART4_TX 0U
53 #define UART4_RX 1U
54 #define LED1 2U
55 #define S6 3U
56 #define SDCARD_CS 4U
57 #define SPI1_SCK 5U
58 #define SPI1_MISO 6U
59 #define SPI1_MOSI 7U
60 #define PA08 8U
61 #define UART1_TX 9U
62 #define UART1_RX 10U
63 #define OTG_FS_DM 11U
64 #define OTG_FS_DP 12U
65 #define SWDIO 13U
66 #define SWCLK 14U
67 #define PA15 15U
68 
69 #define S4 0U
70 #define S1 1U
71 #define PB02 2U
72 #define PB03 3U
73 #define PB04 4U
74 #define PB05 5U
75 #define I2C1_SCL 6U
76 #define I2C1_SDA 7U
77 #define PB08 8U
78 #define PB09 9U
79 #define UART3_TX 10U
80 #define UART3_RX 11U
81 #define OSD_CS 12U
82 #define SPI2_SCK 13U
83 #define SPI2_MISO 14U
84 #define SPI2_MOSI 15U
85 
86 #define PC00 0U
87 #define PC01 1U
88 #define CURRENT_MEAS 2U
89 #define VBAT_MEAS 3U
90 #define PC04 4U
91 #define RSSI 5U
92 #define RC2 6U
93 #define RC1 7U
94 #define PC08 8U
95 #define S5 9U
96 #define PC10 10U
97 #define PC11 11U
98 #define PC12 12U
99 #define PC13 13U
100 #define OSC32_IN 14U
101 #define OSC32_OUT 15U
102 
103 #define PD00 0U
104 #define PD01 1U
105 #define PD02 2U
106 #define PD03 3U
107 #define PD04 4U
108 #define UART2_TX 5U
109 #define UART2_RX 6U
110 #define PD07 7U
111 #define PD08 8U
112 #define PD09 9U
113 #define PD10 10U
114 #define PD11 11U
115 #define PD12 12U
116 #define PD13 13U
117 #define PD14 14U
118 #define BUZZER 15U
119 
120 #define PE00 0U
121 #define PE01 1U
122 #define SPI4_CLK 2U
123 #define PE03 3U
124 #define IMU_CS 4U
125 #define SPI4_MISO 5U
126 #define SPI4_MOSI 6U
127 #define UART7_RX 7U
128 #define UART7_TX 8U
129 #define S2 9U
130 #define PE10 10U
131 #define S3 11U
132 #define PE12 12U
133 #define PE13 13U
134 #define PE14 14U
135 #define PE15 15U
136 
137 #define PF00 0U
138 #define PF01 1U
139 #define PF02 2U
140 #define PF03 3U
141 #define PF04 4U
142 #define PF05 5U
143 #define PF06 6U
144 #define PF07 7U
145 #define PF08 8U
146 #define PF09 9U
147 #define PF10 10U
148 #define PF11 11U
149 #define PF12 12U
150 #define PF13 13U
151 #define PF14 14U
152 #define PF15 15U
153 
154 #define PG00 0U
155 #define PG01 1U
156 #define PG02 2U
157 #define PG03 3U
158 #define PG04 4U
159 #define PG05 5U
160 #define PG06 6U
161 #define PG07 7U
162 #define PG08 8U
163 #define PG09 9U
164 #define PG10 10U
165 #define PG11 11U
166 #define PG12 12U
167 #define PG13 13U
168 #define PG14 14U
169 #define PG15 15U
170 
171 #define OSC_IN 0U
172 #define OSC_OUT 1U
173 #define PH02 2U
174 #define PH03 3U
175 #define PH04 4U
176 #define PH05 5U
177 #define PH06 6U
178 #define PH07 7U
179 #define PH08 8U
180 #define PH09 9U
181 #define PH10 10U
182 #define PH11 11U
183 #define PH12 12U
184 #define PH13 13U
185 #define PH14 14U
186 #define PH15 15U
187 
188 #define PI00 0U
189 #define PI01 1U
190 #define PI02 2U
191 #define PI03 3U
192 #define PI04 4U
193 #define PI05 5U
194 #define PI06 6U
195 #define PI07 7U
196 #define PI08 8U
197 #define PI09 9U
198 #define PI10 10U
199 #define PI11 11U
200 #define PI12 12U
201 #define PI13 13U
202 #define PI14 14U
203 #define PI15 15U
204 
205 #define PJ00 0U
206 #define PJ01 1U
207 #define PJ02 2U
208 #define PJ03 3U
209 #define PJ04 4U
210 #define PJ05 5U
211 #define PJ06 6U
212 #define PJ07 7U
213 #define PJ08 8U
214 #define PJ09 9U
215 #define PJ10 10U
216 #define PJ11 11U
217 #define PJ12 12U
218 #define PJ13 13U
219 #define PJ14 14U
220 #define PJ15 15U
221 
222 #define PK00 0U
223 #define PK01 1U
224 #define PK02 2U
225 #define PK03 3U
226 #define PK04 4U
227 #define PK05 5U
228 #define PK06 6U
229 #define PK07 7U
230 #define PK08 8U
231 #define PK09 9U
232 #define PK10 10U
233 #define PK11 11U
234 #define PK12 12U
235 #define PK13 13U
236 #define PK14 14U
237 #define PK15 15U
238 
239 /*
240  * IO lines assignments.
241  */
242 #define LINE_UART4_TX PAL_LINE(GPIOA, 0U)
243 #define LINE_UART4_RX PAL_LINE(GPIOA, 1U)
244 #define LINE_LED1 PAL_LINE(GPIOA, 2U)
245 #define LINE_S6 PAL_LINE(GPIOA, 3U)
246 #define LINE_SDCARD_CS PAL_LINE(GPIOA, 4U)
247 #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
248 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
249 #define LINE_SPI1_MOSI PAL_LINE(GPIOA, 7U)
250 #define LINE_UART1_TX PAL_LINE(GPIOA, 9U)
251 #define LINE_UART1_RX PAL_LINE(GPIOA, 10U)
252 #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
253 #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
254 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
255 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
256 
257 #define LINE_S4 PAL_LINE(GPIOB, 0U)
258 #define LINE_S1 PAL_LINE(GPIOB, 1U)
259 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
260 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
261 #define LINE_UART3_TX PAL_LINE(GPIOB, 10U)
262 #define LINE_UART3_RX PAL_LINE(GPIOB, 11U)
263 #define LINE_OSD_CS PAL_LINE(GPIOB, 12U)
264 #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
265 #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
266 #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
267 
268 #define LINE_CURRENT_MEAS PAL_LINE(GPIOC, 2U)
269 #define LINE_VBAT_MEAS PAL_LINE(GPIOC, 3U)
270 #define LINE_RSSI PAL_LINE(GPIOC, 5U)
271 #define LINE_RC2 PAL_LINE(GPIOC, 6U)
272 #define LINE_RC1 PAL_LINE(GPIOC, 7U)
273 #define LINE_S5 PAL_LINE(GPIOC, 9U)
274 #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
275 #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
276 
277 #define LINE_UART2_TX PAL_LINE(GPIOD, 5U)
278 #define LINE_UART2_RX PAL_LINE(GPIOD, 6U)
279 #define LINE_BUZZER PAL_LINE(GPIOD, 15U)
280 
281 #define LINE_SPI4_CLK PAL_LINE(GPIOE, 2U)
282 #define LINE_IMU_CS PAL_LINE(GPIOE, 4U)
283 #define LINE_SPI4_MISO PAL_LINE(GPIOE, 5U)
284 #define LINE_SPI4_MOSI PAL_LINE(GPIOE, 6U)
285 #define LINE_UART7_RX PAL_LINE(GPIOE, 7U)
286 #define LINE_UART7_TX PAL_LINE(GPIOE, 8U)
287 #define LINE_S2 PAL_LINE(GPIOE, 9U)
288 #define LINE_S3 PAL_LINE(GPIOE, 11U)
289 
290 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
291 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
292 
293 
294 /*
295  * I/O ports initial setup, this configuration is established soon after reset
296  * in the initialization code.
297  * Please refer to the STM32 Reference Manual for details.
298  */
299 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
300 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
301 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
302 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
303 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
304 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
305 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
306 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
307 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
308 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
309 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
310 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
311 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
312 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
313 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
314 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
315 
316 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(UART4_TX) | \
317  PIN_MODE_ALTERNATE(UART4_RX) | \
318  PIN_MODE_OUTPUT(LED1) | \
319  PIN_MODE_ALTERNATE(S6) | \
320  PIN_MODE_OUTPUT(SDCARD_CS) | \
321  PIN_MODE_ALTERNATE(SPI1_SCK) | \
322  PIN_MODE_ALTERNATE(SPI1_MISO) | \
323  PIN_MODE_ALTERNATE(SPI1_MOSI) | \
324  PIN_MODE_INPUT(PA08) | \
325  PIN_MODE_ALTERNATE(UART1_TX) | \
326  PIN_MODE_ALTERNATE(UART1_RX) | \
327  PIN_MODE_ALTERNATE(OTG_FS_DM) | \
328  PIN_MODE_ALTERNATE(OTG_FS_DP) | \
329  PIN_MODE_ALTERNATE(SWDIO) | \
330  PIN_MODE_ALTERNATE(SWCLK) | \
331  PIN_MODE_INPUT(PA15))
332 
333 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(UART4_TX) | \
334  PIN_OTYPE_PUSHPULL(UART4_RX) | \
335  PIN_OTYPE_PUSHPULL(LED1) | \
336  PIN_OTYPE_PUSHPULL(S6) | \
337  PIN_OTYPE_PUSHPULL(SDCARD_CS) | \
338  PIN_OTYPE_PUSHPULL(SPI1_SCK) | \
339  PIN_OTYPE_PUSHPULL(SPI1_MISO) | \
340  PIN_OTYPE_PUSHPULL(SPI1_MOSI) | \
341  PIN_OTYPE_PUSHPULL(PA08) | \
342  PIN_OTYPE_PUSHPULL(UART1_TX) | \
343  PIN_OTYPE_PUSHPULL(UART1_RX) | \
344  PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
345  PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
346  PIN_OTYPE_PUSHPULL(SWDIO) | \
347  PIN_OTYPE_PUSHPULL(SWCLK) | \
348  PIN_OTYPE_PUSHPULL(PA15))
349 
350 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART4_TX) | \
351  PIN_OSPEED_SPEED_HIGH(UART4_RX) | \
352  PIN_OSPEED_SPEED_VERYLOW(LED1) | \
353  PIN_OSPEED_SPEED_HIGH(S6) | \
354  PIN_OSPEED_SPEED_HIGH(SDCARD_CS) | \
355  PIN_OSPEED_SPEED_HIGH(SPI1_SCK) | \
356  PIN_OSPEED_SPEED_HIGH(SPI1_MISO) | \
357  PIN_OSPEED_SPEED_HIGH(SPI1_MOSI) | \
358  PIN_OSPEED_SPEED_VERYLOW(PA08) | \
359  PIN_OSPEED_SPEED_HIGH(UART1_TX) | \
360  PIN_OSPEED_SPEED_HIGH(UART1_RX) | \
361  PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
362  PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
363  PIN_OSPEED_SPEED_HIGH(SWDIO) | \
364  PIN_OSPEED_SPEED_HIGH(SWCLK) | \
365  PIN_OSPEED_SPEED_VERYLOW(PA15))
366 
367 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(UART4_TX) | \
368  PIN_PUPDR_FLOATING(UART4_RX) | \
369  PIN_PUPDR_FLOATING(LED1) | \
370  PIN_PUPDR_FLOATING(S6) | \
371  PIN_PUPDR_FLOATING(SDCARD_CS) | \
372  PIN_PUPDR_FLOATING(SPI1_SCK) | \
373  PIN_PUPDR_FLOATING(SPI1_MISO) | \
374  PIN_PUPDR_FLOATING(SPI1_MOSI) | \
375  PIN_PUPDR_PULLDOWN(PA08) | \
376  PIN_PUPDR_FLOATING(UART1_TX) | \
377  PIN_PUPDR_FLOATING(UART1_RX) | \
378  PIN_PUPDR_FLOATING(OTG_FS_DM) | \
379  PIN_PUPDR_FLOATING(OTG_FS_DP) | \
380  PIN_PUPDR_FLOATING(SWDIO) | \
381  PIN_PUPDR_FLOATING(SWCLK) | \
382  PIN_PUPDR_PULLDOWN(PA15))
383 
384 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_HIGH(UART4_TX) | \
385  PIN_ODR_LEVEL_HIGH(UART4_RX) | \
386  PIN_ODR_LEVEL_LOW(LED1) | \
387  PIN_ODR_LEVEL_LOW(S6) | \
388  PIN_ODR_LEVEL_HIGH(SDCARD_CS) | \
389  PIN_ODR_LEVEL_HIGH(SPI1_SCK) | \
390  PIN_ODR_LEVEL_HIGH(SPI1_MISO) | \
391  PIN_ODR_LEVEL_HIGH(SPI1_MOSI) | \
392  PIN_ODR_LEVEL_LOW(PA08) | \
393  PIN_ODR_LEVEL_HIGH(UART1_TX) | \
394  PIN_ODR_LEVEL_HIGH(UART1_RX) | \
395  PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
396  PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
397  PIN_ODR_LEVEL_HIGH(SWDIO) | \
398  PIN_ODR_LEVEL_HIGH(SWCLK) | \
399  PIN_ODR_LEVEL_LOW(PA15))
400 
401 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(UART4_TX, 8) | \
402  PIN_AFIO_AF(UART4_RX, 8) | \
403  PIN_AFIO_AF(LED1, 0) | \
404  PIN_AFIO_AF(S6, 2) | \
405  PIN_AFIO_AF(SDCARD_CS, 0) | \
406  PIN_AFIO_AF(SPI1_SCK, 5) | \
407  PIN_AFIO_AF(SPI1_MISO, 5) | \
408  PIN_AFIO_AF(SPI1_MOSI, 5))
409 
410 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(PA08, 0) | \
411  PIN_AFIO_AF(UART1_TX, 7) | \
412  PIN_AFIO_AF(UART1_RX, 7) | \
413  PIN_AFIO_AF(OTG_FS_DM, 10) | \
414  PIN_AFIO_AF(OTG_FS_DP, 10) | \
415  PIN_AFIO_AF(SWDIO, 0) | \
416  PIN_AFIO_AF(SWCLK, 0) | \
417  PIN_AFIO_AF(PA15, 0))
418 
419 #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(S4) | \
420  PIN_MODE_ALTERNATE(S1) | \
421  PIN_MODE_INPUT(PB02) | \
422  PIN_MODE_INPUT(PB03) | \
423  PIN_MODE_INPUT(PB04) | \
424  PIN_MODE_INPUT(PB05) | \
425  PIN_MODE_ALTERNATE(I2C1_SCL) | \
426  PIN_MODE_ALTERNATE(I2C1_SDA) | \
427  PIN_MODE_INPUT(PB08) | \
428  PIN_MODE_INPUT(PB09) | \
429  PIN_MODE_ALTERNATE(UART3_TX) | \
430  PIN_MODE_ALTERNATE(UART3_RX) | \
431  PIN_MODE_OUTPUT(OSD_CS) | \
432  PIN_MODE_ALTERNATE(SPI2_SCK) | \
433  PIN_MODE_ALTERNATE(SPI2_MISO) | \
434  PIN_MODE_ALTERNATE(SPI2_MOSI))
435 
436 #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(S4) | \
437  PIN_OTYPE_PUSHPULL(S1) | \
438  PIN_OTYPE_PUSHPULL(PB02) | \
439  PIN_OTYPE_PUSHPULL(PB03) | \
440  PIN_OTYPE_PUSHPULL(PB04) | \
441  PIN_OTYPE_PUSHPULL(PB05) | \
442  PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
443  PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
444  PIN_OTYPE_PUSHPULL(PB08) | \
445  PIN_OTYPE_PUSHPULL(PB09) | \
446  PIN_OTYPE_PUSHPULL(UART3_TX) | \
447  PIN_OTYPE_PUSHPULL(UART3_RX) | \
448  PIN_OTYPE_PUSHPULL(OSD_CS) | \
449  PIN_OTYPE_PUSHPULL(SPI2_SCK) | \
450  PIN_OTYPE_PUSHPULL(SPI2_MISO) | \
451  PIN_OTYPE_PUSHPULL(SPI2_MOSI))
452 
453 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_HIGH(S4) | \
454  PIN_OSPEED_SPEED_HIGH(S1) | \
455  PIN_OSPEED_SPEED_VERYLOW(PB02) | \
456  PIN_OSPEED_SPEED_VERYLOW(PB03) | \
457  PIN_OSPEED_SPEED_VERYLOW(PB04) | \
458  PIN_OSPEED_SPEED_VERYLOW(PB05) | \
459  PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
460  PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
461  PIN_OSPEED_SPEED_VERYLOW(PB08) | \
462  PIN_OSPEED_SPEED_VERYLOW(PB09) | \
463  PIN_OSPEED_SPEED_HIGH(UART3_TX) | \
464  PIN_OSPEED_SPEED_HIGH(UART3_RX) | \
465  PIN_OSPEED_SPEED_HIGH(OSD_CS) | \
466  PIN_OSPEED_SPEED_HIGH(SPI2_SCK) | \
467  PIN_OSPEED_SPEED_HIGH(SPI2_MISO) | \
468  PIN_OSPEED_SPEED_HIGH(SPI2_MOSI))
469 
470 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(S4) | \
471  PIN_PUPDR_FLOATING(S1) | \
472  PIN_PUPDR_PULLDOWN(PB02) | \
473  PIN_PUPDR_PULLDOWN(PB03) | \
474  PIN_PUPDR_PULLDOWN(PB04) | \
475  PIN_PUPDR_PULLDOWN(PB05) | \
476  PIN_PUPDR_PULLUP(I2C1_SCL) | \
477  PIN_PUPDR_PULLUP(I2C1_SDA) | \
478  PIN_PUPDR_PULLDOWN(PB08) | \
479  PIN_PUPDR_PULLDOWN(PB09) | \
480  PIN_PUPDR_FLOATING(UART3_TX) | \
481  PIN_PUPDR_FLOATING(UART3_RX) | \
482  PIN_PUPDR_FLOATING(OSD_CS) | \
483  PIN_PUPDR_FLOATING(SPI2_SCK) | \
484  PIN_PUPDR_FLOATING(SPI2_MISO) | \
485  PIN_PUPDR_FLOATING(SPI2_MOSI))
486 
487 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(S4) | \
488  PIN_ODR_LEVEL_LOW(S1) | \
489  PIN_ODR_LEVEL_LOW(PB02) | \
490  PIN_ODR_LEVEL_LOW(PB03) | \
491  PIN_ODR_LEVEL_LOW(PB04) | \
492  PIN_ODR_LEVEL_LOW(PB05) | \
493  PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
494  PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
495  PIN_ODR_LEVEL_LOW(PB08) | \
496  PIN_ODR_LEVEL_LOW(PB09) | \
497  PIN_ODR_LEVEL_HIGH(UART3_TX) | \
498  PIN_ODR_LEVEL_HIGH(UART3_RX) | \
499  PIN_ODR_LEVEL_HIGH(OSD_CS) | \
500  PIN_ODR_LEVEL_HIGH(SPI2_SCK) | \
501  PIN_ODR_LEVEL_HIGH(SPI2_MISO) | \
502  PIN_ODR_LEVEL_HIGH(SPI2_MOSI))
503 
504 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(S4, 2) | \
505  PIN_AFIO_AF(S1, 1) | \
506  PIN_AFIO_AF(PB02, 0) | \
507  PIN_AFIO_AF(PB03, 0) | \
508  PIN_AFIO_AF(PB04, 0) | \
509  PIN_AFIO_AF(PB05, 0) | \
510  PIN_AFIO_AF(I2C1_SCL, 4) | \
511  PIN_AFIO_AF(I2C1_SDA, 4))
512 
513 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(PB08, 0) | \
514  PIN_AFIO_AF(PB09, 0) | \
515  PIN_AFIO_AF(UART3_TX, 7) | \
516  PIN_AFIO_AF(UART3_RX, 7) | \
517  PIN_AFIO_AF(OSD_CS, 0) | \
518  PIN_AFIO_AF(SPI2_SCK, 5) | \
519  PIN_AFIO_AF(SPI2_MISO, 5) | \
520  PIN_AFIO_AF(SPI2_MOSI, 5))
521 
522 #define VAL_GPIOC_MODER (PIN_MODE_INPUT(PC00) | \
523  PIN_MODE_INPUT(PC01) | \
524  PIN_MODE_ANALOG(CURRENT_MEAS) | \
525  PIN_MODE_ANALOG(VBAT_MEAS) | \
526  PIN_MODE_INPUT(PC04) | \
527  PIN_MODE_ANALOG(RSSI) | \
528  PIN_MODE_INPUT(RC2) | \
529  PIN_MODE_INPUT(RC1) | \
530  PIN_MODE_INPUT(PC08) | \
531  PIN_MODE_ALTERNATE(S5) | \
532  PIN_MODE_INPUT(PC10) | \
533  PIN_MODE_INPUT(PC11) | \
534  PIN_MODE_INPUT(PC12) | \
535  PIN_MODE_INPUT(PC13) | \
536  PIN_MODE_ALTERNATE(OSC32_IN) | \
537  PIN_MODE_ALTERNATE(OSC32_OUT))
538 
539 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(PC00) | \
540  PIN_OTYPE_PUSHPULL(PC01) | \
541  PIN_OTYPE_PUSHPULL(CURRENT_MEAS) | \
542  PIN_OTYPE_PUSHPULL(VBAT_MEAS) | \
543  PIN_OTYPE_PUSHPULL(PC04) | \
544  PIN_OTYPE_PUSHPULL(RSSI) | \
545  PIN_OTYPE_OPENDRAIN(RC2) | \
546  PIN_OTYPE_OPENDRAIN(RC1) | \
547  PIN_OTYPE_PUSHPULL(PC08) | \
548  PIN_OTYPE_PUSHPULL(S5) | \
549  PIN_OTYPE_PUSHPULL(PC10) | \
550  PIN_OTYPE_PUSHPULL(PC11) | \
551  PIN_OTYPE_PUSHPULL(PC12) | \
552  PIN_OTYPE_PUSHPULL(PC13) | \
553  PIN_OTYPE_PUSHPULL(OSC32_IN) | \
554  PIN_OTYPE_PUSHPULL(OSC32_OUT))
555 
556 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PC00) | \
557  PIN_OSPEED_SPEED_VERYLOW(PC01) | \
558  PIN_OSPEED_SPEED_VERYLOW(CURRENT_MEAS) | \
559  PIN_OSPEED_SPEED_VERYLOW(VBAT_MEAS) | \
560  PIN_OSPEED_SPEED_VERYLOW(PC04) | \
561  PIN_OSPEED_SPEED_VERYLOW(RSSI) | \
562  PIN_OSPEED_SPEED_VERYLOW(RC2) | \
563  PIN_OSPEED_SPEED_VERYLOW(RC1) | \
564  PIN_OSPEED_SPEED_VERYLOW(PC08) | \
565  PIN_OSPEED_SPEED_HIGH(S5) | \
566  PIN_OSPEED_SPEED_VERYLOW(PC10) | \
567  PIN_OSPEED_SPEED_VERYLOW(PC11) | \
568  PIN_OSPEED_SPEED_VERYLOW(PC12) | \
569  PIN_OSPEED_SPEED_VERYLOW(PC13) | \
570  PIN_OSPEED_SPEED_HIGH(OSC32_IN) | \
571  PIN_OSPEED_SPEED_HIGH(OSC32_OUT))
572 
573 #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLDOWN(PC00) | \
574  PIN_PUPDR_PULLDOWN(PC01) | \
575  PIN_PUPDR_FLOATING(CURRENT_MEAS) | \
576  PIN_PUPDR_FLOATING(VBAT_MEAS) | \
577  PIN_PUPDR_PULLDOWN(PC04) | \
578  PIN_PUPDR_FLOATING(RSSI) | \
579  PIN_PUPDR_PULLDOWN(RC2) | \
580  PIN_PUPDR_PULLDOWN(RC1) | \
581  PIN_PUPDR_PULLDOWN(PC08) | \
582  PIN_PUPDR_FLOATING(S5) | \
583  PIN_PUPDR_PULLDOWN(PC10) | \
584  PIN_PUPDR_PULLDOWN(PC11) | \
585  PIN_PUPDR_PULLDOWN(PC12) | \
586  PIN_PUPDR_PULLDOWN(PC13) | \
587  PIN_PUPDR_FLOATING(OSC32_IN) | \
588  PIN_PUPDR_FLOATING(OSC32_OUT))
589 
590 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(PC00) | \
591  PIN_ODR_LEVEL_LOW(PC01) | \
592  PIN_ODR_LEVEL_LOW(CURRENT_MEAS) | \
593  PIN_ODR_LEVEL_LOW(VBAT_MEAS) | \
594  PIN_ODR_LEVEL_LOW(PC04) | \
595  PIN_ODR_LEVEL_LOW(RSSI) | \
596  PIN_ODR_LEVEL_HIGH(RC2) | \
597  PIN_ODR_LEVEL_HIGH(RC1) | \
598  PIN_ODR_LEVEL_LOW(PC08) | \
599  PIN_ODR_LEVEL_LOW(S5) | \
600  PIN_ODR_LEVEL_LOW(PC10) | \
601  PIN_ODR_LEVEL_LOW(PC11) | \
602  PIN_ODR_LEVEL_LOW(PC12) | \
603  PIN_ODR_LEVEL_LOW(PC13) | \
604  PIN_ODR_LEVEL_HIGH(OSC32_IN) | \
605  PIN_ODR_LEVEL_HIGH(OSC32_OUT))
606 
607 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(PC00, 0) | \
608  PIN_AFIO_AF(PC01, 0) | \
609  PIN_AFIO_AF(CURRENT_MEAS, 0) | \
610  PIN_AFIO_AF(VBAT_MEAS, 0) | \
611  PIN_AFIO_AF(PC04, 0) | \
612  PIN_AFIO_AF(RSSI, 0) | \
613  PIN_AFIO_AF(RC2, 0) | \
614  PIN_AFIO_AF(RC1, 0))
615 
616 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(PC08, 0) | \
617  PIN_AFIO_AF(S5, 2) | \
618  PIN_AFIO_AF(PC10, 0) | \
619  PIN_AFIO_AF(PC11, 0) | \
620  PIN_AFIO_AF(PC12, 0) | \
621  PIN_AFIO_AF(PC13, 0) | \
622  PIN_AFIO_AF(OSC32_IN, 0) | \
623  PIN_AFIO_AF(OSC32_OUT, 0))
624 
625 #define VAL_GPIOD_MODER (PIN_MODE_INPUT(PD00) | \
626  PIN_MODE_INPUT(PD01) | \
627  PIN_MODE_INPUT(PD02) | \
628  PIN_MODE_INPUT(PD03) | \
629  PIN_MODE_INPUT(PD04) | \
630  PIN_MODE_ALTERNATE(UART2_TX) | \
631  PIN_MODE_ALTERNATE(UART2_RX) | \
632  PIN_MODE_INPUT(PD07) | \
633  PIN_MODE_INPUT(PD08) | \
634  PIN_MODE_INPUT(PD09) | \
635  PIN_MODE_INPUT(PD10) | \
636  PIN_MODE_INPUT(PD11) | \
637  PIN_MODE_INPUT(PD12) | \
638  PIN_MODE_INPUT(PD13) | \
639  PIN_MODE_INPUT(PD14) | \
640  PIN_MODE_ALTERNATE(BUZZER))
641 
642 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00) | \
643  PIN_OTYPE_PUSHPULL(PD01) | \
644  PIN_OTYPE_PUSHPULL(PD02) | \
645  PIN_OTYPE_PUSHPULL(PD03) | \
646  PIN_OTYPE_PUSHPULL(PD04) | \
647  PIN_OTYPE_PUSHPULL(UART2_TX) | \
648  PIN_OTYPE_PUSHPULL(UART2_RX) | \
649  PIN_OTYPE_PUSHPULL(PD07) | \
650  PIN_OTYPE_PUSHPULL(PD08) | \
651  PIN_OTYPE_PUSHPULL(PD09) | \
652  PIN_OTYPE_PUSHPULL(PD10) | \
653  PIN_OTYPE_PUSHPULL(PD11) | \
654  PIN_OTYPE_PUSHPULL(PD12) | \
655  PIN_OTYPE_PUSHPULL(PD13) | \
656  PIN_OTYPE_PUSHPULL(PD14) | \
657  PIN_OTYPE_PUSHPULL(BUZZER))
658 
659 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PD00) | \
660  PIN_OSPEED_SPEED_VERYLOW(PD01) | \
661  PIN_OSPEED_SPEED_VERYLOW(PD02) | \
662  PIN_OSPEED_SPEED_VERYLOW(PD03) | \
663  PIN_OSPEED_SPEED_VERYLOW(PD04) | \
664  PIN_OSPEED_SPEED_HIGH(UART2_TX) | \
665  PIN_OSPEED_SPEED_HIGH(UART2_RX) | \
666  PIN_OSPEED_SPEED_VERYLOW(PD07) | \
667  PIN_OSPEED_SPEED_VERYLOW(PD08) | \
668  PIN_OSPEED_SPEED_VERYLOW(PD09) | \
669  PIN_OSPEED_SPEED_VERYLOW(PD10) | \
670  PIN_OSPEED_SPEED_VERYLOW(PD11) | \
671  PIN_OSPEED_SPEED_VERYLOW(PD12) | \
672  PIN_OSPEED_SPEED_VERYLOW(PD13) | \
673  PIN_OSPEED_SPEED_VERYLOW(PD14) | \
674  PIN_OSPEED_SPEED_HIGH(BUZZER))
675 
676 #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(PD00) | \
677  PIN_PUPDR_PULLDOWN(PD01) | \
678  PIN_PUPDR_PULLDOWN(PD02) | \
679  PIN_PUPDR_PULLDOWN(PD03) | \
680  PIN_PUPDR_PULLDOWN(PD04) | \
681  PIN_PUPDR_FLOATING(UART2_TX) | \
682  PIN_PUPDR_FLOATING(UART2_RX) | \
683  PIN_PUPDR_PULLDOWN(PD07) | \
684  PIN_PUPDR_PULLDOWN(PD08) | \
685  PIN_PUPDR_PULLDOWN(PD09) | \
686  PIN_PUPDR_PULLDOWN(PD10) | \
687  PIN_PUPDR_PULLDOWN(PD11) | \
688  PIN_PUPDR_PULLDOWN(PD12) | \
689  PIN_PUPDR_PULLDOWN(PD13) | \
690  PIN_PUPDR_PULLDOWN(PD14) | \
691  PIN_PUPDR_FLOATING(BUZZER))
692 
693 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_LOW(PD00) | \
694  PIN_ODR_LEVEL_LOW(PD01) | \
695  PIN_ODR_LEVEL_LOW(PD02) | \
696  PIN_ODR_LEVEL_LOW(PD03) | \
697  PIN_ODR_LEVEL_LOW(PD04) | \
698  PIN_ODR_LEVEL_HIGH(UART2_TX) | \
699  PIN_ODR_LEVEL_HIGH(UART2_RX) | \
700  PIN_ODR_LEVEL_LOW(PD07) | \
701  PIN_ODR_LEVEL_LOW(PD08) | \
702  PIN_ODR_LEVEL_LOW(PD09) | \
703  PIN_ODR_LEVEL_LOW(PD10) | \
704  PIN_ODR_LEVEL_LOW(PD11) | \
705  PIN_ODR_LEVEL_LOW(PD12) | \
706  PIN_ODR_LEVEL_LOW(PD13) | \
707  PIN_ODR_LEVEL_LOW(PD14) | \
708  PIN_ODR_LEVEL_LOW(BUZZER))
709 
710 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00, 0) | \
711  PIN_AFIO_AF(PD01, 0) | \
712  PIN_AFIO_AF(PD02, 0) | \
713  PIN_AFIO_AF(PD03, 0) | \
714  PIN_AFIO_AF(PD04, 0) | \
715  PIN_AFIO_AF(UART2_TX, 7) | \
716  PIN_AFIO_AF(UART2_RX, 7) | \
717  PIN_AFIO_AF(PD07, 0))
718 
719 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08, 0) | \
720  PIN_AFIO_AF(PD09, 0) | \
721  PIN_AFIO_AF(PD10, 0) | \
722  PIN_AFIO_AF(PD11, 0) | \
723  PIN_AFIO_AF(PD12, 0) | \
724  PIN_AFIO_AF(PD13, 0) | \
725  PIN_AFIO_AF(PD14, 0) | \
726  PIN_AFIO_AF(BUZZER, 2))
727 
728 #define VAL_GPIOE_MODER (PIN_MODE_INPUT(PE00) | \
729  PIN_MODE_INPUT(PE01) | \
730  PIN_MODE_ALTERNATE(SPI4_CLK) | \
731  PIN_MODE_INPUT(PE03) | \
732  PIN_MODE_OUTPUT(IMU_CS) | \
733  PIN_MODE_ALTERNATE(SPI4_MISO) | \
734  PIN_MODE_ALTERNATE(SPI4_MOSI) | \
735  PIN_MODE_ALTERNATE(UART7_RX) | \
736  PIN_MODE_ALTERNATE(UART7_TX) | \
737  PIN_MODE_ALTERNATE(S2) | \
738  PIN_MODE_INPUT(PE10) | \
739  PIN_MODE_ALTERNATE(S3) | \
740  PIN_MODE_INPUT(PE12) | \
741  PIN_MODE_INPUT(PE13) | \
742  PIN_MODE_INPUT(PE14) | \
743  PIN_MODE_INPUT(PE15))
744 
745 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00) | \
746  PIN_OTYPE_PUSHPULL(PE01) | \
747  PIN_OTYPE_PUSHPULL(SPI4_CLK) | \
748  PIN_OTYPE_PUSHPULL(PE03) | \
749  PIN_OTYPE_PUSHPULL(IMU_CS) | \
750  PIN_OTYPE_PUSHPULL(SPI4_MISO) | \
751  PIN_OTYPE_PUSHPULL(SPI4_MOSI) | \
752  PIN_OTYPE_PUSHPULL(UART7_RX) | \
753  PIN_OTYPE_PUSHPULL(UART7_TX) | \
754  PIN_OTYPE_PUSHPULL(S2) | \
755  PIN_OTYPE_PUSHPULL(PE10) | \
756  PIN_OTYPE_PUSHPULL(S3) | \
757  PIN_OTYPE_PUSHPULL(PE12) | \
758  PIN_OTYPE_PUSHPULL(PE13) | \
759  PIN_OTYPE_PUSHPULL(PE14) | \
760  PIN_OTYPE_PUSHPULL(PE15))
761 
762 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PE00) | \
763  PIN_OSPEED_SPEED_VERYLOW(PE01) | \
764  PIN_OSPEED_SPEED_HIGH(SPI4_CLK) | \
765  PIN_OSPEED_SPEED_VERYLOW(PE03) | \
766  PIN_OSPEED_SPEED_HIGH(IMU_CS) | \
767  PIN_OSPEED_SPEED_HIGH(SPI4_MISO) | \
768  PIN_OSPEED_SPEED_HIGH(SPI4_MOSI) | \
769  PIN_OSPEED_SPEED_HIGH(UART7_RX) | \
770  PIN_OSPEED_SPEED_HIGH(UART7_TX) | \
771  PIN_OSPEED_SPEED_HIGH(S2) | \
772  PIN_OSPEED_SPEED_VERYLOW(PE10) | \
773  PIN_OSPEED_SPEED_HIGH(S3) | \
774  PIN_OSPEED_SPEED_VERYLOW(PE12) | \
775  PIN_OSPEED_SPEED_VERYLOW(PE13) | \
776  PIN_OSPEED_SPEED_VERYLOW(PE14) | \
777  PIN_OSPEED_SPEED_VERYLOW(PE15))
778 
779 #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLDOWN(PE00) | \
780  PIN_PUPDR_PULLDOWN(PE01) | \
781  PIN_PUPDR_FLOATING(SPI4_CLK) | \
782  PIN_PUPDR_PULLDOWN(PE03) | \
783  PIN_PUPDR_FLOATING(IMU_CS) | \
784  PIN_PUPDR_FLOATING(SPI4_MISO) | \
785  PIN_PUPDR_FLOATING(SPI4_MOSI) | \
786  PIN_PUPDR_FLOATING(UART7_RX) | \
787  PIN_PUPDR_FLOATING(UART7_TX) | \
788  PIN_PUPDR_FLOATING(S2) | \
789  PIN_PUPDR_PULLDOWN(PE10) | \
790  PIN_PUPDR_FLOATING(S3) | \
791  PIN_PUPDR_PULLDOWN(PE12) | \
792  PIN_PUPDR_PULLDOWN(PE13) | \
793  PIN_PUPDR_PULLDOWN(PE14) | \
794  PIN_PUPDR_PULLDOWN(PE15))
795 
796 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_LOW(PE00) | \
797  PIN_ODR_LEVEL_LOW(PE01) | \
798  PIN_ODR_LEVEL_HIGH(SPI4_CLK) | \
799  PIN_ODR_LEVEL_LOW(PE03) | \
800  PIN_ODR_LEVEL_HIGH(IMU_CS) | \
801  PIN_ODR_LEVEL_HIGH(SPI4_MISO) | \
802  PIN_ODR_LEVEL_HIGH(SPI4_MOSI) | \
803  PIN_ODR_LEVEL_HIGH(UART7_RX) | \
804  PIN_ODR_LEVEL_HIGH(UART7_TX) | \
805  PIN_ODR_LEVEL_LOW(S2) | \
806  PIN_ODR_LEVEL_LOW(PE10) | \
807  PIN_ODR_LEVEL_LOW(S3) | \
808  PIN_ODR_LEVEL_LOW(PE12) | \
809  PIN_ODR_LEVEL_LOW(PE13) | \
810  PIN_ODR_LEVEL_LOW(PE14) | \
811  PIN_ODR_LEVEL_LOW(PE15))
812 
813 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00, 0) | \
814  PIN_AFIO_AF(PE01, 0) | \
815  PIN_AFIO_AF(SPI4_CLK, 5) | \
816  PIN_AFIO_AF(PE03, 0) | \
817  PIN_AFIO_AF(IMU_CS, 0) | \
818  PIN_AFIO_AF(SPI4_MISO, 5) | \
819  PIN_AFIO_AF(SPI4_MOSI, 5) | \
820  PIN_AFIO_AF(UART7_RX, 8))
821 
822 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(UART7_TX, 8) | \
823  PIN_AFIO_AF(S2, 1) | \
824  PIN_AFIO_AF(PE10, 0) | \
825  PIN_AFIO_AF(S3, 1) | \
826  PIN_AFIO_AF(PE12, 0) | \
827  PIN_AFIO_AF(PE13, 0) | \
828  PIN_AFIO_AF(PE14, 0) | \
829  PIN_AFIO_AF(PE15, 0))
830 
831 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
832  PIN_MODE_INPUT(PF01) | \
833  PIN_MODE_INPUT(PF02) | \
834  PIN_MODE_INPUT(PF03) | \
835  PIN_MODE_INPUT(PF04) | \
836  PIN_MODE_INPUT(PF05) | \
837  PIN_MODE_INPUT(PF06) | \
838  PIN_MODE_INPUT(PF07) | \
839  PIN_MODE_INPUT(PF08) | \
840  PIN_MODE_INPUT(PF09) | \
841  PIN_MODE_INPUT(PF10) | \
842  PIN_MODE_INPUT(PF11) | \
843  PIN_MODE_INPUT(PF12) | \
844  PIN_MODE_INPUT(PF13) | \
845  PIN_MODE_INPUT(PF14) | \
846  PIN_MODE_INPUT(PF15))
847 
848 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
849  PIN_OTYPE_PUSHPULL(PF01) | \
850  PIN_OTYPE_PUSHPULL(PF02) | \
851  PIN_OTYPE_PUSHPULL(PF03) | \
852  PIN_OTYPE_PUSHPULL(PF04) | \
853  PIN_OTYPE_PUSHPULL(PF05) | \
854  PIN_OTYPE_PUSHPULL(PF06) | \
855  PIN_OTYPE_PUSHPULL(PF07) | \
856  PIN_OTYPE_PUSHPULL(PF08) | \
857  PIN_OTYPE_PUSHPULL(PF09) | \
858  PIN_OTYPE_PUSHPULL(PF10) | \
859  PIN_OTYPE_PUSHPULL(PF11) | \
860  PIN_OTYPE_PUSHPULL(PF12) | \
861  PIN_OTYPE_PUSHPULL(PF13) | \
862  PIN_OTYPE_PUSHPULL(PF14) | \
863  PIN_OTYPE_PUSHPULL(PF15))
864 
865 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
866  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
867  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
868  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
869  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
870  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
871  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
872  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
873  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
874  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
875  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
876  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
877  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
878  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
879  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
880  PIN_OSPEED_SPEED_VERYLOW(PF15))
881 
882 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
883  PIN_PUPDR_PULLDOWN(PF01) | \
884  PIN_PUPDR_PULLDOWN(PF02) | \
885  PIN_PUPDR_PULLDOWN(PF03) | \
886  PIN_PUPDR_PULLDOWN(PF04) | \
887  PIN_PUPDR_PULLDOWN(PF05) | \
888  PIN_PUPDR_PULLDOWN(PF06) | \
889  PIN_PUPDR_PULLDOWN(PF07) | \
890  PIN_PUPDR_PULLDOWN(PF08) | \
891  PIN_PUPDR_PULLDOWN(PF09) | \
892  PIN_PUPDR_PULLDOWN(PF10) | \
893  PIN_PUPDR_PULLDOWN(PF11) | \
894  PIN_PUPDR_PULLDOWN(PF12) | \
895  PIN_PUPDR_PULLDOWN(PF13) | \
896  PIN_PUPDR_PULLDOWN(PF14) | \
897  PIN_PUPDR_PULLDOWN(PF15))
898 
899 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
900  PIN_ODR_LEVEL_LOW(PF01) | \
901  PIN_ODR_LEVEL_LOW(PF02) | \
902  PIN_ODR_LEVEL_LOW(PF03) | \
903  PIN_ODR_LEVEL_LOW(PF04) | \
904  PIN_ODR_LEVEL_LOW(PF05) | \
905  PIN_ODR_LEVEL_LOW(PF06) | \
906  PIN_ODR_LEVEL_LOW(PF07) | \
907  PIN_ODR_LEVEL_LOW(PF08) | \
908  PIN_ODR_LEVEL_LOW(PF09) | \
909  PIN_ODR_LEVEL_LOW(PF10) | \
910  PIN_ODR_LEVEL_LOW(PF11) | \
911  PIN_ODR_LEVEL_LOW(PF12) | \
912  PIN_ODR_LEVEL_LOW(PF13) | \
913  PIN_ODR_LEVEL_LOW(PF14) | \
914  PIN_ODR_LEVEL_LOW(PF15))
915 
916 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
917  PIN_AFIO_AF(PF01, 0) | \
918  PIN_AFIO_AF(PF02, 0) | \
919  PIN_AFIO_AF(PF03, 0) | \
920  PIN_AFIO_AF(PF04, 0) | \
921  PIN_AFIO_AF(PF05, 0) | \
922  PIN_AFIO_AF(PF06, 0) | \
923  PIN_AFIO_AF(PF07, 0))
924 
925 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
926  PIN_AFIO_AF(PF09, 0) | \
927  PIN_AFIO_AF(PF10, 0) | \
928  PIN_AFIO_AF(PF11, 0) | \
929  PIN_AFIO_AF(PF12, 0) | \
930  PIN_AFIO_AF(PF13, 0) | \
931  PIN_AFIO_AF(PF14, 0) | \
932  PIN_AFIO_AF(PF15, 0))
933 
934 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
935  PIN_MODE_INPUT(PG01) | \
936  PIN_MODE_INPUT(PG02) | \
937  PIN_MODE_INPUT(PG03) | \
938  PIN_MODE_INPUT(PG04) | \
939  PIN_MODE_INPUT(PG05) | \
940  PIN_MODE_INPUT(PG06) | \
941  PIN_MODE_INPUT(PG07) | \
942  PIN_MODE_INPUT(PG08) | \
943  PIN_MODE_INPUT(PG09) | \
944  PIN_MODE_INPUT(PG10) | \
945  PIN_MODE_INPUT(PG11) | \
946  PIN_MODE_INPUT(PG12) | \
947  PIN_MODE_INPUT(PG13) | \
948  PIN_MODE_INPUT(PG14) | \
949  PIN_MODE_INPUT(PG15))
950 
951 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
952  PIN_OTYPE_PUSHPULL(PG01) | \
953  PIN_OTYPE_PUSHPULL(PG02) | \
954  PIN_OTYPE_PUSHPULL(PG03) | \
955  PIN_OTYPE_PUSHPULL(PG04) | \
956  PIN_OTYPE_PUSHPULL(PG05) | \
957  PIN_OTYPE_PUSHPULL(PG06) | \
958  PIN_OTYPE_PUSHPULL(PG07) | \
959  PIN_OTYPE_PUSHPULL(PG08) | \
960  PIN_OTYPE_PUSHPULL(PG09) | \
961  PIN_OTYPE_PUSHPULL(PG10) | \
962  PIN_OTYPE_PUSHPULL(PG11) | \
963  PIN_OTYPE_PUSHPULL(PG12) | \
964  PIN_OTYPE_PUSHPULL(PG13) | \
965  PIN_OTYPE_PUSHPULL(PG14) | \
966  PIN_OTYPE_PUSHPULL(PG15))
967 
968 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
969  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
970  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
971  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
972  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
973  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
974  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
975  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
976  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
977  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
978  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
979  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
980  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
981  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
982  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
983  PIN_OSPEED_SPEED_VERYLOW(PG15))
984 
985 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
986  PIN_PUPDR_PULLDOWN(PG01) | \
987  PIN_PUPDR_PULLDOWN(PG02) | \
988  PIN_PUPDR_PULLDOWN(PG03) | \
989  PIN_PUPDR_PULLDOWN(PG04) | \
990  PIN_PUPDR_PULLDOWN(PG05) | \
991  PIN_PUPDR_PULLDOWN(PG06) | \
992  PIN_PUPDR_PULLDOWN(PG07) | \
993  PIN_PUPDR_PULLDOWN(PG08) | \
994  PIN_PUPDR_PULLDOWN(PG09) | \
995  PIN_PUPDR_PULLDOWN(PG10) | \
996  PIN_PUPDR_PULLDOWN(PG11) | \
997  PIN_PUPDR_PULLDOWN(PG12) | \
998  PIN_PUPDR_PULLDOWN(PG13) | \
999  PIN_PUPDR_PULLDOWN(PG14) | \
1000  PIN_PUPDR_PULLDOWN(PG15))
1001 
1002 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1003  PIN_ODR_LEVEL_LOW(PG01) | \
1004  PIN_ODR_LEVEL_LOW(PG02) | \
1005  PIN_ODR_LEVEL_LOW(PG03) | \
1006  PIN_ODR_LEVEL_LOW(PG04) | \
1007  PIN_ODR_LEVEL_LOW(PG05) | \
1008  PIN_ODR_LEVEL_LOW(PG06) | \
1009  PIN_ODR_LEVEL_LOW(PG07) | \
1010  PIN_ODR_LEVEL_LOW(PG08) | \
1011  PIN_ODR_LEVEL_LOW(PG09) | \
1012  PIN_ODR_LEVEL_LOW(PG10) | \
1013  PIN_ODR_LEVEL_LOW(PG11) | \
1014  PIN_ODR_LEVEL_LOW(PG12) | \
1015  PIN_ODR_LEVEL_LOW(PG13) | \
1016  PIN_ODR_LEVEL_LOW(PG14) | \
1017  PIN_ODR_LEVEL_LOW(PG15))
1018 
1019 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1020  PIN_AFIO_AF(PG01, 0) | \
1021  PIN_AFIO_AF(PG02, 0) | \
1022  PIN_AFIO_AF(PG03, 0) | \
1023  PIN_AFIO_AF(PG04, 0) | \
1024  PIN_AFIO_AF(PG05, 0) | \
1025  PIN_AFIO_AF(PG06, 0) | \
1026  PIN_AFIO_AF(PG07, 0))
1027 
1028 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1029  PIN_AFIO_AF(PG09, 0) | \
1030  PIN_AFIO_AF(PG10, 0) | \
1031  PIN_AFIO_AF(PG11, 0) | \
1032  PIN_AFIO_AF(PG12, 0) | \
1033  PIN_AFIO_AF(PG13, 0) | \
1034  PIN_AFIO_AF(PG14, 0) | \
1035  PIN_AFIO_AF(PG15, 0))
1036 
1037 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1038  PIN_MODE_ALTERNATE(OSC_OUT) | \
1039  PIN_MODE_INPUT(PH02) | \
1040  PIN_MODE_INPUT(PH03) | \
1041  PIN_MODE_INPUT(PH04) | \
1042  PIN_MODE_INPUT(PH05) | \
1043  PIN_MODE_INPUT(PH06) | \
1044  PIN_MODE_INPUT(PH07) | \
1045  PIN_MODE_INPUT(PH08) | \
1046  PIN_MODE_INPUT(PH09) | \
1047  PIN_MODE_INPUT(PH10) | \
1048  PIN_MODE_INPUT(PH11) | \
1049  PIN_MODE_INPUT(PH12) | \
1050  PIN_MODE_INPUT(PH13) | \
1051  PIN_MODE_INPUT(PH14) | \
1052  PIN_MODE_INPUT(PH15))
1053 
1054 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1055  PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1056  PIN_OTYPE_PUSHPULL(PH02) | \
1057  PIN_OTYPE_PUSHPULL(PH03) | \
1058  PIN_OTYPE_PUSHPULL(PH04) | \
1059  PIN_OTYPE_PUSHPULL(PH05) | \
1060  PIN_OTYPE_PUSHPULL(PH06) | \
1061  PIN_OTYPE_PUSHPULL(PH07) | \
1062  PIN_OTYPE_PUSHPULL(PH08) | \
1063  PIN_OTYPE_PUSHPULL(PH09) | \
1064  PIN_OTYPE_PUSHPULL(PH10) | \
1065  PIN_OTYPE_PUSHPULL(PH11) | \
1066  PIN_OTYPE_PUSHPULL(PH12) | \
1067  PIN_OTYPE_PUSHPULL(PH13) | \
1068  PIN_OTYPE_PUSHPULL(PH14) | \
1069  PIN_OTYPE_PUSHPULL(PH15))
1070 
1071 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1072  PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1073  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1074  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1075  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1076  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1077  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1078  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1079  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1080  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1081  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1082  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1083  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1084  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1085  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1086  PIN_OSPEED_SPEED_VERYLOW(PH15))
1087 
1088 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1089  PIN_PUPDR_FLOATING(OSC_OUT) | \
1090  PIN_PUPDR_PULLDOWN(PH02) | \
1091  PIN_PUPDR_PULLDOWN(PH03) | \
1092  PIN_PUPDR_PULLDOWN(PH04) | \
1093  PIN_PUPDR_PULLDOWN(PH05) | \
1094  PIN_PUPDR_PULLDOWN(PH06) | \
1095  PIN_PUPDR_PULLDOWN(PH07) | \
1096  PIN_PUPDR_PULLDOWN(PH08) | \
1097  PIN_PUPDR_PULLDOWN(PH09) | \
1098  PIN_PUPDR_PULLDOWN(PH10) | \
1099  PIN_PUPDR_PULLDOWN(PH11) | \
1100  PIN_PUPDR_PULLDOWN(PH12) | \
1101  PIN_PUPDR_PULLDOWN(PH13) | \
1102  PIN_PUPDR_PULLDOWN(PH14) | \
1103  PIN_PUPDR_PULLDOWN(PH15))
1104 
1105 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1106  PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1107  PIN_ODR_LEVEL_LOW(PH02) | \
1108  PIN_ODR_LEVEL_LOW(PH03) | \
1109  PIN_ODR_LEVEL_LOW(PH04) | \
1110  PIN_ODR_LEVEL_LOW(PH05) | \
1111  PIN_ODR_LEVEL_LOW(PH06) | \
1112  PIN_ODR_LEVEL_LOW(PH07) | \
1113  PIN_ODR_LEVEL_LOW(PH08) | \
1114  PIN_ODR_LEVEL_LOW(PH09) | \
1115  PIN_ODR_LEVEL_LOW(PH10) | \
1116  PIN_ODR_LEVEL_LOW(PH11) | \
1117  PIN_ODR_LEVEL_LOW(PH12) | \
1118  PIN_ODR_LEVEL_LOW(PH13) | \
1119  PIN_ODR_LEVEL_LOW(PH14) | \
1120  PIN_ODR_LEVEL_LOW(PH15))
1121 
1122 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1123  PIN_AFIO_AF(OSC_OUT, 0) | \
1124  PIN_AFIO_AF(PH02, 0) | \
1125  PIN_AFIO_AF(PH03, 0) | \
1126  PIN_AFIO_AF(PH04, 0) | \
1127  PIN_AFIO_AF(PH05, 0) | \
1128  PIN_AFIO_AF(PH06, 0) | \
1129  PIN_AFIO_AF(PH07, 0))
1130 
1131 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1132  PIN_AFIO_AF(PH09, 0) | \
1133  PIN_AFIO_AF(PH10, 0) | \
1134  PIN_AFIO_AF(PH11, 0) | \
1135  PIN_AFIO_AF(PH12, 0) | \
1136  PIN_AFIO_AF(PH13, 0) | \
1137  PIN_AFIO_AF(PH14, 0) | \
1138  PIN_AFIO_AF(PH15, 0))
1139 
1140 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1141  PIN_MODE_INPUT(PI01) | \
1142  PIN_MODE_INPUT(PI02) | \
1143  PIN_MODE_INPUT(PI03) | \
1144  PIN_MODE_INPUT(PI04) | \
1145  PIN_MODE_INPUT(PI05) | \
1146  PIN_MODE_INPUT(PI06) | \
1147  PIN_MODE_INPUT(PI07) | \
1148  PIN_MODE_INPUT(PI08) | \
1149  PIN_MODE_INPUT(PI09) | \
1150  PIN_MODE_INPUT(PI10) | \
1151  PIN_MODE_INPUT(PI11) | \
1152  PIN_MODE_INPUT(PI12) | \
1153  PIN_MODE_INPUT(PI13) | \
1154  PIN_MODE_INPUT(PI14) | \
1155  PIN_MODE_INPUT(PI15))
1156 
1157 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1158  PIN_OTYPE_PUSHPULL(PI01) | \
1159  PIN_OTYPE_PUSHPULL(PI02) | \
1160  PIN_OTYPE_PUSHPULL(PI03) | \
1161  PIN_OTYPE_PUSHPULL(PI04) | \
1162  PIN_OTYPE_PUSHPULL(PI05) | \
1163  PIN_OTYPE_PUSHPULL(PI06) | \
1164  PIN_OTYPE_PUSHPULL(PI07) | \
1165  PIN_OTYPE_PUSHPULL(PI08) | \
1166  PIN_OTYPE_PUSHPULL(PI09) | \
1167  PIN_OTYPE_PUSHPULL(PI10) | \
1168  PIN_OTYPE_PUSHPULL(PI11) | \
1169  PIN_OTYPE_PUSHPULL(PI12) | \
1170  PIN_OTYPE_PUSHPULL(PI13) | \
1171  PIN_OTYPE_PUSHPULL(PI14) | \
1172  PIN_OTYPE_PUSHPULL(PI15))
1173 
1174 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1175  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1176  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1177  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1178  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1179  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1180  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1181  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1182  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1183  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1184  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1185  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1186  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1187  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1188  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1189  PIN_OSPEED_SPEED_VERYLOW(PI15))
1190 
1191 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1192  PIN_PUPDR_PULLDOWN(PI01) | \
1193  PIN_PUPDR_PULLDOWN(PI02) | \
1194  PIN_PUPDR_PULLDOWN(PI03) | \
1195  PIN_PUPDR_PULLDOWN(PI04) | \
1196  PIN_PUPDR_PULLDOWN(PI05) | \
1197  PIN_PUPDR_PULLDOWN(PI06) | \
1198  PIN_PUPDR_PULLDOWN(PI07) | \
1199  PIN_PUPDR_PULLDOWN(PI08) | \
1200  PIN_PUPDR_PULLDOWN(PI09) | \
1201  PIN_PUPDR_PULLDOWN(PI10) | \
1202  PIN_PUPDR_PULLDOWN(PI11) | \
1203  PIN_PUPDR_PULLDOWN(PI12) | \
1204  PIN_PUPDR_PULLDOWN(PI13) | \
1205  PIN_PUPDR_PULLDOWN(PI14) | \
1206  PIN_PUPDR_PULLDOWN(PI15))
1207 
1208 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1209  PIN_ODR_LEVEL_LOW(PI01) | \
1210  PIN_ODR_LEVEL_LOW(PI02) | \
1211  PIN_ODR_LEVEL_LOW(PI03) | \
1212  PIN_ODR_LEVEL_LOW(PI04) | \
1213  PIN_ODR_LEVEL_LOW(PI05) | \
1214  PIN_ODR_LEVEL_LOW(PI06) | \
1215  PIN_ODR_LEVEL_LOW(PI07) | \
1216  PIN_ODR_LEVEL_LOW(PI08) | \
1217  PIN_ODR_LEVEL_LOW(PI09) | \
1218  PIN_ODR_LEVEL_LOW(PI10) | \
1219  PIN_ODR_LEVEL_LOW(PI11) | \
1220  PIN_ODR_LEVEL_LOW(PI12) | \
1221  PIN_ODR_LEVEL_LOW(PI13) | \
1222  PIN_ODR_LEVEL_LOW(PI14) | \
1223  PIN_ODR_LEVEL_LOW(PI15))
1224 
1225 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1226  PIN_AFIO_AF(PI01, 0) | \
1227  PIN_AFIO_AF(PI02, 0) | \
1228  PIN_AFIO_AF(PI03, 0) | \
1229  PIN_AFIO_AF(PI04, 0) | \
1230  PIN_AFIO_AF(PI05, 0) | \
1231  PIN_AFIO_AF(PI06, 0) | \
1232  PIN_AFIO_AF(PI07, 0))
1233 
1234 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1235  PIN_AFIO_AF(PI09, 0) | \
1236  PIN_AFIO_AF(PI10, 0) | \
1237  PIN_AFIO_AF(PI11, 0) | \
1238  PIN_AFIO_AF(PI12, 0) | \
1239  PIN_AFIO_AF(PI13, 0) | \
1240  PIN_AFIO_AF(PI14, 0) | \
1241  PIN_AFIO_AF(PI15, 0))
1242 
1243 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1244  PIN_MODE_INPUT(PJ01) | \
1245  PIN_MODE_INPUT(PJ02) | \
1246  PIN_MODE_INPUT(PJ03) | \
1247  PIN_MODE_INPUT(PJ04) | \
1248  PIN_MODE_INPUT(PJ05) | \
1249  PIN_MODE_INPUT(PJ06) | \
1250  PIN_MODE_INPUT(PJ07) | \
1251  PIN_MODE_INPUT(PJ08) | \
1252  PIN_MODE_INPUT(PJ09) | \
1253  PIN_MODE_INPUT(PJ10) | \
1254  PIN_MODE_INPUT(PJ11) | \
1255  PIN_MODE_INPUT(PJ12) | \
1256  PIN_MODE_INPUT(PJ13) | \
1257  PIN_MODE_INPUT(PJ14) | \
1258  PIN_MODE_INPUT(PJ15))
1259 
1260 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1261  PIN_OTYPE_PUSHPULL(PJ01) | \
1262  PIN_OTYPE_PUSHPULL(PJ02) | \
1263  PIN_OTYPE_PUSHPULL(PJ03) | \
1264  PIN_OTYPE_PUSHPULL(PJ04) | \
1265  PIN_OTYPE_PUSHPULL(PJ05) | \
1266  PIN_OTYPE_PUSHPULL(PJ06) | \
1267  PIN_OTYPE_PUSHPULL(PJ07) | \
1268  PIN_OTYPE_PUSHPULL(PJ08) | \
1269  PIN_OTYPE_PUSHPULL(PJ09) | \
1270  PIN_OTYPE_PUSHPULL(PJ10) | \
1271  PIN_OTYPE_PUSHPULL(PJ11) | \
1272  PIN_OTYPE_PUSHPULL(PJ12) | \
1273  PIN_OTYPE_PUSHPULL(PJ13) | \
1274  PIN_OTYPE_PUSHPULL(PJ14) | \
1275  PIN_OTYPE_PUSHPULL(PJ15))
1276 
1277 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1278  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1279  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1280  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1281  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1282  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1283  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1284  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1285  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1286  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1287  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1288  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1289  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1290  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1291  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1292  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1293 
1294 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1295  PIN_PUPDR_PULLDOWN(PJ01) | \
1296  PIN_PUPDR_PULLDOWN(PJ02) | \
1297  PIN_PUPDR_PULLDOWN(PJ03) | \
1298  PIN_PUPDR_PULLDOWN(PJ04) | \
1299  PIN_PUPDR_PULLDOWN(PJ05) | \
1300  PIN_PUPDR_PULLDOWN(PJ06) | \
1301  PIN_PUPDR_PULLDOWN(PJ07) | \
1302  PIN_PUPDR_PULLDOWN(PJ08) | \
1303  PIN_PUPDR_PULLDOWN(PJ09) | \
1304  PIN_PUPDR_PULLDOWN(PJ10) | \
1305  PIN_PUPDR_PULLDOWN(PJ11) | \
1306  PIN_PUPDR_PULLDOWN(PJ12) | \
1307  PIN_PUPDR_PULLDOWN(PJ13) | \
1308  PIN_PUPDR_PULLDOWN(PJ14) | \
1309  PIN_PUPDR_PULLDOWN(PJ15))
1310 
1311 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1312  PIN_ODR_LEVEL_LOW(PJ01) | \
1313  PIN_ODR_LEVEL_LOW(PJ02) | \
1314  PIN_ODR_LEVEL_LOW(PJ03) | \
1315  PIN_ODR_LEVEL_LOW(PJ04) | \
1316  PIN_ODR_LEVEL_LOW(PJ05) | \
1317  PIN_ODR_LEVEL_LOW(PJ06) | \
1318  PIN_ODR_LEVEL_LOW(PJ07) | \
1319  PIN_ODR_LEVEL_LOW(PJ08) | \
1320  PIN_ODR_LEVEL_LOW(PJ09) | \
1321  PIN_ODR_LEVEL_LOW(PJ10) | \
1322  PIN_ODR_LEVEL_LOW(PJ11) | \
1323  PIN_ODR_LEVEL_LOW(PJ12) | \
1324  PIN_ODR_LEVEL_LOW(PJ13) | \
1325  PIN_ODR_LEVEL_LOW(PJ14) | \
1326  PIN_ODR_LEVEL_LOW(PJ15))
1327 
1328 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1329  PIN_AFIO_AF(PJ01, 0) | \
1330  PIN_AFIO_AF(PJ02, 0) | \
1331  PIN_AFIO_AF(PJ03, 0) | \
1332  PIN_AFIO_AF(PJ04, 0) | \
1333  PIN_AFIO_AF(PJ05, 0) | \
1334  PIN_AFIO_AF(PJ06, 0) | \
1335  PIN_AFIO_AF(PJ07, 0))
1336 
1337 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1338  PIN_AFIO_AF(PJ09, 0) | \
1339  PIN_AFIO_AF(PJ10, 0) | \
1340  PIN_AFIO_AF(PJ11, 0) | \
1341  PIN_AFIO_AF(PJ12, 0) | \
1342  PIN_AFIO_AF(PJ13, 0) | \
1343  PIN_AFIO_AF(PJ14, 0) | \
1344  PIN_AFIO_AF(PJ15, 0))
1345 
1346 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1347  PIN_MODE_INPUT(PK01) | \
1348  PIN_MODE_INPUT(PK02) | \
1349  PIN_MODE_INPUT(PK03) | \
1350  PIN_MODE_INPUT(PK04) | \
1351  PIN_MODE_INPUT(PK05) | \
1352  PIN_MODE_INPUT(PK06) | \
1353  PIN_MODE_INPUT(PK07) | \
1354  PIN_MODE_INPUT(PK08) | \
1355  PIN_MODE_INPUT(PK09) | \
1356  PIN_MODE_INPUT(PK10) | \
1357  PIN_MODE_INPUT(PK11) | \
1358  PIN_MODE_INPUT(PK12) | \
1359  PIN_MODE_INPUT(PK13) | \
1360  PIN_MODE_INPUT(PK14) | \
1361  PIN_MODE_INPUT(PK15))
1362 
1363 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1364  PIN_OTYPE_PUSHPULL(PK01) | \
1365  PIN_OTYPE_PUSHPULL(PK02) | \
1366  PIN_OTYPE_PUSHPULL(PK03) | \
1367  PIN_OTYPE_PUSHPULL(PK04) | \
1368  PIN_OTYPE_PUSHPULL(PK05) | \
1369  PIN_OTYPE_PUSHPULL(PK06) | \
1370  PIN_OTYPE_PUSHPULL(PK07) | \
1371  PIN_OTYPE_PUSHPULL(PK08) | \
1372  PIN_OTYPE_PUSHPULL(PK09) | \
1373  PIN_OTYPE_PUSHPULL(PK10) | \
1374  PIN_OTYPE_PUSHPULL(PK11) | \
1375  PIN_OTYPE_PUSHPULL(PK12) | \
1376  PIN_OTYPE_PUSHPULL(PK13) | \
1377  PIN_OTYPE_PUSHPULL(PK14) | \
1378  PIN_OTYPE_PUSHPULL(PK15))
1379 
1380 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1381  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1382  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1383  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1384  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1385  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1386  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1387  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1388  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1389  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1390  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1391  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1392  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1393  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1394  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1395  PIN_OSPEED_SPEED_VERYLOW(PK15))
1396 
1397 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1398  PIN_PUPDR_PULLDOWN(PK01) | \
1399  PIN_PUPDR_PULLDOWN(PK02) | \
1400  PIN_PUPDR_PULLDOWN(PK03) | \
1401  PIN_PUPDR_PULLDOWN(PK04) | \
1402  PIN_PUPDR_PULLDOWN(PK05) | \
1403  PIN_PUPDR_PULLDOWN(PK06) | \
1404  PIN_PUPDR_PULLDOWN(PK07) | \
1405  PIN_PUPDR_PULLDOWN(PK08) | \
1406  PIN_PUPDR_PULLDOWN(PK09) | \
1407  PIN_PUPDR_PULLDOWN(PK10) | \
1408  PIN_PUPDR_PULLDOWN(PK11) | \
1409  PIN_PUPDR_PULLDOWN(PK12) | \
1410  PIN_PUPDR_PULLDOWN(PK13) | \
1411  PIN_PUPDR_PULLDOWN(PK14) | \
1412  PIN_PUPDR_PULLDOWN(PK15))
1413 
1414 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1415  PIN_ODR_LEVEL_LOW(PK01) | \
1416  PIN_ODR_LEVEL_LOW(PK02) | \
1417  PIN_ODR_LEVEL_LOW(PK03) | \
1418  PIN_ODR_LEVEL_LOW(PK04) | \
1419  PIN_ODR_LEVEL_LOW(PK05) | \
1420  PIN_ODR_LEVEL_LOW(PK06) | \
1421  PIN_ODR_LEVEL_LOW(PK07) | \
1422  PIN_ODR_LEVEL_LOW(PK08) | \
1423  PIN_ODR_LEVEL_LOW(PK09) | \
1424  PIN_ODR_LEVEL_LOW(PK10) | \
1425  PIN_ODR_LEVEL_LOW(PK11) | \
1426  PIN_ODR_LEVEL_LOW(PK12) | \
1427  PIN_ODR_LEVEL_LOW(PK13) | \
1428  PIN_ODR_LEVEL_LOW(PK14) | \
1429  PIN_ODR_LEVEL_LOW(PK15))
1430 
1431 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1432  PIN_AFIO_AF(PK01, 0) | \
1433  PIN_AFIO_AF(PK02, 0) | \
1434  PIN_AFIO_AF(PK03, 0) | \
1435  PIN_AFIO_AF(PK04, 0) | \
1436  PIN_AFIO_AF(PK05, 0) | \
1437  PIN_AFIO_AF(PK06, 0) | \
1438  PIN_AFIO_AF(PK07, 0))
1439 
1440 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1441  PIN_AFIO_AF(PK09, 0) | \
1442  PIN_AFIO_AF(PK10, 0) | \
1443  PIN_AFIO_AF(PK11, 0) | \
1444  PIN_AFIO_AF(PK12, 0) | \
1445  PIN_AFIO_AF(PK13, 0) | \
1446  PIN_AFIO_AF(PK14, 0) | \
1447  PIN_AFIO_AF(PK15, 0))
1448 
1449 #define AF_UART4_TX 8U
1450 #define AF_LINE_UART4_TX 8U
1451 #define AF_UART4_RX 8U
1452 #define AF_LINE_UART4_RX 8U
1453 #define AF_S6 2U
1454 #define AF_LINE_S6 2U
1455 #define AF_SPI1_SCK 5U
1456 #define AF_LINE_SPI1_SCK 5U
1457 #define AF_SPI1_MISO 5U
1458 #define AF_LINE_SPI1_MISO 5U
1459 #define AF_SPI1_MOSI 5U
1460 #define AF_LINE_SPI1_MOSI 5U
1461 #define AF_UART1_TX 7U
1462 #define AF_LINE_UART1_TX 7U
1463 #define AF_UART1_RX 7U
1464 #define AF_LINE_UART1_RX 7U
1465 #define AF_OTG_FS_DM 10U
1466 #define AF_LINE_OTG_FS_DM 10U
1467 #define AF_OTG_FS_DP 10U
1468 #define AF_LINE_OTG_FS_DP 10U
1469 #define AF_SWDIO 0U
1470 #define AF_LINE_SWDIO 0U
1471 #define AF_SWCLK 0U
1472 #define AF_LINE_SWCLK 0U
1473 #define AF_S4 2U
1474 #define AF_LINE_S4 2U
1475 #define AF_S1 1U
1476 #define AF_LINE_S1 1U
1477 #define AF_I2C1_SCL 4U
1478 #define AF_LINE_I2C1_SCL 4U
1479 #define AF_I2C1_SDA 4U
1480 #define AF_LINE_I2C1_SDA 4U
1481 #define AF_UART3_TX 7U
1482 #define AF_LINE_UART3_TX 7U
1483 #define AF_UART3_RX 7U
1484 #define AF_LINE_UART3_RX 7U
1485 #define AF_SPI2_SCK 5U
1486 #define AF_LINE_SPI2_SCK 5U
1487 #define AF_SPI2_MISO 5U
1488 #define AF_LINE_SPI2_MISO 5U
1489 #define AF_SPI2_MOSI 5U
1490 #define AF_LINE_SPI2_MOSI 5U
1491 #define AF_S5 2U
1492 #define AF_LINE_S5 2U
1493 #define AF_OSC32_IN 0U
1494 #define AF_LINE_OSC32_IN 0U
1495 #define AF_OSC32_OUT 0U
1496 #define AF_LINE_OSC32_OUT 0U
1497 #define AF_UART2_TX 7U
1498 #define AF_LINE_UART2_TX 7U
1499 #define AF_UART2_RX 7U
1500 #define AF_LINE_UART2_RX 7U
1501 #define AF_BUZZER 2U
1502 #define AF_LINE_BUZZER 2U
1503 #define AF_SPI4_CLK 5U
1504 #define AF_LINE_SPI4_CLK 5U
1505 #define AF_SPI4_MISO 5U
1506 #define AF_LINE_SPI4_MISO 5U
1507 #define AF_SPI4_MOSI 5U
1508 #define AF_LINE_SPI4_MOSI 5U
1509 #define AF_UART7_RX 8U
1510 #define AF_LINE_UART7_RX 8U
1511 #define AF_UART7_TX 8U
1512 #define AF_LINE_UART7_TX 8U
1513 #define AF_S2 1U
1514 #define AF_LINE_S2 1U
1515 #define AF_S3 1U
1516 #define AF_LINE_S3 1U
1517 #define AF_OSC_IN 0U
1518 #define AF_LINE_OSC_IN 0U
1519 #define AF_OSC_OUT 0U
1520 #define AF_LINE_OSC_OUT 0U
1521 
1522 
1523 #define S6_TIM 5
1524 #define S6_TIM_FN CH
1525 #define S6_TIM_CH 4
1526 #define S6_TIM_AF 2
1527 #define S4_TIM 3
1528 #define S4_TIM_FN CH
1529 #define S4_TIM_CH 3
1530 #define S4_TIM_AF 2
1531 #define S1_TIM 1
1532 #define S1_TIM_FN CH
1533 #define S1_TIM_CH 3
1534 #define S1_TIM_AF 1
1535 #define CURRENT_MEAS_ADC 1
1536 #define CURRENT_MEAS_ADC_FN IN
1537 #define CURRENT_MEAS_ADC_IN 12
1538 #define VBAT_MEAS_ADC 1
1539 #define VBAT_MEAS_ADC_FN IN
1540 #define VBAT_MEAS_ADC_IN 13
1541 #define RSSI_ADC 1
1542 #define RSSI_ADC_FN IN
1543 #define RSSI_ADC_IN 15
1544 #define RC2_TIM 8
1545 #define RC2_TIM_FN CH
1546 #define RC2_TIM_CH 1
1547 #define RC2_TIM_AF 3
1548 #define RC2_USART 6
1549 #define RC2_USART_FN TX
1550 #define RC2_USART_AF 8
1551 #define RC1_TIM 3
1552 #define RC1_TIM_FN CH
1553 #define RC1_TIM_CH 2
1554 #define RC1_TIM_AF 2
1555 #define RC1_USART 6
1556 #define RC1_USART_FN RX
1557 #define RC1_USART_AF 8
1558 #define S5_TIM 3
1559 #define S5_TIM_FN CH
1560 #define S5_TIM_CH 4
1561 #define S5_TIM_AF 2
1562 #define BUZZER_TIM 4
1563 #define BUZZER_TIM_FN CH
1564 #define BUZZER_TIM_CH 4
1565 #define BUZZER_TIM_AF 2
1566 #define S2_TIM 1
1567 #define S2_TIM_FN CH
1568 #define S2_TIM_CH 1
1569 #define S2_TIM_AF 1
1570 #define S3_TIM 1
1571 #define S3_TIM_FN CH
1572 #define S3_TIM_CH 2
1573 #define S3_TIM_AF 1
1574 
1575 #define BOARD_GROUP_DECLFOREACH(line, group) \
1576  static const ioline_t group ## _ARRAY[] = {group}; \
1577  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1578 
1579 #define BOARD_GROUP_FOREACH(line, group) \
1580  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1581 
1582 
1583 #define BOARD_GROUP_DECLFOR(array, index, group) \
1584  static const ioline_t group ## _ARRAY[] = {group}; \
1585  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1586 
1587 #define BOARD_GROUP_FOR(array, index, group) \
1588  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1589 
1590 #define ENERGY_SAVE_INPUT \
1591  LINE_LED1, \
1592  LINE_S6, \
1593  LINE_SDCARD_CS, \
1594  LINE_S4, \
1595  LINE_S1, \
1596  LINE_OSD_CS, \
1597  LINE_S5, \
1598  LINE_IMU_CS, \
1599  LINE_S2, \
1600  LINE_S3
1601 #define ENERGY_SAVE_INPUT_SIZE 10
1602 
1603 #if !defined(_FROM_ASM_)
1604 #ifdef __cplusplus
1605 extern "C" {
1606 #endif
1607  void boardInit(void);
1608 #ifdef __cplusplus
1609 }
1610 #endif
1611 #endif /* _FROM_ASM_ */
1612 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:317