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_MATEKF765_WING
23 #define BOARD_NAME "MATEKSYS F765-WING"
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 STM32F767xx
48 
49 /*
50  * IO pins assignments.
51  */
52 #define S1 0U
53 #define S2 1U
54 #define S3 2U
55 #define S4 3U
56 #define PA04 4U
57 #define SPI1_SCK 5U
58 #define SPI1_MISO 6U
59 #define SPI1_MOSI 7U
60 #define LED_WS2812 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 S5 0U
70 #define S6 1U
71 #define PB02 2U
72 #define SPI3_SCK 3U
73 #define SPI3_MISO 4U
74 #define SPI3_MOSI 5U
75 #define I2C1_SCL 6U
76 #define I2C1_SDA 7U
77 #define UART5_RX 8U
78 #define ALARM 9U
79 #define I2C2_SCL 10U
80 #define I2C2_SDA 11U
81 #define OSD_CS 12U
82 #define SPI2_SCK 13U
83 #define SPI2_MISO 14U
84 #define SPI2_MOSI 15U
85 
86 #define AIRSPEED 0U
87 #define RSSI 1U
88 #define VBAT_MEAS 2U
89 #define CURRENT_MEAS 3U
90 #define IMU1_CS 4U
91 #define PC05 5U
92 #define RC2 6U
93 #define RC1 7U
94 #define SDMMC1_D0 8U
95 #define SDMMC1_D1 9U
96 #define SDMMC1_D2 10U
97 #define SDMMC1_D3 11U
98 #define SDMMC1_CK 12U
99 #define PC13 13U
100 #define OSC32_IN 14U
101 #define OSC32_OUT 15U
102 
103 #define UART4_RX 0U
104 #define UART4_TX 1U
105 #define SDMMC1_CMD 2U
106 #define PD03 3U
107 #define PD04 4U
108 #define UART2_TX 5U
109 #define UART2_RX 6U
110 #define IMU2_CS 7U
111 #define UART3_TX 8U
112 #define UART3_RX 9U
113 #define LED1 10U
114 #define LED2 11U
115 #define S7 12U
116 #define S8 13U
117 #define S9 14U
118 #define S10 15U
119 
120 #define UART8_RX 0U
121 #define UART8_TX 1U
122 #define PE02 2U
123 #define PE03 3U
124 #define PE04 4U
125 #define S11 5U
126 #define S12 6U
127 #define UART7_RX 7U
128 #define UART7_TX 8U
129 #define UART7_RTS 9U
130 #define UART7_CTS 10U
131 #define SPI4_CS 11U
132 #define SPI4_CLK 12U
133 #define SPI4_MISO 13U
134 #define SPI4_MOSI 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_S1 PAL_LINE(GPIOA, 0U)
243 #define LINE_S2 PAL_LINE(GPIOA, 1U)
244 #define LINE_S3 PAL_LINE(GPIOA, 2U)
245 #define LINE_S4 PAL_LINE(GPIOA, 3U)
246 #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
247 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
248 #define LINE_SPI1_MOSI PAL_LINE(GPIOA, 7U)
249 #define LINE_LED_WS2812 PAL_LINE(GPIOA, 8U)
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_S5 PAL_LINE(GPIOB, 0U)
258 #define LINE_S6 PAL_LINE(GPIOB, 1U)
259 #define LINE_SPI3_SCK PAL_LINE(GPIOB, 3U)
260 #define LINE_SPI3_MISO PAL_LINE(GPIOB, 4U)
261 #define LINE_SPI3_MOSI PAL_LINE(GPIOB, 5U)
262 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
263 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
264 #define LINE_UART5_RX PAL_LINE(GPIOB, 8U)
265 #define LINE_ALARM PAL_LINE(GPIOB, 9U)
266 #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
267 #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
268 #define LINE_OSD_CS PAL_LINE(GPIOB, 12U)
269 #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
270 #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
271 #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
272 
273 #define LINE_AIRSPEED PAL_LINE(GPIOC, 0U)
274 #define LINE_RSSI PAL_LINE(GPIOC, 1U)
275 #define LINE_VBAT_MEAS PAL_LINE(GPIOC, 2U)
276 #define LINE_CURRENT_MEAS PAL_LINE(GPIOC, 3U)
277 #define LINE_IMU1_CS PAL_LINE(GPIOC, 4U)
278 #define LINE_RC2 PAL_LINE(GPIOC, 6U)
279 #define LINE_RC1 PAL_LINE(GPIOC, 7U)
280 #define LINE_SDMMC1_D0 PAL_LINE(GPIOC, 8U)
281 #define LINE_SDMMC1_D1 PAL_LINE(GPIOC, 9U)
282 #define LINE_SDMMC1_D2 PAL_LINE(GPIOC, 10U)
283 #define LINE_SDMMC1_D3 PAL_LINE(GPIOC, 11U)
284 #define LINE_SDMMC1_CK PAL_LINE(GPIOC, 12U)
285 #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
286 #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
287 
288 #define LINE_UART4_RX PAL_LINE(GPIOD, 0U)
289 #define LINE_UART4_TX PAL_LINE(GPIOD, 1U)
290 #define LINE_SDMMC1_CMD PAL_LINE(GPIOD, 2U)
291 #define LINE_UART2_TX PAL_LINE(GPIOD, 5U)
292 #define LINE_UART2_RX PAL_LINE(GPIOD, 6U)
293 #define LINE_IMU2_CS PAL_LINE(GPIOD, 7U)
294 #define LINE_UART3_TX PAL_LINE(GPIOD, 8U)
295 #define LINE_UART3_RX PAL_LINE(GPIOD, 9U)
296 #define LINE_LED1 PAL_LINE(GPIOD, 10U)
297 #define LINE_LED2 PAL_LINE(GPIOD, 11U)
298 #define LINE_S7 PAL_LINE(GPIOD, 12U)
299 #define LINE_S8 PAL_LINE(GPIOD, 13U)
300 #define LINE_S9 PAL_LINE(GPIOD, 14U)
301 #define LINE_S10 PAL_LINE(GPIOD, 15U)
302 
303 #define LINE_UART8_RX PAL_LINE(GPIOE, 0U)
304 #define LINE_UART8_TX PAL_LINE(GPIOE, 1U)
305 #define LINE_S11 PAL_LINE(GPIOE, 5U)
306 #define LINE_S12 PAL_LINE(GPIOE, 6U)
307 #define LINE_UART7_RX PAL_LINE(GPIOE, 7U)
308 #define LINE_UART7_TX PAL_LINE(GPIOE, 8U)
309 #define LINE_UART7_RTS PAL_LINE(GPIOE, 9U)
310 #define LINE_UART7_CTS PAL_LINE(GPIOE, 10U)
311 #define LINE_SPI4_CS PAL_LINE(GPIOE, 11U)
312 #define LINE_SPI4_CLK PAL_LINE(GPIOE, 12U)
313 #define LINE_SPI4_MISO PAL_LINE(GPIOE, 13U)
314 #define LINE_SPI4_MOSI PAL_LINE(GPIOE, 14U)
315 
316 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
317 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
318 
319 
320 /*
321  * I/O ports initial setup, this configuration is established soon after reset
322  * in the initialization code.
323  * Please refer to the STM32 Reference Manual for details.
324  */
325 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
326 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
327 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
328 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
329 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
330 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
331 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
332 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
333 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
334 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
335 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
336 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
337 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
338 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
339 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
340 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
341 
342 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(S1) | \
343  PIN_MODE_ALTERNATE(S2) | \
344  PIN_MODE_ALTERNATE(S3) | \
345  PIN_MODE_ALTERNATE(S4) | \
346  PIN_MODE_INPUT(PA04) | \
347  PIN_MODE_ALTERNATE(SPI1_SCK) | \
348  PIN_MODE_ALTERNATE(SPI1_MISO) | \
349  PIN_MODE_ALTERNATE(SPI1_MOSI) | \
350  PIN_MODE_ALTERNATE(LED_WS2812) | \
351  PIN_MODE_ALTERNATE(UART1_TX) | \
352  PIN_MODE_ALTERNATE(UART1_RX) | \
353  PIN_MODE_ALTERNATE(OTG_FS_DM) | \
354  PIN_MODE_ALTERNATE(OTG_FS_DP) | \
355  PIN_MODE_ALTERNATE(SWDIO) | \
356  PIN_MODE_ALTERNATE(SWCLK) | \
357  PIN_MODE_INPUT(PA15))
358 
359 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(S1) | \
360  PIN_OTYPE_PUSHPULL(S2) | \
361  PIN_OTYPE_PUSHPULL(S3) | \
362  PIN_OTYPE_PUSHPULL(S4) | \
363  PIN_OTYPE_PUSHPULL(PA04) | \
364  PIN_OTYPE_PUSHPULL(SPI1_SCK) | \
365  PIN_OTYPE_PUSHPULL(SPI1_MISO) | \
366  PIN_OTYPE_PUSHPULL(SPI1_MOSI) | \
367  PIN_OTYPE_PUSHPULL(LED_WS2812) | \
368  PIN_OTYPE_PUSHPULL(UART1_TX) | \
369  PIN_OTYPE_PUSHPULL(UART1_RX) | \
370  PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
371  PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
372  PIN_OTYPE_PUSHPULL(SWDIO) | \
373  PIN_OTYPE_PUSHPULL(SWCLK) | \
374  PIN_OTYPE_PUSHPULL(PA15))
375 
376 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(S1) | \
377  PIN_OSPEED_SPEED_HIGH(S2) | \
378  PIN_OSPEED_SPEED_HIGH(S3) | \
379  PIN_OSPEED_SPEED_HIGH(S4) | \
380  PIN_OSPEED_SPEED_VERYLOW(PA04) | \
381  PIN_OSPEED_SPEED_HIGH(SPI1_SCK) | \
382  PIN_OSPEED_SPEED_HIGH(SPI1_MISO) | \
383  PIN_OSPEED_SPEED_HIGH(SPI1_MOSI) | \
384  PIN_OSPEED_SPEED_HIGH(LED_WS2812) | \
385  PIN_OSPEED_SPEED_HIGH(UART1_TX) | \
386  PIN_OSPEED_SPEED_HIGH(UART1_RX) | \
387  PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
388  PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
389  PIN_OSPEED_SPEED_HIGH(SWDIO) | \
390  PIN_OSPEED_SPEED_HIGH(SWCLK) | \
391  PIN_OSPEED_SPEED_VERYLOW(PA15))
392 
393 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(S1) | \
394  PIN_PUPDR_FLOATING(S2) | \
395  PIN_PUPDR_FLOATING(S3) | \
396  PIN_PUPDR_FLOATING(S4) | \
397  PIN_PUPDR_PULLDOWN(PA04) | \
398  PIN_PUPDR_FLOATING(SPI1_SCK) | \
399  PIN_PUPDR_FLOATING(SPI1_MISO) | \
400  PIN_PUPDR_FLOATING(SPI1_MOSI) | \
401  PIN_PUPDR_FLOATING(LED_WS2812) | \
402  PIN_PUPDR_FLOATING(UART1_TX) | \
403  PIN_PUPDR_FLOATING(UART1_RX) | \
404  PIN_PUPDR_FLOATING(OTG_FS_DM) | \
405  PIN_PUPDR_FLOATING(OTG_FS_DP) | \
406  PIN_PUPDR_FLOATING(SWDIO) | \
407  PIN_PUPDR_FLOATING(SWCLK) | \
408  PIN_PUPDR_PULLDOWN(PA15))
409 
410 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_LOW(S1) | \
411  PIN_ODR_LEVEL_LOW(S2) | \
412  PIN_ODR_LEVEL_LOW(S3) | \
413  PIN_ODR_LEVEL_LOW(S4) | \
414  PIN_ODR_LEVEL_LOW(PA04) | \
415  PIN_ODR_LEVEL_HIGH(SPI1_SCK) | \
416  PIN_ODR_LEVEL_HIGH(SPI1_MISO) | \
417  PIN_ODR_LEVEL_HIGH(SPI1_MOSI) | \
418  PIN_ODR_LEVEL_LOW(LED_WS2812) | \
419  PIN_ODR_LEVEL_HIGH(UART1_TX) | \
420  PIN_ODR_LEVEL_HIGH(UART1_RX) | \
421  PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
422  PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
423  PIN_ODR_LEVEL_HIGH(SWDIO) | \
424  PIN_ODR_LEVEL_HIGH(SWCLK) | \
425  PIN_ODR_LEVEL_LOW(PA15))
426 
427 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(S1, 1) | \
428  PIN_AFIO_AF(S2, 1) | \
429  PIN_AFIO_AF(S3, 2) | \
430  PIN_AFIO_AF(S4, 2) | \
431  PIN_AFIO_AF(PA04, 0) | \
432  PIN_AFIO_AF(SPI1_SCK, 5) | \
433  PIN_AFIO_AF(SPI1_MISO, 5) | \
434  PIN_AFIO_AF(SPI1_MOSI, 5))
435 
436 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(LED_WS2812, 1) | \
437  PIN_AFIO_AF(UART1_TX, 7) | \
438  PIN_AFIO_AF(UART1_RX, 7) | \
439  PIN_AFIO_AF(OTG_FS_DM, 10) | \
440  PIN_AFIO_AF(OTG_FS_DP, 10) | \
441  PIN_AFIO_AF(SWDIO, 0) | \
442  PIN_AFIO_AF(SWCLK, 0) | \
443  PIN_AFIO_AF(PA15, 0))
444 
445 #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(S5) | \
446  PIN_MODE_ALTERNATE(S6) | \
447  PIN_MODE_INPUT(PB02) | \
448  PIN_MODE_ALTERNATE(SPI3_SCK) | \
449  PIN_MODE_ALTERNATE(SPI3_MISO) | \
450  PIN_MODE_ALTERNATE(SPI3_MOSI) | \
451  PIN_MODE_ALTERNATE(I2C1_SCL) | \
452  PIN_MODE_ALTERNATE(I2C1_SDA) | \
453  PIN_MODE_ALTERNATE(UART5_RX) | \
454  PIN_MODE_ALTERNATE(ALARM) | \
455  PIN_MODE_ALTERNATE(I2C2_SCL) | \
456  PIN_MODE_ALTERNATE(I2C2_SDA) | \
457  PIN_MODE_OUTPUT(OSD_CS) | \
458  PIN_MODE_ALTERNATE(SPI2_SCK) | \
459  PIN_MODE_ALTERNATE(SPI2_MISO) | \
460  PIN_MODE_ALTERNATE(SPI2_MOSI))
461 
462 #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(S5) | \
463  PIN_OTYPE_PUSHPULL(S6) | \
464  PIN_OTYPE_PUSHPULL(PB02) | \
465  PIN_OTYPE_PUSHPULL(SPI3_SCK) | \
466  PIN_OTYPE_PUSHPULL(SPI3_MISO) | \
467  PIN_OTYPE_PUSHPULL(SPI3_MOSI) | \
468  PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
469  PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
470  PIN_OTYPE_PUSHPULL(UART5_RX) | \
471  PIN_OTYPE_PUSHPULL(ALARM) | \
472  PIN_OTYPE_OPENDRAIN(I2C2_SCL) | \
473  PIN_OTYPE_OPENDRAIN(I2C2_SDA) | \
474  PIN_OTYPE_PUSHPULL(OSD_CS) | \
475  PIN_OTYPE_PUSHPULL(SPI2_SCK) | \
476  PIN_OTYPE_PUSHPULL(SPI2_MISO) | \
477  PIN_OTYPE_PUSHPULL(SPI2_MOSI))
478 
479 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_HIGH(S5) | \
480  PIN_OSPEED_SPEED_HIGH(S6) | \
481  PIN_OSPEED_SPEED_VERYLOW(PB02) | \
482  PIN_OSPEED_SPEED_HIGH(SPI3_SCK) | \
483  PIN_OSPEED_SPEED_HIGH(SPI3_MISO) | \
484  PIN_OSPEED_SPEED_HIGH(SPI3_MOSI) | \
485  PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
486  PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
487  PIN_OSPEED_SPEED_HIGH(UART5_RX) | \
488  PIN_OSPEED_SPEED_HIGH(ALARM) | \
489  PIN_OSPEED_SPEED_HIGH(I2C2_SCL) | \
490  PIN_OSPEED_SPEED_HIGH(I2C2_SDA) | \
491  PIN_OSPEED_SPEED_HIGH(OSD_CS) | \
492  PIN_OSPEED_SPEED_HIGH(SPI2_SCK) | \
493  PIN_OSPEED_SPEED_HIGH(SPI2_MISO) | \
494  PIN_OSPEED_SPEED_HIGH(SPI2_MOSI))
495 
496 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(S5) | \
497  PIN_PUPDR_FLOATING(S6) | \
498  PIN_PUPDR_PULLDOWN(PB02) | \
499  PIN_PUPDR_FLOATING(SPI3_SCK) | \
500  PIN_PUPDR_FLOATING(SPI3_MISO) | \
501  PIN_PUPDR_FLOATING(SPI3_MOSI) | \
502  PIN_PUPDR_PULLUP(I2C1_SCL) | \
503  PIN_PUPDR_PULLUP(I2C1_SDA) | \
504  PIN_PUPDR_FLOATING(UART5_RX) | \
505  PIN_PUPDR_FLOATING(ALARM) | \
506  PIN_PUPDR_PULLUP(I2C2_SCL) | \
507  PIN_PUPDR_PULLUP(I2C2_SDA) | \
508  PIN_PUPDR_FLOATING(OSD_CS) | \
509  PIN_PUPDR_FLOATING(SPI2_SCK) | \
510  PIN_PUPDR_FLOATING(SPI2_MISO) | \
511  PIN_PUPDR_FLOATING(SPI2_MOSI))
512 
513 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(S5) | \
514  PIN_ODR_LEVEL_LOW(S6) | \
515  PIN_ODR_LEVEL_LOW(PB02) | \
516  PIN_ODR_LEVEL_HIGH(SPI3_SCK) | \
517  PIN_ODR_LEVEL_HIGH(SPI3_MISO) | \
518  PIN_ODR_LEVEL_HIGH(SPI3_MOSI) | \
519  PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
520  PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
521  PIN_ODR_LEVEL_HIGH(UART5_RX) | \
522  PIN_ODR_LEVEL_LOW(ALARM) | \
523  PIN_ODR_LEVEL_HIGH(I2C2_SCL) | \
524  PIN_ODR_LEVEL_HIGH(I2C2_SDA) | \
525  PIN_ODR_LEVEL_HIGH(OSD_CS) | \
526  PIN_ODR_LEVEL_HIGH(SPI2_SCK) | \
527  PIN_ODR_LEVEL_HIGH(SPI2_MISO) | \
528  PIN_ODR_LEVEL_HIGH(SPI2_MOSI))
529 
530 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(S5, 3) | \
531  PIN_AFIO_AF(S6, 3) | \
532  PIN_AFIO_AF(PB02, 0) | \
533  PIN_AFIO_AF(SPI3_SCK, 6) | \
534  PIN_AFIO_AF(SPI3_MISO, 6) | \
535  PIN_AFIO_AF(SPI3_MOSI, 6) | \
536  PIN_AFIO_AF(I2C1_SCL, 4) | \
537  PIN_AFIO_AF(I2C1_SDA, 4))
538 
539 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(UART5_RX, 7) | \
540  PIN_AFIO_AF(ALARM, 3) | \
541  PIN_AFIO_AF(I2C2_SCL, 4) | \
542  PIN_AFIO_AF(I2C2_SDA, 4) | \
543  PIN_AFIO_AF(OSD_CS, 0) | \
544  PIN_AFIO_AF(SPI2_SCK, 5) | \
545  PIN_AFIO_AF(SPI2_MISO, 5) | \
546  PIN_AFIO_AF(SPI2_MOSI, 5))
547 
548 #define VAL_GPIOC_MODER (PIN_MODE_ANALOG(AIRSPEED) | \
549  PIN_MODE_ANALOG(RSSI) | \
550  PIN_MODE_ANALOG(VBAT_MEAS) | \
551  PIN_MODE_ANALOG(CURRENT_MEAS) | \
552  PIN_MODE_OUTPUT(IMU1_CS) | \
553  PIN_MODE_INPUT(PC05) | \
554  PIN_MODE_INPUT(RC2) | \
555  PIN_MODE_INPUT(RC1) | \
556  PIN_MODE_ALTERNATE(SDMMC1_D0) | \
557  PIN_MODE_ALTERNATE(SDMMC1_D1) | \
558  PIN_MODE_ALTERNATE(SDMMC1_D2) | \
559  PIN_MODE_ALTERNATE(SDMMC1_D3) | \
560  PIN_MODE_ALTERNATE(SDMMC1_CK) | \
561  PIN_MODE_INPUT(PC13) | \
562  PIN_MODE_ALTERNATE(OSC32_IN) | \
563  PIN_MODE_ALTERNATE(OSC32_OUT))
564 
565 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(AIRSPEED) | \
566  PIN_OTYPE_PUSHPULL(RSSI) | \
567  PIN_OTYPE_PUSHPULL(VBAT_MEAS) | \
568  PIN_OTYPE_PUSHPULL(CURRENT_MEAS) | \
569  PIN_OTYPE_PUSHPULL(IMU1_CS) | \
570  PIN_OTYPE_PUSHPULL(PC05) | \
571  PIN_OTYPE_OPENDRAIN(RC2) | \
572  PIN_OTYPE_OPENDRAIN(RC1) | \
573  PIN_OTYPE_PUSHPULL(SDMMC1_D0) | \
574  PIN_OTYPE_PUSHPULL(SDMMC1_D1) | \
575  PIN_OTYPE_PUSHPULL(SDMMC1_D2) | \
576  PIN_OTYPE_PUSHPULL(SDMMC1_D3) | \
577  PIN_OTYPE_PUSHPULL(SDMMC1_CK) | \
578  PIN_OTYPE_PUSHPULL(PC13) | \
579  PIN_OTYPE_PUSHPULL(OSC32_IN) | \
580  PIN_OTYPE_PUSHPULL(OSC32_OUT))
581 
582 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(AIRSPEED) | \
583  PIN_OSPEED_SPEED_VERYLOW(RSSI) | \
584  PIN_OSPEED_SPEED_VERYLOW(VBAT_MEAS) | \
585  PIN_OSPEED_SPEED_VERYLOW(CURRENT_MEAS) | \
586  PIN_OSPEED_SPEED_HIGH(IMU1_CS) | \
587  PIN_OSPEED_SPEED_VERYLOW(PC05) | \
588  PIN_OSPEED_SPEED_VERYLOW(RC2) | \
589  PIN_OSPEED_SPEED_VERYLOW(RC1) | \
590  PIN_OSPEED_SPEED_HIGH(SDMMC1_D0) | \
591  PIN_OSPEED_SPEED_HIGH(SDMMC1_D1) | \
592  PIN_OSPEED_SPEED_HIGH(SDMMC1_D2) | \
593  PIN_OSPEED_SPEED_HIGH(SDMMC1_D3) | \
594  PIN_OSPEED_SPEED_HIGH(SDMMC1_CK) | \
595  PIN_OSPEED_SPEED_VERYLOW(PC13) | \
596  PIN_OSPEED_SPEED_HIGH(OSC32_IN) | \
597  PIN_OSPEED_SPEED_HIGH(OSC32_OUT))
598 
599 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(AIRSPEED) | \
600  PIN_PUPDR_FLOATING(RSSI) | \
601  PIN_PUPDR_FLOATING(VBAT_MEAS) | \
602  PIN_PUPDR_FLOATING(CURRENT_MEAS) | \
603  PIN_PUPDR_FLOATING(IMU1_CS) | \
604  PIN_PUPDR_PULLDOWN(PC05) | \
605  PIN_PUPDR_PULLDOWN(RC2) | \
606  PIN_PUPDR_PULLDOWN(RC1) | \
607  PIN_PUPDR_PULLUP(SDMMC1_D0) | \
608  PIN_PUPDR_PULLUP(SDMMC1_D1) | \
609  PIN_PUPDR_PULLUP(SDMMC1_D2) | \
610  PIN_PUPDR_PULLUP(SDMMC1_D3) | \
611  PIN_PUPDR_PULLUP(SDMMC1_CK) | \
612  PIN_PUPDR_PULLDOWN(PC13) | \
613  PIN_PUPDR_FLOATING(OSC32_IN) | \
614  PIN_PUPDR_FLOATING(OSC32_OUT))
615 
616 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(AIRSPEED) | \
617  PIN_ODR_LEVEL_LOW(RSSI) | \
618  PIN_ODR_LEVEL_LOW(VBAT_MEAS) | \
619  PIN_ODR_LEVEL_LOW(CURRENT_MEAS) | \
620  PIN_ODR_LEVEL_HIGH(IMU1_CS) | \
621  PIN_ODR_LEVEL_LOW(PC05) | \
622  PIN_ODR_LEVEL_HIGH(RC2) | \
623  PIN_ODR_LEVEL_HIGH(RC1) | \
624  PIN_ODR_LEVEL_HIGH(SDMMC1_D0) | \
625  PIN_ODR_LEVEL_HIGH(SDMMC1_D1) | \
626  PIN_ODR_LEVEL_HIGH(SDMMC1_D2) | \
627  PIN_ODR_LEVEL_HIGH(SDMMC1_D3) | \
628  PIN_ODR_LEVEL_HIGH(SDMMC1_CK) | \
629  PIN_ODR_LEVEL_LOW(PC13) | \
630  PIN_ODR_LEVEL_HIGH(OSC32_IN) | \
631  PIN_ODR_LEVEL_HIGH(OSC32_OUT))
632 
633 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(AIRSPEED, 0) | \
634  PIN_AFIO_AF(RSSI, 0) | \
635  PIN_AFIO_AF(VBAT_MEAS, 0) | \
636  PIN_AFIO_AF(CURRENT_MEAS, 0) | \
637  PIN_AFIO_AF(IMU1_CS, 0) | \
638  PIN_AFIO_AF(PC05, 0) | \
639  PIN_AFIO_AF(RC2, 0) | \
640  PIN_AFIO_AF(RC1, 0))
641 
642 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(SDMMC1_D0, 12) | \
643  PIN_AFIO_AF(SDMMC1_D1, 12) | \
644  PIN_AFIO_AF(SDMMC1_D2, 12) | \
645  PIN_AFIO_AF(SDMMC1_D3, 12) | \
646  PIN_AFIO_AF(SDMMC1_CK, 12) | \
647  PIN_AFIO_AF(PC13, 0) | \
648  PIN_AFIO_AF(OSC32_IN, 0) | \
649  PIN_AFIO_AF(OSC32_OUT, 0))
650 
651 #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(UART4_RX) | \
652  PIN_MODE_ALTERNATE(UART4_TX) | \
653  PIN_MODE_ALTERNATE(SDMMC1_CMD) | \
654  PIN_MODE_INPUT(PD03) | \
655  PIN_MODE_INPUT(PD04) | \
656  PIN_MODE_ALTERNATE(UART2_TX) | \
657  PIN_MODE_ALTERNATE(UART2_RX) | \
658  PIN_MODE_OUTPUT(IMU2_CS) | \
659  PIN_MODE_ALTERNATE(UART3_TX) | \
660  PIN_MODE_ALTERNATE(UART3_RX) | \
661  PIN_MODE_OUTPUT(LED1) | \
662  PIN_MODE_OUTPUT(LED2) | \
663  PIN_MODE_ALTERNATE(S7) | \
664  PIN_MODE_ALTERNATE(S8) | \
665  PIN_MODE_ALTERNATE(S9) | \
666  PIN_MODE_ALTERNATE(S10))
667 
668 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(UART4_RX) | \
669  PIN_OTYPE_PUSHPULL(UART4_TX) | \
670  PIN_OTYPE_PUSHPULL(SDMMC1_CMD) | \
671  PIN_OTYPE_PUSHPULL(PD03) | \
672  PIN_OTYPE_PUSHPULL(PD04) | \
673  PIN_OTYPE_PUSHPULL(UART2_TX) | \
674  PIN_OTYPE_PUSHPULL(UART2_RX) | \
675  PIN_OTYPE_PUSHPULL(IMU2_CS) | \
676  PIN_OTYPE_PUSHPULL(UART3_TX) | \
677  PIN_OTYPE_PUSHPULL(UART3_RX) | \
678  PIN_OTYPE_PUSHPULL(LED1) | \
679  PIN_OTYPE_PUSHPULL(LED2) | \
680  PIN_OTYPE_PUSHPULL(S7) | \
681  PIN_OTYPE_PUSHPULL(S8) | \
682  PIN_OTYPE_PUSHPULL(S9) | \
683  PIN_OTYPE_PUSHPULL(S10))
684 
685 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART4_RX) | \
686  PIN_OSPEED_SPEED_HIGH(UART4_TX) | \
687  PIN_OSPEED_SPEED_HIGH(SDMMC1_CMD) | \
688  PIN_OSPEED_SPEED_VERYLOW(PD03) | \
689  PIN_OSPEED_SPEED_VERYLOW(PD04) | \
690  PIN_OSPEED_SPEED_HIGH(UART2_TX) | \
691  PIN_OSPEED_SPEED_HIGH(UART2_RX) | \
692  PIN_OSPEED_SPEED_HIGH(IMU2_CS) | \
693  PIN_OSPEED_SPEED_HIGH(UART3_TX) | \
694  PIN_OSPEED_SPEED_HIGH(UART3_RX) | \
695  PIN_OSPEED_SPEED_VERYLOW(LED1) | \
696  PIN_OSPEED_SPEED_VERYLOW(LED2) | \
697  PIN_OSPEED_SPEED_HIGH(S7) | \
698  PIN_OSPEED_SPEED_HIGH(S8) | \
699  PIN_OSPEED_SPEED_HIGH(S9) | \
700  PIN_OSPEED_SPEED_HIGH(S10))
701 
702 #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(UART4_RX) | \
703  PIN_PUPDR_FLOATING(UART4_TX) | \
704  PIN_PUPDR_PULLUP(SDMMC1_CMD) | \
705  PIN_PUPDR_PULLDOWN(PD03) | \
706  PIN_PUPDR_PULLDOWN(PD04) | \
707  PIN_PUPDR_FLOATING(UART2_TX) | \
708  PIN_PUPDR_FLOATING(UART2_RX) | \
709  PIN_PUPDR_FLOATING(IMU2_CS) | \
710  PIN_PUPDR_FLOATING(UART3_TX) | \
711  PIN_PUPDR_FLOATING(UART3_RX) | \
712  PIN_PUPDR_FLOATING(LED1) | \
713  PIN_PUPDR_FLOATING(LED2) | \
714  PIN_PUPDR_FLOATING(S7) | \
715  PIN_PUPDR_FLOATING(S8) | \
716  PIN_PUPDR_FLOATING(S9) | \
717  PIN_PUPDR_FLOATING(S10))
718 
719 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_HIGH(UART4_RX) | \
720  PIN_ODR_LEVEL_HIGH(UART4_TX) | \
721  PIN_ODR_LEVEL_HIGH(SDMMC1_CMD) | \
722  PIN_ODR_LEVEL_LOW(PD03) | \
723  PIN_ODR_LEVEL_LOW(PD04) | \
724  PIN_ODR_LEVEL_HIGH(UART2_TX) | \
725  PIN_ODR_LEVEL_HIGH(UART2_RX) | \
726  PIN_ODR_LEVEL_HIGH(IMU2_CS) | \
727  PIN_ODR_LEVEL_HIGH(UART3_TX) | \
728  PIN_ODR_LEVEL_HIGH(UART3_RX) | \
729  PIN_ODR_LEVEL_LOW(LED1) | \
730  PIN_ODR_LEVEL_LOW(LED2) | \
731  PIN_ODR_LEVEL_LOW(S7) | \
732  PIN_ODR_LEVEL_LOW(S8) | \
733  PIN_ODR_LEVEL_LOW(S9) | \
734  PIN_ODR_LEVEL_LOW(S10))
735 
736 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(UART4_RX, 8) | \
737  PIN_AFIO_AF(UART4_TX, 8) | \
738  PIN_AFIO_AF(SDMMC1_CMD, 12) | \
739  PIN_AFIO_AF(PD03, 0) | \
740  PIN_AFIO_AF(PD04, 0) | \
741  PIN_AFIO_AF(UART2_TX, 7) | \
742  PIN_AFIO_AF(UART2_RX, 7) | \
743  PIN_AFIO_AF(IMU2_CS, 0))
744 
745 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(UART3_TX, 7) | \
746  PIN_AFIO_AF(UART3_RX, 7) | \
747  PIN_AFIO_AF(LED1, 0) | \
748  PIN_AFIO_AF(LED2, 0) | \
749  PIN_AFIO_AF(S7, 2) | \
750  PIN_AFIO_AF(S8, 2) | \
751  PIN_AFIO_AF(S9, 2) | \
752  PIN_AFIO_AF(S10, 2))
753 
754 #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(UART8_RX) | \
755  PIN_MODE_ALTERNATE(UART8_TX) | \
756  PIN_MODE_INPUT(PE02) | \
757  PIN_MODE_INPUT(PE03) | \
758  PIN_MODE_INPUT(PE04) | \
759  PIN_MODE_ALTERNATE(S11) | \
760  PIN_MODE_ALTERNATE(S12) | \
761  PIN_MODE_ALTERNATE(UART7_RX) | \
762  PIN_MODE_ALTERNATE(UART7_TX) | \
763  PIN_MODE_ALTERNATE(UART7_RTS) | \
764  PIN_MODE_ALTERNATE(UART7_CTS) | \
765  PIN_MODE_OUTPUT(SPI4_CS) | \
766  PIN_MODE_ALTERNATE(SPI4_CLK) | \
767  PIN_MODE_ALTERNATE(SPI4_MISO) | \
768  PIN_MODE_ALTERNATE(SPI4_MOSI) | \
769  PIN_MODE_INPUT(PE15))
770 
771 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(UART8_RX) | \
772  PIN_OTYPE_PUSHPULL(UART8_TX) | \
773  PIN_OTYPE_PUSHPULL(PE02) | \
774  PIN_OTYPE_PUSHPULL(PE03) | \
775  PIN_OTYPE_PUSHPULL(PE04) | \
776  PIN_OTYPE_PUSHPULL(S11) | \
777  PIN_OTYPE_PUSHPULL(S12) | \
778  PIN_OTYPE_PUSHPULL(UART7_RX) | \
779  PIN_OTYPE_PUSHPULL(UART7_TX) | \
780  PIN_OTYPE_PUSHPULL(UART7_RTS) | \
781  PIN_OTYPE_PUSHPULL(UART7_CTS) | \
782  PIN_OTYPE_PUSHPULL(SPI4_CS) | \
783  PIN_OTYPE_PUSHPULL(SPI4_CLK) | \
784  PIN_OTYPE_PUSHPULL(SPI4_MISO) | \
785  PIN_OTYPE_PUSHPULL(SPI4_MOSI) | \
786  PIN_OTYPE_PUSHPULL(PE15))
787 
788 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART8_RX) | \
789  PIN_OSPEED_SPEED_HIGH(UART8_TX) | \
790  PIN_OSPEED_SPEED_VERYLOW(PE02) | \
791  PIN_OSPEED_SPEED_VERYLOW(PE03) | \
792  PIN_OSPEED_SPEED_VERYLOW(PE04) | \
793  PIN_OSPEED_SPEED_HIGH(S11) | \
794  PIN_OSPEED_SPEED_HIGH(S12) | \
795  PIN_OSPEED_SPEED_HIGH(UART7_RX) | \
796  PIN_OSPEED_SPEED_HIGH(UART7_TX) | \
797  PIN_OSPEED_SPEED_HIGH(UART7_RTS) | \
798  PIN_OSPEED_SPEED_HIGH(UART7_CTS) | \
799  PIN_OSPEED_SPEED_HIGH(SPI4_CS) | \
800  PIN_OSPEED_SPEED_HIGH(SPI4_CLK) | \
801  PIN_OSPEED_SPEED_HIGH(SPI4_MISO) | \
802  PIN_OSPEED_SPEED_HIGH(SPI4_MOSI) | \
803  PIN_OSPEED_SPEED_VERYLOW(PE15))
804 
805 #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(UART8_RX) | \
806  PIN_PUPDR_FLOATING(UART8_TX) | \
807  PIN_PUPDR_PULLDOWN(PE02) | \
808  PIN_PUPDR_PULLDOWN(PE03) | \
809  PIN_PUPDR_PULLDOWN(PE04) | \
810  PIN_PUPDR_FLOATING(S11) | \
811  PIN_PUPDR_FLOATING(S12) | \
812  PIN_PUPDR_FLOATING(UART7_RX) | \
813  PIN_PUPDR_FLOATING(UART7_TX) | \
814  PIN_PUPDR_FLOATING(UART7_RTS) | \
815  PIN_PUPDR_FLOATING(UART7_CTS) | \
816  PIN_PUPDR_FLOATING(SPI4_CS) | \
817  PIN_PUPDR_FLOATING(SPI4_CLK) | \
818  PIN_PUPDR_FLOATING(SPI4_MISO) | \
819  PIN_PUPDR_FLOATING(SPI4_MOSI) | \
820  PIN_PUPDR_PULLDOWN(PE15))
821 
822 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_HIGH(UART8_RX) | \
823  PIN_ODR_LEVEL_HIGH(UART8_TX) | \
824  PIN_ODR_LEVEL_LOW(PE02) | \
825  PIN_ODR_LEVEL_LOW(PE03) | \
826  PIN_ODR_LEVEL_LOW(PE04) | \
827  PIN_ODR_LEVEL_LOW(S11) | \
828  PIN_ODR_LEVEL_LOW(S12) | \
829  PIN_ODR_LEVEL_HIGH(UART7_RX) | \
830  PIN_ODR_LEVEL_HIGH(UART7_TX) | \
831  PIN_ODR_LEVEL_HIGH(UART7_RTS) | \
832  PIN_ODR_LEVEL_HIGH(UART7_CTS) | \
833  PIN_ODR_LEVEL_HIGH(SPI4_CS) | \
834  PIN_ODR_LEVEL_HIGH(SPI4_CLK) | \
835  PIN_ODR_LEVEL_HIGH(SPI4_MISO) | \
836  PIN_ODR_LEVEL_HIGH(SPI4_MOSI) | \
837  PIN_ODR_LEVEL_LOW(PE15))
838 
839 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(UART8_RX, 8) | \
840  PIN_AFIO_AF(UART8_TX, 8) | \
841  PIN_AFIO_AF(PE02, 0) | \
842  PIN_AFIO_AF(PE03, 0) | \
843  PIN_AFIO_AF(PE04, 0) | \
844  PIN_AFIO_AF(S11, 3) | \
845  PIN_AFIO_AF(S12, 3) | \
846  PIN_AFIO_AF(UART7_RX, 8))
847 
848 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(UART7_TX, 8) | \
849  PIN_AFIO_AF(UART7_RTS, 8) | \
850  PIN_AFIO_AF(UART7_CTS, 8) | \
851  PIN_AFIO_AF(SPI4_CS, 0) | \
852  PIN_AFIO_AF(SPI4_CLK, 5) | \
853  PIN_AFIO_AF(SPI4_MISO, 5) | \
854  PIN_AFIO_AF(SPI4_MOSI, 5) | \
855  PIN_AFIO_AF(PE15, 0))
856 
857 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
858  PIN_MODE_INPUT(PF01) | \
859  PIN_MODE_INPUT(PF02) | \
860  PIN_MODE_INPUT(PF03) | \
861  PIN_MODE_INPUT(PF04) | \
862  PIN_MODE_INPUT(PF05) | \
863  PIN_MODE_INPUT(PF06) | \
864  PIN_MODE_INPUT(PF07) | \
865  PIN_MODE_INPUT(PF08) | \
866  PIN_MODE_INPUT(PF09) | \
867  PIN_MODE_INPUT(PF10) | \
868  PIN_MODE_INPUT(PF11) | \
869  PIN_MODE_INPUT(PF12) | \
870  PIN_MODE_INPUT(PF13) | \
871  PIN_MODE_INPUT(PF14) | \
872  PIN_MODE_INPUT(PF15))
873 
874 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
875  PIN_OTYPE_PUSHPULL(PF01) | \
876  PIN_OTYPE_PUSHPULL(PF02) | \
877  PIN_OTYPE_PUSHPULL(PF03) | \
878  PIN_OTYPE_PUSHPULL(PF04) | \
879  PIN_OTYPE_PUSHPULL(PF05) | \
880  PIN_OTYPE_PUSHPULL(PF06) | \
881  PIN_OTYPE_PUSHPULL(PF07) | \
882  PIN_OTYPE_PUSHPULL(PF08) | \
883  PIN_OTYPE_PUSHPULL(PF09) | \
884  PIN_OTYPE_PUSHPULL(PF10) | \
885  PIN_OTYPE_PUSHPULL(PF11) | \
886  PIN_OTYPE_PUSHPULL(PF12) | \
887  PIN_OTYPE_PUSHPULL(PF13) | \
888  PIN_OTYPE_PUSHPULL(PF14) | \
889  PIN_OTYPE_PUSHPULL(PF15))
890 
891 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
892  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
893  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
894  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
895  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
896  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
897  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
898  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
899  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
900  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
901  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
902  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
903  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
904  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
905  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
906  PIN_OSPEED_SPEED_VERYLOW(PF15))
907 
908 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
909  PIN_PUPDR_PULLDOWN(PF01) | \
910  PIN_PUPDR_PULLDOWN(PF02) | \
911  PIN_PUPDR_PULLDOWN(PF03) | \
912  PIN_PUPDR_PULLDOWN(PF04) | \
913  PIN_PUPDR_PULLDOWN(PF05) | \
914  PIN_PUPDR_PULLDOWN(PF06) | \
915  PIN_PUPDR_PULLDOWN(PF07) | \
916  PIN_PUPDR_PULLDOWN(PF08) | \
917  PIN_PUPDR_PULLDOWN(PF09) | \
918  PIN_PUPDR_PULLDOWN(PF10) | \
919  PIN_PUPDR_PULLDOWN(PF11) | \
920  PIN_PUPDR_PULLDOWN(PF12) | \
921  PIN_PUPDR_PULLDOWN(PF13) | \
922  PIN_PUPDR_PULLDOWN(PF14) | \
923  PIN_PUPDR_PULLDOWN(PF15))
924 
925 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
926  PIN_ODR_LEVEL_LOW(PF01) | \
927  PIN_ODR_LEVEL_LOW(PF02) | \
928  PIN_ODR_LEVEL_LOW(PF03) | \
929  PIN_ODR_LEVEL_LOW(PF04) | \
930  PIN_ODR_LEVEL_LOW(PF05) | \
931  PIN_ODR_LEVEL_LOW(PF06) | \
932  PIN_ODR_LEVEL_LOW(PF07) | \
933  PIN_ODR_LEVEL_LOW(PF08) | \
934  PIN_ODR_LEVEL_LOW(PF09) | \
935  PIN_ODR_LEVEL_LOW(PF10) | \
936  PIN_ODR_LEVEL_LOW(PF11) | \
937  PIN_ODR_LEVEL_LOW(PF12) | \
938  PIN_ODR_LEVEL_LOW(PF13) | \
939  PIN_ODR_LEVEL_LOW(PF14) | \
940  PIN_ODR_LEVEL_LOW(PF15))
941 
942 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
943  PIN_AFIO_AF(PF01, 0) | \
944  PIN_AFIO_AF(PF02, 0) | \
945  PIN_AFIO_AF(PF03, 0) | \
946  PIN_AFIO_AF(PF04, 0) | \
947  PIN_AFIO_AF(PF05, 0) | \
948  PIN_AFIO_AF(PF06, 0) | \
949  PIN_AFIO_AF(PF07, 0))
950 
951 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
952  PIN_AFIO_AF(PF09, 0) | \
953  PIN_AFIO_AF(PF10, 0) | \
954  PIN_AFIO_AF(PF11, 0) | \
955  PIN_AFIO_AF(PF12, 0) | \
956  PIN_AFIO_AF(PF13, 0) | \
957  PIN_AFIO_AF(PF14, 0) | \
958  PIN_AFIO_AF(PF15, 0))
959 
960 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
961  PIN_MODE_INPUT(PG01) | \
962  PIN_MODE_INPUT(PG02) | \
963  PIN_MODE_INPUT(PG03) | \
964  PIN_MODE_INPUT(PG04) | \
965  PIN_MODE_INPUT(PG05) | \
966  PIN_MODE_INPUT(PG06) | \
967  PIN_MODE_INPUT(PG07) | \
968  PIN_MODE_INPUT(PG08) | \
969  PIN_MODE_INPUT(PG09) | \
970  PIN_MODE_INPUT(PG10) | \
971  PIN_MODE_INPUT(PG11) | \
972  PIN_MODE_INPUT(PG12) | \
973  PIN_MODE_INPUT(PG13) | \
974  PIN_MODE_INPUT(PG14) | \
975  PIN_MODE_INPUT(PG15))
976 
977 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
978  PIN_OTYPE_PUSHPULL(PG01) | \
979  PIN_OTYPE_PUSHPULL(PG02) | \
980  PIN_OTYPE_PUSHPULL(PG03) | \
981  PIN_OTYPE_PUSHPULL(PG04) | \
982  PIN_OTYPE_PUSHPULL(PG05) | \
983  PIN_OTYPE_PUSHPULL(PG06) | \
984  PIN_OTYPE_PUSHPULL(PG07) | \
985  PIN_OTYPE_PUSHPULL(PG08) | \
986  PIN_OTYPE_PUSHPULL(PG09) | \
987  PIN_OTYPE_PUSHPULL(PG10) | \
988  PIN_OTYPE_PUSHPULL(PG11) | \
989  PIN_OTYPE_PUSHPULL(PG12) | \
990  PIN_OTYPE_PUSHPULL(PG13) | \
991  PIN_OTYPE_PUSHPULL(PG14) | \
992  PIN_OTYPE_PUSHPULL(PG15))
993 
994 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
995  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
996  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
997  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
998  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
999  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1000  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1001  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1002  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1003  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1004  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1005  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1006  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1007  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1008  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1009  PIN_OSPEED_SPEED_VERYLOW(PG15))
1010 
1011 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1012  PIN_PUPDR_PULLDOWN(PG01) | \
1013  PIN_PUPDR_PULLDOWN(PG02) | \
1014  PIN_PUPDR_PULLDOWN(PG03) | \
1015  PIN_PUPDR_PULLDOWN(PG04) | \
1016  PIN_PUPDR_PULLDOWN(PG05) | \
1017  PIN_PUPDR_PULLDOWN(PG06) | \
1018  PIN_PUPDR_PULLDOWN(PG07) | \
1019  PIN_PUPDR_PULLDOWN(PG08) | \
1020  PIN_PUPDR_PULLDOWN(PG09) | \
1021  PIN_PUPDR_PULLDOWN(PG10) | \
1022  PIN_PUPDR_PULLDOWN(PG11) | \
1023  PIN_PUPDR_PULLDOWN(PG12) | \
1024  PIN_PUPDR_PULLDOWN(PG13) | \
1025  PIN_PUPDR_PULLDOWN(PG14) | \
1026  PIN_PUPDR_PULLDOWN(PG15))
1027 
1028 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1029  PIN_ODR_LEVEL_LOW(PG01) | \
1030  PIN_ODR_LEVEL_LOW(PG02) | \
1031  PIN_ODR_LEVEL_LOW(PG03) | \
1032  PIN_ODR_LEVEL_LOW(PG04) | \
1033  PIN_ODR_LEVEL_LOW(PG05) | \
1034  PIN_ODR_LEVEL_LOW(PG06) | \
1035  PIN_ODR_LEVEL_LOW(PG07) | \
1036  PIN_ODR_LEVEL_LOW(PG08) | \
1037  PIN_ODR_LEVEL_LOW(PG09) | \
1038  PIN_ODR_LEVEL_LOW(PG10) | \
1039  PIN_ODR_LEVEL_LOW(PG11) | \
1040  PIN_ODR_LEVEL_LOW(PG12) | \
1041  PIN_ODR_LEVEL_LOW(PG13) | \
1042  PIN_ODR_LEVEL_LOW(PG14) | \
1043  PIN_ODR_LEVEL_LOW(PG15))
1044 
1045 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1046  PIN_AFIO_AF(PG01, 0) | \
1047  PIN_AFIO_AF(PG02, 0) | \
1048  PIN_AFIO_AF(PG03, 0) | \
1049  PIN_AFIO_AF(PG04, 0) | \
1050  PIN_AFIO_AF(PG05, 0) | \
1051  PIN_AFIO_AF(PG06, 0) | \
1052  PIN_AFIO_AF(PG07, 0))
1053 
1054 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1055  PIN_AFIO_AF(PG09, 0) | \
1056  PIN_AFIO_AF(PG10, 0) | \
1057  PIN_AFIO_AF(PG11, 0) | \
1058  PIN_AFIO_AF(PG12, 0) | \
1059  PIN_AFIO_AF(PG13, 0) | \
1060  PIN_AFIO_AF(PG14, 0) | \
1061  PIN_AFIO_AF(PG15, 0))
1062 
1063 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1064  PIN_MODE_ALTERNATE(OSC_OUT) | \
1065  PIN_MODE_INPUT(PH02) | \
1066  PIN_MODE_INPUT(PH03) | \
1067  PIN_MODE_INPUT(PH04) | \
1068  PIN_MODE_INPUT(PH05) | \
1069  PIN_MODE_INPUT(PH06) | \
1070  PIN_MODE_INPUT(PH07) | \
1071  PIN_MODE_INPUT(PH08) | \
1072  PIN_MODE_INPUT(PH09) | \
1073  PIN_MODE_INPUT(PH10) | \
1074  PIN_MODE_INPUT(PH11) | \
1075  PIN_MODE_INPUT(PH12) | \
1076  PIN_MODE_INPUT(PH13) | \
1077  PIN_MODE_INPUT(PH14) | \
1078  PIN_MODE_INPUT(PH15))
1079 
1080 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1081  PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1082  PIN_OTYPE_PUSHPULL(PH02) | \
1083  PIN_OTYPE_PUSHPULL(PH03) | \
1084  PIN_OTYPE_PUSHPULL(PH04) | \
1085  PIN_OTYPE_PUSHPULL(PH05) | \
1086  PIN_OTYPE_PUSHPULL(PH06) | \
1087  PIN_OTYPE_PUSHPULL(PH07) | \
1088  PIN_OTYPE_PUSHPULL(PH08) | \
1089  PIN_OTYPE_PUSHPULL(PH09) | \
1090  PIN_OTYPE_PUSHPULL(PH10) | \
1091  PIN_OTYPE_PUSHPULL(PH11) | \
1092  PIN_OTYPE_PUSHPULL(PH12) | \
1093  PIN_OTYPE_PUSHPULL(PH13) | \
1094  PIN_OTYPE_PUSHPULL(PH14) | \
1095  PIN_OTYPE_PUSHPULL(PH15))
1096 
1097 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1098  PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1099  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1100  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1101  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1102  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1103  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1104  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1105  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1106  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1107  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1108  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1109  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1110  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1111  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1112  PIN_OSPEED_SPEED_VERYLOW(PH15))
1113 
1114 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1115  PIN_PUPDR_FLOATING(OSC_OUT) | \
1116  PIN_PUPDR_PULLDOWN(PH02) | \
1117  PIN_PUPDR_PULLDOWN(PH03) | \
1118  PIN_PUPDR_PULLDOWN(PH04) | \
1119  PIN_PUPDR_PULLDOWN(PH05) | \
1120  PIN_PUPDR_PULLDOWN(PH06) | \
1121  PIN_PUPDR_PULLDOWN(PH07) | \
1122  PIN_PUPDR_PULLDOWN(PH08) | \
1123  PIN_PUPDR_PULLDOWN(PH09) | \
1124  PIN_PUPDR_PULLDOWN(PH10) | \
1125  PIN_PUPDR_PULLDOWN(PH11) | \
1126  PIN_PUPDR_PULLDOWN(PH12) | \
1127  PIN_PUPDR_PULLDOWN(PH13) | \
1128  PIN_PUPDR_PULLDOWN(PH14) | \
1129  PIN_PUPDR_PULLDOWN(PH15))
1130 
1131 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1132  PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1133  PIN_ODR_LEVEL_LOW(PH02) | \
1134  PIN_ODR_LEVEL_LOW(PH03) | \
1135  PIN_ODR_LEVEL_LOW(PH04) | \
1136  PIN_ODR_LEVEL_LOW(PH05) | \
1137  PIN_ODR_LEVEL_LOW(PH06) | \
1138  PIN_ODR_LEVEL_LOW(PH07) | \
1139  PIN_ODR_LEVEL_LOW(PH08) | \
1140  PIN_ODR_LEVEL_LOW(PH09) | \
1141  PIN_ODR_LEVEL_LOW(PH10) | \
1142  PIN_ODR_LEVEL_LOW(PH11) | \
1143  PIN_ODR_LEVEL_LOW(PH12) | \
1144  PIN_ODR_LEVEL_LOW(PH13) | \
1145  PIN_ODR_LEVEL_LOW(PH14) | \
1146  PIN_ODR_LEVEL_LOW(PH15))
1147 
1148 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1149  PIN_AFIO_AF(OSC_OUT, 0) | \
1150  PIN_AFIO_AF(PH02, 0) | \
1151  PIN_AFIO_AF(PH03, 0) | \
1152  PIN_AFIO_AF(PH04, 0) | \
1153  PIN_AFIO_AF(PH05, 0) | \
1154  PIN_AFIO_AF(PH06, 0) | \
1155  PIN_AFIO_AF(PH07, 0))
1156 
1157 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1158  PIN_AFIO_AF(PH09, 0) | \
1159  PIN_AFIO_AF(PH10, 0) | \
1160  PIN_AFIO_AF(PH11, 0) | \
1161  PIN_AFIO_AF(PH12, 0) | \
1162  PIN_AFIO_AF(PH13, 0) | \
1163  PIN_AFIO_AF(PH14, 0) | \
1164  PIN_AFIO_AF(PH15, 0))
1165 
1166 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1167  PIN_MODE_INPUT(PI01) | \
1168  PIN_MODE_INPUT(PI02) | \
1169  PIN_MODE_INPUT(PI03) | \
1170  PIN_MODE_INPUT(PI04) | \
1171  PIN_MODE_INPUT(PI05) | \
1172  PIN_MODE_INPUT(PI06) | \
1173  PIN_MODE_INPUT(PI07) | \
1174  PIN_MODE_INPUT(PI08) | \
1175  PIN_MODE_INPUT(PI09) | \
1176  PIN_MODE_INPUT(PI10) | \
1177  PIN_MODE_INPUT(PI11) | \
1178  PIN_MODE_INPUT(PI12) | \
1179  PIN_MODE_INPUT(PI13) | \
1180  PIN_MODE_INPUT(PI14) | \
1181  PIN_MODE_INPUT(PI15))
1182 
1183 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1184  PIN_OTYPE_PUSHPULL(PI01) | \
1185  PIN_OTYPE_PUSHPULL(PI02) | \
1186  PIN_OTYPE_PUSHPULL(PI03) | \
1187  PIN_OTYPE_PUSHPULL(PI04) | \
1188  PIN_OTYPE_PUSHPULL(PI05) | \
1189  PIN_OTYPE_PUSHPULL(PI06) | \
1190  PIN_OTYPE_PUSHPULL(PI07) | \
1191  PIN_OTYPE_PUSHPULL(PI08) | \
1192  PIN_OTYPE_PUSHPULL(PI09) | \
1193  PIN_OTYPE_PUSHPULL(PI10) | \
1194  PIN_OTYPE_PUSHPULL(PI11) | \
1195  PIN_OTYPE_PUSHPULL(PI12) | \
1196  PIN_OTYPE_PUSHPULL(PI13) | \
1197  PIN_OTYPE_PUSHPULL(PI14) | \
1198  PIN_OTYPE_PUSHPULL(PI15))
1199 
1200 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1201  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1202  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1203  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1204  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1205  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1206  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1207  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1208  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1209  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1210  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1211  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1212  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1213  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1214  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1215  PIN_OSPEED_SPEED_VERYLOW(PI15))
1216 
1217 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1218  PIN_PUPDR_PULLDOWN(PI01) | \
1219  PIN_PUPDR_PULLDOWN(PI02) | \
1220  PIN_PUPDR_PULLDOWN(PI03) | \
1221  PIN_PUPDR_PULLDOWN(PI04) | \
1222  PIN_PUPDR_PULLDOWN(PI05) | \
1223  PIN_PUPDR_PULLDOWN(PI06) | \
1224  PIN_PUPDR_PULLDOWN(PI07) | \
1225  PIN_PUPDR_PULLDOWN(PI08) | \
1226  PIN_PUPDR_PULLDOWN(PI09) | \
1227  PIN_PUPDR_PULLDOWN(PI10) | \
1228  PIN_PUPDR_PULLDOWN(PI11) | \
1229  PIN_PUPDR_PULLDOWN(PI12) | \
1230  PIN_PUPDR_PULLDOWN(PI13) | \
1231  PIN_PUPDR_PULLDOWN(PI14) | \
1232  PIN_PUPDR_PULLDOWN(PI15))
1233 
1234 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1235  PIN_ODR_LEVEL_LOW(PI01) | \
1236  PIN_ODR_LEVEL_LOW(PI02) | \
1237  PIN_ODR_LEVEL_LOW(PI03) | \
1238  PIN_ODR_LEVEL_LOW(PI04) | \
1239  PIN_ODR_LEVEL_LOW(PI05) | \
1240  PIN_ODR_LEVEL_LOW(PI06) | \
1241  PIN_ODR_LEVEL_LOW(PI07) | \
1242  PIN_ODR_LEVEL_LOW(PI08) | \
1243  PIN_ODR_LEVEL_LOW(PI09) | \
1244  PIN_ODR_LEVEL_LOW(PI10) | \
1245  PIN_ODR_LEVEL_LOW(PI11) | \
1246  PIN_ODR_LEVEL_LOW(PI12) | \
1247  PIN_ODR_LEVEL_LOW(PI13) | \
1248  PIN_ODR_LEVEL_LOW(PI14) | \
1249  PIN_ODR_LEVEL_LOW(PI15))
1250 
1251 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1252  PIN_AFIO_AF(PI01, 0) | \
1253  PIN_AFIO_AF(PI02, 0) | \
1254  PIN_AFIO_AF(PI03, 0) | \
1255  PIN_AFIO_AF(PI04, 0) | \
1256  PIN_AFIO_AF(PI05, 0) | \
1257  PIN_AFIO_AF(PI06, 0) | \
1258  PIN_AFIO_AF(PI07, 0))
1259 
1260 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1261  PIN_AFIO_AF(PI09, 0) | \
1262  PIN_AFIO_AF(PI10, 0) | \
1263  PIN_AFIO_AF(PI11, 0) | \
1264  PIN_AFIO_AF(PI12, 0) | \
1265  PIN_AFIO_AF(PI13, 0) | \
1266  PIN_AFIO_AF(PI14, 0) | \
1267  PIN_AFIO_AF(PI15, 0))
1268 
1269 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1270  PIN_MODE_INPUT(PJ01) | \
1271  PIN_MODE_INPUT(PJ02) | \
1272  PIN_MODE_INPUT(PJ03) | \
1273  PIN_MODE_INPUT(PJ04) | \
1274  PIN_MODE_INPUT(PJ05) | \
1275  PIN_MODE_INPUT(PJ06) | \
1276  PIN_MODE_INPUT(PJ07) | \
1277  PIN_MODE_INPUT(PJ08) | \
1278  PIN_MODE_INPUT(PJ09) | \
1279  PIN_MODE_INPUT(PJ10) | \
1280  PIN_MODE_INPUT(PJ11) | \
1281  PIN_MODE_INPUT(PJ12) | \
1282  PIN_MODE_INPUT(PJ13) | \
1283  PIN_MODE_INPUT(PJ14) | \
1284  PIN_MODE_INPUT(PJ15))
1285 
1286 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1287  PIN_OTYPE_PUSHPULL(PJ01) | \
1288  PIN_OTYPE_PUSHPULL(PJ02) | \
1289  PIN_OTYPE_PUSHPULL(PJ03) | \
1290  PIN_OTYPE_PUSHPULL(PJ04) | \
1291  PIN_OTYPE_PUSHPULL(PJ05) | \
1292  PIN_OTYPE_PUSHPULL(PJ06) | \
1293  PIN_OTYPE_PUSHPULL(PJ07) | \
1294  PIN_OTYPE_PUSHPULL(PJ08) | \
1295  PIN_OTYPE_PUSHPULL(PJ09) | \
1296  PIN_OTYPE_PUSHPULL(PJ10) | \
1297  PIN_OTYPE_PUSHPULL(PJ11) | \
1298  PIN_OTYPE_PUSHPULL(PJ12) | \
1299  PIN_OTYPE_PUSHPULL(PJ13) | \
1300  PIN_OTYPE_PUSHPULL(PJ14) | \
1301  PIN_OTYPE_PUSHPULL(PJ15))
1302 
1303 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1304  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1305  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1306  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1307  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1308  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1309  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1310  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1311  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1312  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1313  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1314  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1315  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1316  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1317  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1318  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1319 
1320 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1321  PIN_PUPDR_PULLDOWN(PJ01) | \
1322  PIN_PUPDR_PULLDOWN(PJ02) | \
1323  PIN_PUPDR_PULLDOWN(PJ03) | \
1324  PIN_PUPDR_PULLDOWN(PJ04) | \
1325  PIN_PUPDR_PULLDOWN(PJ05) | \
1326  PIN_PUPDR_PULLDOWN(PJ06) | \
1327  PIN_PUPDR_PULLDOWN(PJ07) | \
1328  PIN_PUPDR_PULLDOWN(PJ08) | \
1329  PIN_PUPDR_PULLDOWN(PJ09) | \
1330  PIN_PUPDR_PULLDOWN(PJ10) | \
1331  PIN_PUPDR_PULLDOWN(PJ11) | \
1332  PIN_PUPDR_PULLDOWN(PJ12) | \
1333  PIN_PUPDR_PULLDOWN(PJ13) | \
1334  PIN_PUPDR_PULLDOWN(PJ14) | \
1335  PIN_PUPDR_PULLDOWN(PJ15))
1336 
1337 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1338  PIN_ODR_LEVEL_LOW(PJ01) | \
1339  PIN_ODR_LEVEL_LOW(PJ02) | \
1340  PIN_ODR_LEVEL_LOW(PJ03) | \
1341  PIN_ODR_LEVEL_LOW(PJ04) | \
1342  PIN_ODR_LEVEL_LOW(PJ05) | \
1343  PIN_ODR_LEVEL_LOW(PJ06) | \
1344  PIN_ODR_LEVEL_LOW(PJ07) | \
1345  PIN_ODR_LEVEL_LOW(PJ08) | \
1346  PIN_ODR_LEVEL_LOW(PJ09) | \
1347  PIN_ODR_LEVEL_LOW(PJ10) | \
1348  PIN_ODR_LEVEL_LOW(PJ11) | \
1349  PIN_ODR_LEVEL_LOW(PJ12) | \
1350  PIN_ODR_LEVEL_LOW(PJ13) | \
1351  PIN_ODR_LEVEL_LOW(PJ14) | \
1352  PIN_ODR_LEVEL_LOW(PJ15))
1353 
1354 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1355  PIN_AFIO_AF(PJ01, 0) | \
1356  PIN_AFIO_AF(PJ02, 0) | \
1357  PIN_AFIO_AF(PJ03, 0) | \
1358  PIN_AFIO_AF(PJ04, 0) | \
1359  PIN_AFIO_AF(PJ05, 0) | \
1360  PIN_AFIO_AF(PJ06, 0) | \
1361  PIN_AFIO_AF(PJ07, 0))
1362 
1363 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1364  PIN_AFIO_AF(PJ09, 0) | \
1365  PIN_AFIO_AF(PJ10, 0) | \
1366  PIN_AFIO_AF(PJ11, 0) | \
1367  PIN_AFIO_AF(PJ12, 0) | \
1368  PIN_AFIO_AF(PJ13, 0) | \
1369  PIN_AFIO_AF(PJ14, 0) | \
1370  PIN_AFIO_AF(PJ15, 0))
1371 
1372 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1373  PIN_MODE_INPUT(PK01) | \
1374  PIN_MODE_INPUT(PK02) | \
1375  PIN_MODE_INPUT(PK03) | \
1376  PIN_MODE_INPUT(PK04) | \
1377  PIN_MODE_INPUT(PK05) | \
1378  PIN_MODE_INPUT(PK06) | \
1379  PIN_MODE_INPUT(PK07) | \
1380  PIN_MODE_INPUT(PK08) | \
1381  PIN_MODE_INPUT(PK09) | \
1382  PIN_MODE_INPUT(PK10) | \
1383  PIN_MODE_INPUT(PK11) | \
1384  PIN_MODE_INPUT(PK12) | \
1385  PIN_MODE_INPUT(PK13) | \
1386  PIN_MODE_INPUT(PK14) | \
1387  PIN_MODE_INPUT(PK15))
1388 
1389 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1390  PIN_OTYPE_PUSHPULL(PK01) | \
1391  PIN_OTYPE_PUSHPULL(PK02) | \
1392  PIN_OTYPE_PUSHPULL(PK03) | \
1393  PIN_OTYPE_PUSHPULL(PK04) | \
1394  PIN_OTYPE_PUSHPULL(PK05) | \
1395  PIN_OTYPE_PUSHPULL(PK06) | \
1396  PIN_OTYPE_PUSHPULL(PK07) | \
1397  PIN_OTYPE_PUSHPULL(PK08) | \
1398  PIN_OTYPE_PUSHPULL(PK09) | \
1399  PIN_OTYPE_PUSHPULL(PK10) | \
1400  PIN_OTYPE_PUSHPULL(PK11) | \
1401  PIN_OTYPE_PUSHPULL(PK12) | \
1402  PIN_OTYPE_PUSHPULL(PK13) | \
1403  PIN_OTYPE_PUSHPULL(PK14) | \
1404  PIN_OTYPE_PUSHPULL(PK15))
1405 
1406 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1407  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1408  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1409  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1410  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1411  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1412  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1413  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1414  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1415  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1416  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1417  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1418  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1419  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1420  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1421  PIN_OSPEED_SPEED_VERYLOW(PK15))
1422 
1423 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1424  PIN_PUPDR_PULLDOWN(PK01) | \
1425  PIN_PUPDR_PULLDOWN(PK02) | \
1426  PIN_PUPDR_PULLDOWN(PK03) | \
1427  PIN_PUPDR_PULLDOWN(PK04) | \
1428  PIN_PUPDR_PULLDOWN(PK05) | \
1429  PIN_PUPDR_PULLDOWN(PK06) | \
1430  PIN_PUPDR_PULLDOWN(PK07) | \
1431  PIN_PUPDR_PULLDOWN(PK08) | \
1432  PIN_PUPDR_PULLDOWN(PK09) | \
1433  PIN_PUPDR_PULLDOWN(PK10) | \
1434  PIN_PUPDR_PULLDOWN(PK11) | \
1435  PIN_PUPDR_PULLDOWN(PK12) | \
1436  PIN_PUPDR_PULLDOWN(PK13) | \
1437  PIN_PUPDR_PULLDOWN(PK14) | \
1438  PIN_PUPDR_PULLDOWN(PK15))
1439 
1440 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1441  PIN_ODR_LEVEL_LOW(PK01) | \
1442  PIN_ODR_LEVEL_LOW(PK02) | \
1443  PIN_ODR_LEVEL_LOW(PK03) | \
1444  PIN_ODR_LEVEL_LOW(PK04) | \
1445  PIN_ODR_LEVEL_LOW(PK05) | \
1446  PIN_ODR_LEVEL_LOW(PK06) | \
1447  PIN_ODR_LEVEL_LOW(PK07) | \
1448  PIN_ODR_LEVEL_LOW(PK08) | \
1449  PIN_ODR_LEVEL_LOW(PK09) | \
1450  PIN_ODR_LEVEL_LOW(PK10) | \
1451  PIN_ODR_LEVEL_LOW(PK11) | \
1452  PIN_ODR_LEVEL_LOW(PK12) | \
1453  PIN_ODR_LEVEL_LOW(PK13) | \
1454  PIN_ODR_LEVEL_LOW(PK14) | \
1455  PIN_ODR_LEVEL_LOW(PK15))
1456 
1457 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1458  PIN_AFIO_AF(PK01, 0) | \
1459  PIN_AFIO_AF(PK02, 0) | \
1460  PIN_AFIO_AF(PK03, 0) | \
1461  PIN_AFIO_AF(PK04, 0) | \
1462  PIN_AFIO_AF(PK05, 0) | \
1463  PIN_AFIO_AF(PK06, 0) | \
1464  PIN_AFIO_AF(PK07, 0))
1465 
1466 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1467  PIN_AFIO_AF(PK09, 0) | \
1468  PIN_AFIO_AF(PK10, 0) | \
1469  PIN_AFIO_AF(PK11, 0) | \
1470  PIN_AFIO_AF(PK12, 0) | \
1471  PIN_AFIO_AF(PK13, 0) | \
1472  PIN_AFIO_AF(PK14, 0) | \
1473  PIN_AFIO_AF(PK15, 0))
1474 
1475 #define AF_S1 1U
1476 #define AF_LINE_S1 1U
1477 #define AF_S2 1U
1478 #define AF_LINE_S2 1U
1479 #define AF_S3 2U
1480 #define AF_LINE_S3 2U
1481 #define AF_S4 2U
1482 #define AF_LINE_S4 2U
1483 #define AF_SPI1_SCK 5U
1484 #define AF_LINE_SPI1_SCK 5U
1485 #define AF_SPI1_MISO 5U
1486 #define AF_LINE_SPI1_MISO 5U
1487 #define AF_SPI1_MOSI 5U
1488 #define AF_LINE_SPI1_MOSI 5U
1489 #define AF_LED_WS2812 1U
1490 #define AF_LINE_LED_WS2812 1U
1491 #define AF_UART1_TX 7U
1492 #define AF_LINE_UART1_TX 7U
1493 #define AF_UART1_RX 7U
1494 #define AF_LINE_UART1_RX 7U
1495 #define AF_OTG_FS_DM 10U
1496 #define AF_LINE_OTG_FS_DM 10U
1497 #define AF_OTG_FS_DP 10U
1498 #define AF_LINE_OTG_FS_DP 10U
1499 #define AF_SWDIO 0U
1500 #define AF_LINE_SWDIO 0U
1501 #define AF_SWCLK 0U
1502 #define AF_LINE_SWCLK 0U
1503 #define AF_S5 3U
1504 #define AF_LINE_S5 3U
1505 #define AF_S6 3U
1506 #define AF_LINE_S6 3U
1507 #define AF_SPI3_SCK 6U
1508 #define AF_LINE_SPI3_SCK 6U
1509 #define AF_SPI3_MISO 6U
1510 #define AF_LINE_SPI3_MISO 6U
1511 #define AF_SPI3_MOSI 6U
1512 #define AF_LINE_SPI3_MOSI 6U
1513 #define AF_I2C1_SCL 4U
1514 #define AF_LINE_I2C1_SCL 4U
1515 #define AF_I2C1_SDA 4U
1516 #define AF_LINE_I2C1_SDA 4U
1517 #define AF_UART5_RX 7U
1518 #define AF_LINE_UART5_RX 7U
1519 #define AF_ALARM 3U
1520 #define AF_LINE_ALARM 3U
1521 #define AF_I2C2_SCL 4U
1522 #define AF_LINE_I2C2_SCL 4U
1523 #define AF_I2C2_SDA 4U
1524 #define AF_LINE_I2C2_SDA 4U
1525 #define AF_SPI2_SCK 5U
1526 #define AF_LINE_SPI2_SCK 5U
1527 #define AF_SPI2_MISO 5U
1528 #define AF_LINE_SPI2_MISO 5U
1529 #define AF_SPI2_MOSI 5U
1530 #define AF_LINE_SPI2_MOSI 5U
1531 #define AF_SDMMC1_D0 12U
1532 #define AF_LINE_SDMMC1_D0 12U
1533 #define AF_SDMMC1_D1 12U
1534 #define AF_LINE_SDMMC1_D1 12U
1535 #define AF_SDMMC1_D2 12U
1536 #define AF_LINE_SDMMC1_D2 12U
1537 #define AF_SDMMC1_D3 12U
1538 #define AF_LINE_SDMMC1_D3 12U
1539 #define AF_SDMMC1_CK 12U
1540 #define AF_LINE_SDMMC1_CK 12U
1541 #define AF_OSC32_IN 0U
1542 #define AF_LINE_OSC32_IN 0U
1543 #define AF_OSC32_OUT 0U
1544 #define AF_LINE_OSC32_OUT 0U
1545 #define AF_UART4_RX 8U
1546 #define AF_LINE_UART4_RX 8U
1547 #define AF_UART4_TX 8U
1548 #define AF_LINE_UART4_TX 8U
1549 #define AF_SDMMC1_CMD 12U
1550 #define AF_LINE_SDMMC1_CMD 12U
1551 #define AF_UART2_TX 7U
1552 #define AF_LINE_UART2_TX 7U
1553 #define AF_UART2_RX 7U
1554 #define AF_LINE_UART2_RX 7U
1555 #define AF_UART3_TX 7U
1556 #define AF_LINE_UART3_TX 7U
1557 #define AF_UART3_RX 7U
1558 #define AF_LINE_UART3_RX 7U
1559 #define AF_S7 2U
1560 #define AF_LINE_S7 2U
1561 #define AF_S8 2U
1562 #define AF_LINE_S8 2U
1563 #define AF_S9 2U
1564 #define AF_LINE_S9 2U
1565 #define AF_S10 2U
1566 #define AF_LINE_S10 2U
1567 #define AF_UART8_RX 8U
1568 #define AF_LINE_UART8_RX 8U
1569 #define AF_UART8_TX 8U
1570 #define AF_LINE_UART8_TX 8U
1571 #define AF_S11 3U
1572 #define AF_LINE_S11 3U
1573 #define AF_S12 3U
1574 #define AF_LINE_S12 3U
1575 #define AF_UART7_RX 8U
1576 #define AF_LINE_UART7_RX 8U
1577 #define AF_UART7_TX 8U
1578 #define AF_LINE_UART7_TX 8U
1579 #define AF_UART7_RTS 8U
1580 #define AF_LINE_UART7_RTS 8U
1581 #define AF_UART7_CTS 8U
1582 #define AF_LINE_UART7_CTS 8U
1583 #define AF_SPI4_CLK 5U
1584 #define AF_LINE_SPI4_CLK 5U
1585 #define AF_SPI4_MISO 5U
1586 #define AF_LINE_SPI4_MISO 5U
1587 #define AF_SPI4_MOSI 5U
1588 #define AF_LINE_SPI4_MOSI 5U
1589 #define AF_OSC_IN 0U
1590 #define AF_LINE_OSC_IN 0U
1591 #define AF_OSC_OUT 0U
1592 #define AF_LINE_OSC_OUT 0U
1593 
1594 
1595 #define S1_TIM 2
1596 #define S1_TIM_FN CH
1597 #define S1_TIM_CH 1
1598 #define S1_TIM_AF 1
1599 #define S2_TIM 2
1600 #define S2_TIM_FN CH
1601 #define S2_TIM_CH 2
1602 #define S2_TIM_AF 1
1603 #define S3_TIM 5
1604 #define S3_TIM_FN CH
1605 #define S3_TIM_CH 3
1606 #define S3_TIM_AF 2
1607 #define S4_TIM 5
1608 #define S4_TIM_FN CH
1609 #define S4_TIM_CH 4
1610 #define S4_TIM_AF 2
1611 #define LED_WS2812_TIM 1
1612 #define LED_WS2812_TIM_FN CH
1613 #define LED_WS2812_TIM_CH 1
1614 #define LED_WS2812_TIM_AF 1
1615 #define S5_TIM 8
1616 #define S5_TIM_FN CH
1617 #define S5_TIM_CH 2
1618 #define S5_TIM_AF 3
1619 #define S6_TIM 8
1620 #define S6_TIM_FN CH
1621 #define S6_TIM_CH 3
1622 #define S6_TIM_AF 3
1623 #define ALARM_TIM 11
1624 #define ALARM_TIM_FN CH
1625 #define ALARM_TIM_CH 1
1626 #define ALARM_TIM_AF 3
1627 #define AIRSPEED_ADC 1
1628 #define AIRSPEED_ADC_FN IN
1629 #define AIRSPEED_ADC_IN 10
1630 #define RSSI_ADC 1
1631 #define RSSI_ADC_FN IN
1632 #define RSSI_ADC_IN 11
1633 #define VBAT_MEAS_ADC 1
1634 #define VBAT_MEAS_ADC_FN IN
1635 #define VBAT_MEAS_ADC_IN 12
1636 #define CURRENT_MEAS_ADC 1
1637 #define CURRENT_MEAS_ADC_FN IN
1638 #define CURRENT_MEAS_ADC_IN 13
1639 #define RC2_TIM 8
1640 #define RC2_TIM_FN CH
1641 #define RC2_TIM_CH 1
1642 #define RC2_TIM_AF 3
1643 #define RC2_USART 6
1644 #define RC2_USART_FN TX
1645 #define RC2_USART_AF 8
1646 #define RC1_TIM 3
1647 #define RC1_TIM_FN CH
1648 #define RC1_TIM_CH 2
1649 #define RC1_TIM_AF 2
1650 #define RC1_USART 6
1651 #define RC1_USART_FN RX
1652 #define RC1_USART_AF 8
1653 #define UART4_RX_CAN 1
1654 #define UART4_RX_CAN_FN RX
1655 #define UART4_RX_CAN_AF 9
1656 #define UART4_TX_CAN 1
1657 #define UART4_TX_CAN_FN TX
1658 #define UART4_TX_CAN_AF 9
1659 #define S7_TIM 4
1660 #define S7_TIM_FN CH
1661 #define S7_TIM_CH 1
1662 #define S7_TIM_AF 2
1663 #define S8_TIM 4
1664 #define S8_TIM_FN CH
1665 #define S8_TIM_CH 2
1666 #define S8_TIM_AF 2
1667 #define S9_TIM 4
1668 #define S9_TIM_FN CH
1669 #define S9_TIM_CH 3
1670 #define S9_TIM_AF 2
1671 #define S10_TIM 4
1672 #define S10_TIM_FN CH
1673 #define S10_TIM_CH 4
1674 #define S10_TIM_AF 2
1675 #define S11_TIM 9
1676 #define S11_TIM_FN CH
1677 #define S11_TIM_CH 1
1678 #define S11_TIM_AF 3
1679 #define S12_TIM 9
1680 #define S12_TIM_FN CH
1681 #define S12_TIM_CH 2
1682 #define S12_TIM_AF 3
1683 
1684 #define BOARD_GROUP_DECLFOREACH(line, group) \
1685  static const ioline_t group ## _ARRAY[] = {group}; \
1686  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1687 
1688 #define BOARD_GROUP_FOREACH(line, group) \
1689  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1690 
1691 
1692 #define BOARD_GROUP_DECLFOR(array, index, group) \
1693  static const ioline_t group ## _ARRAY[] = {group}; \
1694  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1695 
1696 #define BOARD_GROUP_FOR(array, index, group) \
1697  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1698 
1699 #define ENERGY_SAVE_INPUT \
1700  LINE_S1, \
1701  LINE_S2, \
1702  LINE_S3, \
1703  LINE_S4, \
1704  LINE_S5, \
1705  LINE_S6, \
1706  LINE_OSD_CS, \
1707  LINE_IMU1_CS, \
1708  LINE_IMU2_CS, \
1709  LINE_LED1, \
1710  LINE_LED2, \
1711  LINE_S7, \
1712  LINE_S8, \
1713  LINE_S9, \
1714  LINE_S10, \
1715  LINE_S11, \
1716  LINE_S12, \
1717  LINE_SPI4_CS
1718 #define ENERGY_SAVE_INPUT_SIZE 18
1719 
1720 #if !defined(_FROM_ASM_)
1721 #ifdef __cplusplus
1722 extern "C" {
1723 #endif
1724  void boardInit(void);
1725 #ifdef __cplusplus
1726 }
1727 #endif
1728 #endif /* _FROM_ASM_ */
1729 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:317