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_MATEKH743_SLIM
23 #define BOARD_NAME "MATEKSYS FC H743 SLIM"
24 
25 /*
26  * Board oscillators-related settings.
27  */
28 #if !defined(STM32_LSECLK)
29 #define STM32_LSECLK 32768U
30 #endif
31 
32 #define STM32_LSEDRV (3U << 3U)
33 
34 #if !defined(STM32_HSECLK)
35 #define STM32_HSECLK 8000000U
36 #endif
37 
38 /*
39  * MCU type as defined in the ST header.
40  */
41 #define STM32H743xx
42 
43 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
44 #ifndef ADC_CHANNEL_VSUPPLY
45 #define ADC_CHANNEL_VSUPPLY ADC_5
46 #endif
47 
48 /* Default powerbrick values */
49 #define DefaultVoltageOfAdc(adc) ((3.3f/65536.0f) * 13.38f * adc)
50 #define DefaultMilliAmpereOfAdc(adc) ((3.3f/65536.0f) * 39.877f * adc)
51 
52 /* Battery monitoring for file closing */
53 #define SDLOG_BAT_ADC ADCD1
54 #define SDLOG_BAT_CHAN AD1_5_CHANNEL
55 
56 /*
57  * PWM TIM defines
58  * enable TIM 3, 4 and 5 by default
59  */
60 #ifndef USE_PWM_TIM3
61 #define USE_PWM_TIM3 1
62 #endif
63 
64 #ifndef USE_PWM_TIM4
65 #define USE_PWM_TIM4 1
66 #endif
67 
68 #ifndef USE_PWM_TIM5
69 #define USE_PWM_TIM5 1
70 #endif
71 
72 /*
73  * IO pins assignments.
74  */
75 #define PA00_SERVO3 0U
76 #define PA01_SERVO4 1U
77 #define PA02_SERVO5 2U
78 #define PA03_SERVO6 3U
79 #define PA04_ADC3 4U
80 #define PA05_SPI1_SCK 5U
81 #define PA06_SPI1_MISO 6U
82 #define PA07_ADC4 7U
83 #define PA08_LED_WS2812 8U
84 #define PA09_UART1_TX 9U
85 #define PA10_UART1_RX 10U
86 #define PA11_USB_DM 11U
87 #define PA12_USB_DP 12U
88 #define PA13_SWDIO 13U
89 #define PA14_SWCLK 14U
90 #define PA15_ALARM 15U
91 
92 #define PB00_SERVO1 0U
93 #define PB01_SERVO2 1U
94 #define PB02 2U
95 #define PB03_SPI3_SCK 3U
96 #define PB04_SPI3_MISO 4U
97 #define PB05_SPI3_MOSI 5U
98 #define PB06_I2C1_SCL 6U
99 #define PB07_I2C1_SDA 7U
100 #define PB08_UART4_RX 8U
101 #define PB09_UART4_TX 9U
102 #define PB10_I2C2_SCL 10U
103 #define PB11_I2C2_SDA 11U
104 #define PB12_SPI_SLAVE4 12U
105 #define PB13_SPI2_SCK 13U
106 #define PB14_SPI2_MISO 14U
107 #define PB15_SPI2_MOSI 15U
108 
109 #define PC00_ADC5 0U
110 #define PC01_ADC6 1U
111 #define PC02 2U
112 #define PC03 3U
113 #define PC04_ADC2 4U
114 #define PC05_ADC1 5U
115 #define PC06_UART6_TX 6U
116 #define PC07_RC1 7U
117 #define PC08_SDIO_D0 8U
118 #define PC09_SDIO_D1 9U
119 #define PC10_SDIO_D2 10U
120 #define PC11_SDIO_D3 11U
121 #define PC12_SDIO_CK 12U
122 #define PC13_SPI_SLAVE6 13U
123 #define PC14 14U
124 #define PC15_SPI_SLAVE5 15U
125 
126 #define PD00_CAN1_RX 0U
127 #define PD01_CAN1_TX 1U
128 #define PD02_SDIO_CMD 2U
129 #define PD03 3U
130 #define PD04_SPI_SLAVE1 4U
131 #define PD05_UART2_TX 5U
132 #define PD06_UART2_RX 6U
133 #define PD07_SPI1_MOSI 7U
134 #define PD08_UART3_TX 8U
135 #define PD09_UART3_RX 9U
136 #define PD10 10U
137 #define PD11 11U
138 #define PD12_SERVO7 12U
139 #define PD13_SERVO8 13U
140 #define PD14_SERVO9 14U
141 #define PD15_SERVO10 15U
142 
143 #define PE00_UART8_RX 0U
144 #define PE01_UART8_TX 1U
145 #define PE02_SPI_SLAVE2 2U
146 #define PE03_LED1 3U
147 #define PE04_LED2 4U
148 #define PE05_SERVO11 5U
149 #define PE06_SERVO12 6U
150 #define PE07_UART7_RX 7U
151 #define PE08_UART7_TX 8U
152 #define PE09_UART7_RTS 9U
153 #define PE10_UART7_CTS 10U
154 #define PE11_SPI_SLAVE3 11U
155 #define PE12_SPI4_CLK 12U
156 #define PE13_SPI4_MISO 13U
157 #define PE14_SPI4_MOSI 14U
158 #define PE15 15U
159 
160 #define PF00 0U
161 #define PF01 1U
162 #define PF02 2U
163 #define PF03 3U
164 #define PF04 4U
165 #define PF05 5U
166 #define PF06 6U
167 #define PF07 7U
168 #define PF08 8U
169 #define PF09 9U
170 #define PF10 10U
171 #define PF11 11U
172 #define PF12 12U
173 #define PF13 13U
174 #define PF14 14U
175 #define PF15 15U
176 
177 #define PG00 0U
178 #define PG01 1U
179 #define PG02 2U
180 #define PG03 3U
181 #define PG04 4U
182 #define PG05 5U
183 #define PG06 6U
184 #define PG07 7U
185 #define PG08 8U
186 #define PG09 9U
187 #define PG10 10U
188 #define PG11 11U
189 #define PG12 12U
190 #define PG13 13U
191 #define PG14 14U
192 #define PG15 15U
193 
194 #define PH00_OSC_IN 0U
195 #define PH01_OSC_OUT 1U
196 #define PH02 2U
197 #define PH03 3U
198 #define PH04 4U
199 #define PH05 5U
200 #define PH06 6U
201 #define PH07 7U
202 #define PH08 8U
203 #define PH09 9U
204 #define PH10 10U
205 #define PH11 11U
206 #define PH12 12U
207 #define PH13 13U
208 #define PH14 14U
209 #define PH15 15U
210 
211 #define PI00 0U
212 #define PI01 1U
213 #define PI02 2U
214 #define PI03 3U
215 #define PI04 4U
216 #define PI05 5U
217 #define PI06 6U
218 #define PI07 7U
219 #define PI08 8U
220 #define PI09 9U
221 #define PI10 10U
222 #define PI11 11U
223 #define PI12 12U
224 #define PI13 13U
225 #define PI14 14U
226 #define PI15 15U
227 
228 #define PJ00 0U
229 #define PJ01 1U
230 #define PJ02 2U
231 #define PJ03 3U
232 #define PJ04 4U
233 #define PJ05 5U
234 #define PJ06 6U
235 #define PJ07 7U
236 #define PJ08 8U
237 #define PJ09 9U
238 #define PJ10 10U
239 #define PJ11 11U
240 #define PJ12 12U
241 #define PJ13 13U
242 #define PJ14 14U
243 #define PJ15 15U
244 
245 #define PK00 0U
246 #define PK01 1U
247 #define PK02 2U
248 #define PK03 3U
249 #define PK04 4U
250 #define PK05 5U
251 #define PK06 6U
252 #define PK07 7U
253 #define PK08 8U
254 #define PK09 9U
255 #define PK10 10U
256 #define PK11 11U
257 #define PK12 12U
258 #define PK13 13U
259 #define PK14 14U
260 #define PK15 15U
261 
262 /*
263  * IO lines assignments.
264  */
265 #define LINE_SERVO3 PAL_LINE(GPIOA, 0U)
266 #define LINE_SERVO4 PAL_LINE(GPIOA, 1U)
267 #define LINE_SERVO5 PAL_LINE(GPIOA, 2U)
268 #define LINE_SERVO6 PAL_LINE(GPIOA, 3U)
269 #define LINE_ADC3 PAL_LINE(GPIOA, 4U)
270 #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
271 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
272 #define LINE_ADC4 PAL_LINE(GPIOA, 7U)
273 #define LINE_LED_WS2812 PAL_LINE(GPIOA, 8U)
274 #define LINE_UART1_TX PAL_LINE(GPIOA, 9U)
275 #define LINE_UART1_RX PAL_LINE(GPIOA, 10U)
276 #define LINE_USB_DM PAL_LINE(GPIOA, 11U)
277 #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
278 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
279 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
280 #define LINE_ALARM PAL_LINE(GPIOA, 15U)
281 
282 #define LINE_SERVO1 PAL_LINE(GPIOB, 0U)
283 #define LINE_SERVO2 PAL_LINE(GPIOB, 1U)
284 #define LINE_SPI3_SCK PAL_LINE(GPIOB, 3U)
285 #define LINE_SPI3_MISO PAL_LINE(GPIOB, 4U)
286 #define LINE_SPI3_MOSI PAL_LINE(GPIOB, 5U)
287 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
288 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
289 #define LINE_UART4_RX PAL_LINE(GPIOB, 8U)
290 #define LINE_UART4_TX PAL_LINE(GPIOB, 9U)
291 #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
292 #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
293 #define LINE_SPI_SLAVE4 PAL_LINE(GPIOB, 12U)
294 #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
295 #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
296 #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
297 
298 #define LINE_ADC5 PAL_LINE(GPIOC, 0U)
299 #define LINE_ADC6 PAL_LINE(GPIOC, 1U)
300 #define LINE_ADC2 PAL_LINE(GPIOC, 4U)
301 #define LINE_ADC1 PAL_LINE(GPIOC, 5U)
302 #define LINE_UART6_TX PAL_LINE(GPIOC, 6U)
303 #define LINE_RC1 PAL_LINE(GPIOC, 7U)
304 #define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
305 #define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
306 #define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
307 #define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
308 #define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
309 #define LINE_SPI_SLAVE6 PAL_LINE(GPIOC, 13U)
310 #define LINE_SPI_SLAVE5 PAL_LINE(GPIOC, 15U)
311 
312 #define LINE_CAN1_RX PAL_LINE(GPIOD, 0U)
313 #define LINE_CAN1_TX PAL_LINE(GPIOD, 1U)
314 #define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
315 #define LINE_SPI_SLAVE1 PAL_LINE(GPIOD, 4U)
316 #define LINE_UART2_TX PAL_LINE(GPIOD, 5U)
317 #define LINE_UART2_RX PAL_LINE(GPIOD, 6U)
318 #define LINE_SPI1_MOSI PAL_LINE(GPIOD, 7U)
319 #define LINE_UART3_TX PAL_LINE(GPIOD, 8U)
320 #define LINE_UART3_RX PAL_LINE(GPIOD, 9U)
321 #define LINE_SERVO7 PAL_LINE(GPIOD, 12U)
322 #define LINE_SERVO8 PAL_LINE(GPIOD, 13U)
323 #define LINE_SERVO9 PAL_LINE(GPIOD, 14U)
324 #define LINE_SERVO10 PAL_LINE(GPIOD, 15U)
325 
326 #define LINE_UART8_RX PAL_LINE(GPIOE, 0U)
327 #define LINE_UART8_TX PAL_LINE(GPIOE, 1U)
328 #define LINE_SPI_SLAVE2 PAL_LINE(GPIOE, 2U)
329 #define LINE_LED1 PAL_LINE(GPIOE, 3U)
330 #define LINE_LED2 PAL_LINE(GPIOE, 4U)
331 #define LINE_SERVO11 PAL_LINE(GPIOE, 5U)
332 #define LINE_SERVO12 PAL_LINE(GPIOE, 6U)
333 #define LINE_UART7_RX PAL_LINE(GPIOE, 7U)
334 #define LINE_UART7_TX PAL_LINE(GPIOE, 8U)
335 #define LINE_UART7_RTS PAL_LINE(GPIOE, 9U)
336 #define LINE_UART7_CTS PAL_LINE(GPIOE, 10U)
337 #define LINE_SPI_SLAVE3 PAL_LINE(GPIOE, 11U)
338 #define LINE_SPI4_CLK PAL_LINE(GPIOE, 12U)
339 #define LINE_SPI4_MISO PAL_LINE(GPIOE, 13U)
340 #define LINE_SPI4_MOSI PAL_LINE(GPIOE, 14U)
341 
342 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
343 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
344 
345 
346 /*
347  * I/O ports initial setup, this configuration is established soon after reset
348  * in the initialization code.
349  * Please refer to the STM32 Reference Manual for details.
350  */
351 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
352 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
353 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
354 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
355 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
356 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
357 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
358 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
359 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
360 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
361 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
362 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
363 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
364 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
365 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
366 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
367 
368 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(PA00_SERVO3) | \
369  PIN_MODE_ALTERNATE(PA01_SERVO4) | \
370  PIN_MODE_ALTERNATE(PA02_SERVO5) | \
371  PIN_MODE_ALTERNATE(PA03_SERVO6) | \
372  PIN_MODE_ANALOG(PA04_ADC3) | \
373  PIN_MODE_ALTERNATE(PA05_SPI1_SCK) | \
374  PIN_MODE_ALTERNATE(PA06_SPI1_MISO) | \
375  PIN_MODE_ANALOG(PA07_ADC4) | \
376  PIN_MODE_ALTERNATE(PA08_LED_WS2812) | \
377  PIN_MODE_ALTERNATE(PA09_UART1_TX) | \
378  PIN_MODE_ALTERNATE(PA10_UART1_RX) | \
379  PIN_MODE_ALTERNATE(PA11_USB_DM) | \
380  PIN_MODE_ALTERNATE(PA12_USB_DP) | \
381  PIN_MODE_ALTERNATE(PA13_SWDIO) | \
382  PIN_MODE_ALTERNATE(PA14_SWCLK) | \
383  PIN_MODE_ALTERNATE(PA15_ALARM))
384 
385 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(PA00_SERVO3) | \
386  PIN_OTYPE_PUSHPULL(PA01_SERVO4) | \
387  PIN_OTYPE_PUSHPULL(PA02_SERVO5) | \
388  PIN_OTYPE_PUSHPULL(PA03_SERVO6) | \
389  PIN_OTYPE_PUSHPULL(PA04_ADC3) | \
390  PIN_OTYPE_PUSHPULL(PA05_SPI1_SCK) | \
391  PIN_OTYPE_PUSHPULL(PA06_SPI1_MISO) | \
392  PIN_OTYPE_PUSHPULL(PA07_ADC4) | \
393  PIN_OTYPE_PUSHPULL(PA08_LED_WS2812) | \
394  PIN_OTYPE_PUSHPULL(PA09_UART1_TX) | \
395  PIN_OTYPE_PUSHPULL(PA10_UART1_RX) | \
396  PIN_OTYPE_PUSHPULL(PA11_USB_DM) | \
397  PIN_OTYPE_PUSHPULL(PA12_USB_DP) | \
398  PIN_OTYPE_PUSHPULL(PA13_SWDIO) | \
399  PIN_OTYPE_PUSHPULL(PA14_SWCLK) | \
400  PIN_OTYPE_PUSHPULL(PA15_ALARM))
401 
402 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PA00_SERVO3) | \
403  PIN_OSPEED_SPEED_HIGH(PA01_SERVO4) | \
404  PIN_OSPEED_SPEED_HIGH(PA02_SERVO5) | \
405  PIN_OSPEED_SPEED_HIGH(PA03_SERVO6) | \
406  PIN_OSPEED_SPEED_VERYLOW(PA04_ADC3) | \
407  PIN_OSPEED_SPEED_HIGH(PA05_SPI1_SCK) | \
408  PIN_OSPEED_SPEED_HIGH(PA06_SPI1_MISO) | \
409  PIN_OSPEED_SPEED_VERYLOW(PA07_ADC4) | \
410  PIN_OSPEED_SPEED_HIGH(PA08_LED_WS2812) | \
411  PIN_OSPEED_SPEED_HIGH(PA09_UART1_TX) | \
412  PIN_OSPEED_SPEED_HIGH(PA10_UART1_RX) | \
413  PIN_OSPEED_SPEED_HIGH(PA11_USB_DM) | \
414  PIN_OSPEED_SPEED_HIGH(PA12_USB_DP) | \
415  PIN_OSPEED_SPEED_HIGH(PA13_SWDIO) | \
416  PIN_OSPEED_SPEED_HIGH(PA14_SWCLK) | \
417  PIN_OSPEED_SPEED_HIGH(PA15_ALARM))
418 
419 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(PA00_SERVO3) | \
420  PIN_PUPDR_FLOATING(PA01_SERVO4) | \
421  PIN_PUPDR_FLOATING(PA02_SERVO5) | \
422  PIN_PUPDR_FLOATING(PA03_SERVO6) | \
423  PIN_PUPDR_FLOATING(PA04_ADC3) | \
424  PIN_PUPDR_FLOATING(PA05_SPI1_SCK) | \
425  PIN_PUPDR_FLOATING(PA06_SPI1_MISO) | \
426  PIN_PUPDR_FLOATING(PA07_ADC4) | \
427  PIN_PUPDR_FLOATING(PA08_LED_WS2812) | \
428  PIN_PUPDR_FLOATING(PA09_UART1_TX) | \
429  PIN_PUPDR_FLOATING(PA10_UART1_RX) | \
430  PIN_PUPDR_FLOATING(PA11_USB_DM) | \
431  PIN_PUPDR_FLOATING(PA12_USB_DP) | \
432  PIN_PUPDR_FLOATING(PA13_SWDIO) | \
433  PIN_PUPDR_FLOATING(PA14_SWCLK) | \
434  PIN_PUPDR_FLOATING(PA15_ALARM))
435 
436 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_LOW(PA00_SERVO3) | \
437  PIN_ODR_LEVEL_LOW(PA01_SERVO4) | \
438  PIN_ODR_LEVEL_LOW(PA02_SERVO5) | \
439  PIN_ODR_LEVEL_LOW(PA03_SERVO6) | \
440  PIN_ODR_LEVEL_LOW(PA04_ADC3) | \
441  PIN_ODR_LEVEL_HIGH(PA05_SPI1_SCK) | \
442  PIN_ODR_LEVEL_HIGH(PA06_SPI1_MISO) | \
443  PIN_ODR_LEVEL_LOW(PA07_ADC4) | \
444  PIN_ODR_LEVEL_LOW(PA08_LED_WS2812) | \
445  PIN_ODR_LEVEL_HIGH(PA09_UART1_TX) | \
446  PIN_ODR_LEVEL_HIGH(PA10_UART1_RX) | \
447  PIN_ODR_LEVEL_HIGH(PA11_USB_DM) | \
448  PIN_ODR_LEVEL_HIGH(PA12_USB_DP) | \
449  PIN_ODR_LEVEL_HIGH(PA13_SWDIO) | \
450  PIN_ODR_LEVEL_HIGH(PA14_SWCLK) | \
451  PIN_ODR_LEVEL_LOW(PA15_ALARM))
452 
453 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(PA00_SERVO3, 2) | \
454  PIN_AFIO_AF(PA01_SERVO4, 2) | \
455  PIN_AFIO_AF(PA02_SERVO5, 2) | \
456  PIN_AFIO_AF(PA03_SERVO6, 2) | \
457  PIN_AFIO_AF(PA04_ADC3, 0) | \
458  PIN_AFIO_AF(PA05_SPI1_SCK, 5) | \
459  PIN_AFIO_AF(PA06_SPI1_MISO, 5) | \
460  PIN_AFIO_AF(PA07_ADC4, 0))
461 
462 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(PA08_LED_WS2812, 1) | \
463  PIN_AFIO_AF(PA09_UART1_TX, 7) | \
464  PIN_AFIO_AF(PA10_UART1_RX, 7) | \
465  PIN_AFIO_AF(PA11_USB_DM, 10) | \
466  PIN_AFIO_AF(PA12_USB_DP, 10) | \
467  PIN_AFIO_AF(PA13_SWDIO, 0) | \
468  PIN_AFIO_AF(PA14_SWCLK, 0) | \
469  PIN_AFIO_AF(PA15_ALARM, 1))
470 
471 #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(PB00_SERVO1) | \
472  PIN_MODE_ALTERNATE(PB01_SERVO2) | \
473  PIN_MODE_INPUT(PB02) | \
474  PIN_MODE_ALTERNATE(PB03_SPI3_SCK) | \
475  PIN_MODE_ALTERNATE(PB04_SPI3_MISO) | \
476  PIN_MODE_ALTERNATE(PB05_SPI3_MOSI) | \
477  PIN_MODE_ALTERNATE(PB06_I2C1_SCL) | \
478  PIN_MODE_ALTERNATE(PB07_I2C1_SDA) | \
479  PIN_MODE_ALTERNATE(PB08_UART4_RX) | \
480  PIN_MODE_ALTERNATE(PB09_UART4_TX) | \
481  PIN_MODE_ALTERNATE(PB10_I2C2_SCL) | \
482  PIN_MODE_ALTERNATE(PB11_I2C2_SDA) | \
483  PIN_MODE_OUTPUT(PB12_SPI_SLAVE4) | \
484  PIN_MODE_ALTERNATE(PB13_SPI2_SCK) | \
485  PIN_MODE_ALTERNATE(PB14_SPI2_MISO) | \
486  PIN_MODE_ALTERNATE(PB15_SPI2_MOSI))
487 
488 #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(PB00_SERVO1) | \
489  PIN_OTYPE_PUSHPULL(PB01_SERVO2) | \
490  PIN_OTYPE_PUSHPULL(PB02) | \
491  PIN_OTYPE_PUSHPULL(PB03_SPI3_SCK) | \
492  PIN_OTYPE_PUSHPULL(PB04_SPI3_MISO) | \
493  PIN_OTYPE_PUSHPULL(PB05_SPI3_MOSI) | \
494  PIN_OTYPE_OPENDRAIN(PB06_I2C1_SCL) | \
495  PIN_OTYPE_OPENDRAIN(PB07_I2C1_SDA) | \
496  PIN_OTYPE_PUSHPULL(PB08_UART4_RX) | \
497  PIN_OTYPE_PUSHPULL(PB09_UART4_TX) | \
498  PIN_OTYPE_OPENDRAIN(PB10_I2C2_SCL) | \
499  PIN_OTYPE_OPENDRAIN(PB11_I2C2_SDA) | \
500  PIN_OTYPE_PUSHPULL(PB12_SPI_SLAVE4) | \
501  PIN_OTYPE_PUSHPULL(PB13_SPI2_SCK) | \
502  PIN_OTYPE_PUSHPULL(PB14_SPI2_MISO) | \
503  PIN_OTYPE_PUSHPULL(PB15_SPI2_MOSI))
504 
505 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PB00_SERVO1) | \
506  PIN_OSPEED_SPEED_HIGH(PB01_SERVO2) | \
507  PIN_OSPEED_SPEED_VERYLOW(PB02) | \
508  PIN_OSPEED_SPEED_HIGH(PB03_SPI3_SCK) | \
509  PIN_OSPEED_SPEED_HIGH(PB04_SPI3_MISO) | \
510  PIN_OSPEED_SPEED_HIGH(PB05_SPI3_MOSI) | \
511  PIN_OSPEED_SPEED_HIGH(PB06_I2C1_SCL) | \
512  PIN_OSPEED_SPEED_HIGH(PB07_I2C1_SDA) | \
513  PIN_OSPEED_SPEED_HIGH(PB08_UART4_RX) | \
514  PIN_OSPEED_SPEED_HIGH(PB09_UART4_TX) | \
515  PIN_OSPEED_SPEED_HIGH(PB10_I2C2_SCL) | \
516  PIN_OSPEED_SPEED_HIGH(PB11_I2C2_SDA) | \
517  PIN_OSPEED_SPEED_HIGH(PB12_SPI_SLAVE4) | \
518  PIN_OSPEED_SPEED_HIGH(PB13_SPI2_SCK) | \
519  PIN_OSPEED_SPEED_HIGH(PB14_SPI2_MISO) | \
520  PIN_OSPEED_SPEED_HIGH(PB15_SPI2_MOSI))
521 
522 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(PB00_SERVO1) | \
523  PIN_PUPDR_FLOATING(PB01_SERVO2) | \
524  PIN_PUPDR_PULLDOWN(PB02) | \
525  PIN_PUPDR_FLOATING(PB03_SPI3_SCK) | \
526  PIN_PUPDR_FLOATING(PB04_SPI3_MISO) | \
527  PIN_PUPDR_FLOATING(PB05_SPI3_MOSI) | \
528  PIN_PUPDR_PULLUP(PB06_I2C1_SCL) | \
529  PIN_PUPDR_PULLUP(PB07_I2C1_SDA) | \
530  PIN_PUPDR_FLOATING(PB08_UART4_RX) | \
531  PIN_PUPDR_FLOATING(PB09_UART4_TX) | \
532  PIN_PUPDR_PULLUP(PB10_I2C2_SCL) | \
533  PIN_PUPDR_PULLUP(PB11_I2C2_SDA) | \
534  PIN_PUPDR_FLOATING(PB12_SPI_SLAVE4) | \
535  PIN_PUPDR_FLOATING(PB13_SPI2_SCK) | \
536  PIN_PUPDR_FLOATING(PB14_SPI2_MISO) | \
537  PIN_PUPDR_FLOATING(PB15_SPI2_MOSI))
538 
539 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(PB00_SERVO1) | \
540  PIN_ODR_LEVEL_LOW(PB01_SERVO2) | \
541  PIN_ODR_LEVEL_LOW(PB02) | \
542  PIN_ODR_LEVEL_HIGH(PB03_SPI3_SCK) | \
543  PIN_ODR_LEVEL_HIGH(PB04_SPI3_MISO) | \
544  PIN_ODR_LEVEL_HIGH(PB05_SPI3_MOSI) | \
545  PIN_ODR_LEVEL_HIGH(PB06_I2C1_SCL) | \
546  PIN_ODR_LEVEL_HIGH(PB07_I2C1_SDA) | \
547  PIN_ODR_LEVEL_HIGH(PB08_UART4_RX) | \
548  PIN_ODR_LEVEL_HIGH(PB09_UART4_TX) | \
549  PIN_ODR_LEVEL_HIGH(PB10_I2C2_SCL) | \
550  PIN_ODR_LEVEL_HIGH(PB11_I2C2_SDA) | \
551  PIN_ODR_LEVEL_HIGH(PB12_SPI_SLAVE4) | \
552  PIN_ODR_LEVEL_HIGH(PB13_SPI2_SCK) | \
553  PIN_ODR_LEVEL_HIGH(PB14_SPI2_MISO) | \
554  PIN_ODR_LEVEL_HIGH(PB15_SPI2_MOSI))
555 
556 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(PB00_SERVO1, 2) | \
557  PIN_AFIO_AF(PB01_SERVO2, 2) | \
558  PIN_AFIO_AF(PB02, 0) | \
559  PIN_AFIO_AF(PB03_SPI3_SCK, 6) | \
560  PIN_AFIO_AF(PB04_SPI3_MISO, 6) | \
561  PIN_AFIO_AF(PB05_SPI3_MOSI, 7) | \
562  PIN_AFIO_AF(PB06_I2C1_SCL, 4) | \
563  PIN_AFIO_AF(PB07_I2C1_SDA, 4))
564 
565 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(PB08_UART4_RX, 8) | \
566  PIN_AFIO_AF(PB09_UART4_TX, 8) | \
567  PIN_AFIO_AF(PB10_I2C2_SCL, 4) | \
568  PIN_AFIO_AF(PB11_I2C2_SDA, 4) | \
569  PIN_AFIO_AF(PB12_SPI_SLAVE4, 0) | \
570  PIN_AFIO_AF(PB13_SPI2_SCK, 5) | \
571  PIN_AFIO_AF(PB14_SPI2_MISO, 5) | \
572  PIN_AFIO_AF(PB15_SPI2_MOSI, 5))
573 
574 #define VAL_GPIOC_MODER (PIN_MODE_ANALOG(PC00_ADC5) | \
575  PIN_MODE_ANALOG(PC01_ADC6) | \
576  PIN_MODE_INPUT(PC02) | \
577  PIN_MODE_INPUT(PC03) | \
578  PIN_MODE_ANALOG(PC04_ADC2) | \
579  PIN_MODE_ANALOG(PC05_ADC1) | \
580  PIN_MODE_ALTERNATE(PC06_UART6_TX) | \
581  PIN_MODE_INPUT(PC07_RC1) | \
582  PIN_MODE_ALTERNATE(PC08_SDIO_D0) | \
583  PIN_MODE_ALTERNATE(PC09_SDIO_D1) | \
584  PIN_MODE_ALTERNATE(PC10_SDIO_D2) | \
585  PIN_MODE_ALTERNATE(PC11_SDIO_D3) | \
586  PIN_MODE_ALTERNATE(PC12_SDIO_CK) | \
587  PIN_MODE_OUTPUT(PC13_SPI_SLAVE6) | \
588  PIN_MODE_INPUT(PC14) | \
589  PIN_MODE_OUTPUT(PC15_SPI_SLAVE5))
590 
591 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(PC00_ADC5) | \
592  PIN_OTYPE_PUSHPULL(PC01_ADC6) | \
593  PIN_OTYPE_PUSHPULL(PC02) | \
594  PIN_OTYPE_PUSHPULL(PC03) | \
595  PIN_OTYPE_PUSHPULL(PC04_ADC2) | \
596  PIN_OTYPE_PUSHPULL(PC05_ADC1) | \
597  PIN_OTYPE_PUSHPULL(PC06_UART6_TX) | \
598  PIN_OTYPE_OPENDRAIN(PC07_RC1) | \
599  PIN_OTYPE_PUSHPULL(PC08_SDIO_D0) | \
600  PIN_OTYPE_PUSHPULL(PC09_SDIO_D1) | \
601  PIN_OTYPE_PUSHPULL(PC10_SDIO_D2) | \
602  PIN_OTYPE_PUSHPULL(PC11_SDIO_D3) | \
603  PIN_OTYPE_PUSHPULL(PC12_SDIO_CK) | \
604  PIN_OTYPE_PUSHPULL(PC13_SPI_SLAVE6) | \
605  PIN_OTYPE_PUSHPULL(PC14) | \
606  PIN_OTYPE_PUSHPULL(PC15_SPI_SLAVE5))
607 
608 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PC00_ADC5) | \
609  PIN_OSPEED_SPEED_VERYLOW(PC01_ADC6) | \
610  PIN_OSPEED_SPEED_VERYLOW(PC02) | \
611  PIN_OSPEED_SPEED_VERYLOW(PC03) | \
612  PIN_OSPEED_SPEED_VERYLOW(PC04_ADC2) | \
613  PIN_OSPEED_SPEED_VERYLOW(PC05_ADC1) | \
614  PIN_OSPEED_SPEED_HIGH(PC06_UART6_TX) | \
615  PIN_OSPEED_SPEED_VERYLOW(PC07_RC1) | \
616  PIN_OSPEED_SPEED_HIGH(PC08_SDIO_D0) | \
617  PIN_OSPEED_SPEED_HIGH(PC09_SDIO_D1) | \
618  PIN_OSPEED_SPEED_HIGH(PC10_SDIO_D2) | \
619  PIN_OSPEED_SPEED_HIGH(PC11_SDIO_D3) | \
620  PIN_OSPEED_SPEED_HIGH(PC12_SDIO_CK) | \
621  PIN_OSPEED_SPEED_HIGH(PC13_SPI_SLAVE6) | \
622  PIN_OSPEED_SPEED_VERYLOW(PC14) | \
623  PIN_OSPEED_SPEED_HIGH(PC15_SPI_SLAVE5))
624 
625 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(PC00_ADC5) | \
626  PIN_PUPDR_FLOATING(PC01_ADC6) | \
627  PIN_PUPDR_PULLDOWN(PC02) | \
628  PIN_PUPDR_PULLDOWN(PC03) | \
629  PIN_PUPDR_FLOATING(PC04_ADC2) | \
630  PIN_PUPDR_FLOATING(PC05_ADC1) | \
631  PIN_PUPDR_FLOATING(PC06_UART6_TX) | \
632  PIN_PUPDR_PULLDOWN(PC07_RC1) | \
633  PIN_PUPDR_PULLUP(PC08_SDIO_D0) | \
634  PIN_PUPDR_PULLUP(PC09_SDIO_D1) | \
635  PIN_PUPDR_PULLUP(PC10_SDIO_D2) | \
636  PIN_PUPDR_PULLUP(PC11_SDIO_D3) | \
637  PIN_PUPDR_FLOATING(PC12_SDIO_CK) | \
638  PIN_PUPDR_FLOATING(PC13_SPI_SLAVE6) | \
639  PIN_PUPDR_PULLDOWN(PC14) | \
640  PIN_PUPDR_FLOATING(PC15_SPI_SLAVE5))
641 
642 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(PC00_ADC5) | \
643  PIN_ODR_LEVEL_LOW(PC01_ADC6) | \
644  PIN_ODR_LEVEL_LOW(PC02) | \
645  PIN_ODR_LEVEL_LOW(PC03) | \
646  PIN_ODR_LEVEL_LOW(PC04_ADC2) | \
647  PIN_ODR_LEVEL_LOW(PC05_ADC1) | \
648  PIN_ODR_LEVEL_HIGH(PC06_UART6_TX) | \
649  PIN_ODR_LEVEL_HIGH(PC07_RC1) | \
650  PIN_ODR_LEVEL_HIGH(PC08_SDIO_D0) | \
651  PIN_ODR_LEVEL_HIGH(PC09_SDIO_D1) | \
652  PIN_ODR_LEVEL_HIGH(PC10_SDIO_D2) | \
653  PIN_ODR_LEVEL_HIGH(PC11_SDIO_D3) | \
654  PIN_ODR_LEVEL_HIGH(PC12_SDIO_CK) | \
655  PIN_ODR_LEVEL_HIGH(PC13_SPI_SLAVE6) | \
656  PIN_ODR_LEVEL_LOW(PC14) | \
657  PIN_ODR_LEVEL_HIGH(PC15_SPI_SLAVE5))
658 
659 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(PC00_ADC5, 0) | \
660  PIN_AFIO_AF(PC01_ADC6, 0) | \
661  PIN_AFIO_AF(PC02, 0) | \
662  PIN_AFIO_AF(PC03, 0) | \
663  PIN_AFIO_AF(PC04_ADC2, 0) | \
664  PIN_AFIO_AF(PC05_ADC1, 0) | \
665  PIN_AFIO_AF(PC06_UART6_TX, 7) | \
666  PIN_AFIO_AF(PC07_RC1, 0))
667 
668 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(PC08_SDIO_D0, 12) | \
669  PIN_AFIO_AF(PC09_SDIO_D1, 12) | \
670  PIN_AFIO_AF(PC10_SDIO_D2, 12) | \
671  PIN_AFIO_AF(PC11_SDIO_D3, 12) | \
672  PIN_AFIO_AF(PC12_SDIO_CK, 12) | \
673  PIN_AFIO_AF(PC13_SPI_SLAVE6, 0) | \
674  PIN_AFIO_AF(PC14, 0) | \
675  PIN_AFIO_AF(PC15_SPI_SLAVE5, 0))
676 
677 #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(PD00_CAN1_RX) | \
678  PIN_MODE_ALTERNATE(PD01_CAN1_TX) | \
679  PIN_MODE_ALTERNATE(PD02_SDIO_CMD) | \
680  PIN_MODE_INPUT(PD03) | \
681  PIN_MODE_OUTPUT(PD04_SPI_SLAVE1) | \
682  PIN_MODE_ALTERNATE(PD05_UART2_TX) | \
683  PIN_MODE_ALTERNATE(PD06_UART2_RX) | \
684  PIN_MODE_ALTERNATE(PD07_SPI1_MOSI) | \
685  PIN_MODE_ALTERNATE(PD08_UART3_TX) | \
686  PIN_MODE_ALTERNATE(PD09_UART3_RX) | \
687  PIN_MODE_INPUT(PD10) | \
688  PIN_MODE_INPUT(PD11) | \
689  PIN_MODE_ALTERNATE(PD12_SERVO7) | \
690  PIN_MODE_ALTERNATE(PD13_SERVO8) | \
691  PIN_MODE_ALTERNATE(PD14_SERVO9) | \
692  PIN_MODE_ALTERNATE(PD15_SERVO10))
693 
694 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00_CAN1_RX) | \
695  PIN_OTYPE_PUSHPULL(PD01_CAN1_TX) | \
696  PIN_OTYPE_PUSHPULL(PD02_SDIO_CMD) | \
697  PIN_OTYPE_PUSHPULL(PD03) | \
698  PIN_OTYPE_PUSHPULL(PD04_SPI_SLAVE1) | \
699  PIN_OTYPE_PUSHPULL(PD05_UART2_TX) | \
700  PIN_OTYPE_PUSHPULL(PD06_UART2_RX) | \
701  PIN_OTYPE_PUSHPULL(PD07_SPI1_MOSI) | \
702  PIN_OTYPE_PUSHPULL(PD08_UART3_TX) | \
703  PIN_OTYPE_PUSHPULL(PD09_UART3_RX) | \
704  PIN_OTYPE_PUSHPULL(PD10) | \
705  PIN_OTYPE_PUSHPULL(PD11) | \
706  PIN_OTYPE_PUSHPULL(PD12_SERVO7) | \
707  PIN_OTYPE_PUSHPULL(PD13_SERVO8) | \
708  PIN_OTYPE_PUSHPULL(PD14_SERVO9) | \
709  PIN_OTYPE_PUSHPULL(PD15_SERVO10))
710 
711 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PD00_CAN1_RX) | \
712  PIN_OSPEED_SPEED_HIGH(PD01_CAN1_TX) | \
713  PIN_OSPEED_SPEED_HIGH(PD02_SDIO_CMD) | \
714  PIN_OSPEED_SPEED_VERYLOW(PD03) | \
715  PIN_OSPEED_SPEED_HIGH(PD04_SPI_SLAVE1) | \
716  PIN_OSPEED_SPEED_HIGH(PD05_UART2_TX) | \
717  PIN_OSPEED_SPEED_HIGH(PD06_UART2_RX) | \
718  PIN_OSPEED_SPEED_HIGH(PD07_SPI1_MOSI) | \
719  PIN_OSPEED_SPEED_HIGH(PD08_UART3_TX) | \
720  PIN_OSPEED_SPEED_HIGH(PD09_UART3_RX) | \
721  PIN_OSPEED_SPEED_VERYLOW(PD10) | \
722  PIN_OSPEED_SPEED_VERYLOW(PD11) | \
723  PIN_OSPEED_SPEED_HIGH(PD12_SERVO7) | \
724  PIN_OSPEED_SPEED_HIGH(PD13_SERVO8) | \
725  PIN_OSPEED_SPEED_HIGH(PD14_SERVO9) | \
726  PIN_OSPEED_SPEED_HIGH(PD15_SERVO10))
727 
728 #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(PD00_CAN1_RX) | \
729  PIN_PUPDR_FLOATING(PD01_CAN1_TX) | \
730  PIN_PUPDR_PULLUP(PD02_SDIO_CMD) | \
731  PIN_PUPDR_PULLDOWN(PD03) | \
732  PIN_PUPDR_FLOATING(PD04_SPI_SLAVE1) | \
733  PIN_PUPDR_FLOATING(PD05_UART2_TX) | \
734  PIN_PUPDR_FLOATING(PD06_UART2_RX) | \
735  PIN_PUPDR_FLOATING(PD07_SPI1_MOSI) | \
736  PIN_PUPDR_FLOATING(PD08_UART3_TX) | \
737  PIN_PUPDR_FLOATING(PD09_UART3_RX) | \
738  PIN_PUPDR_PULLDOWN(PD10) | \
739  PIN_PUPDR_PULLDOWN(PD11) | \
740  PIN_PUPDR_FLOATING(PD12_SERVO7) | \
741  PIN_PUPDR_FLOATING(PD13_SERVO8) | \
742  PIN_PUPDR_FLOATING(PD14_SERVO9) | \
743  PIN_PUPDR_FLOATING(PD15_SERVO10))
744 
745 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_HIGH(PD00_CAN1_RX) | \
746  PIN_ODR_LEVEL_HIGH(PD01_CAN1_TX) | \
747  PIN_ODR_LEVEL_HIGH(PD02_SDIO_CMD) | \
748  PIN_ODR_LEVEL_LOW(PD03) | \
749  PIN_ODR_LEVEL_HIGH(PD04_SPI_SLAVE1) | \
750  PIN_ODR_LEVEL_HIGH(PD05_UART2_TX) | \
751  PIN_ODR_LEVEL_HIGH(PD06_UART2_RX) | \
752  PIN_ODR_LEVEL_HIGH(PD07_SPI1_MOSI) | \
753  PIN_ODR_LEVEL_HIGH(PD08_UART3_TX) | \
754  PIN_ODR_LEVEL_HIGH(PD09_UART3_RX) | \
755  PIN_ODR_LEVEL_LOW(PD10) | \
756  PIN_ODR_LEVEL_LOW(PD11) | \
757  PIN_ODR_LEVEL_LOW(PD12_SERVO7) | \
758  PIN_ODR_LEVEL_LOW(PD13_SERVO8) | \
759  PIN_ODR_LEVEL_LOW(PD14_SERVO9) | \
760  PIN_ODR_LEVEL_LOW(PD15_SERVO10))
761 
762 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00_CAN1_RX, 9) | \
763  PIN_AFIO_AF(PD01_CAN1_TX, 9) | \
764  PIN_AFIO_AF(PD02_SDIO_CMD, 12) | \
765  PIN_AFIO_AF(PD03, 0) | \
766  PIN_AFIO_AF(PD04_SPI_SLAVE1, 0) | \
767  PIN_AFIO_AF(PD05_UART2_TX, 7) | \
768  PIN_AFIO_AF(PD06_UART2_RX, 7) | \
769  PIN_AFIO_AF(PD07_SPI1_MOSI, 5))
770 
771 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08_UART3_TX, 7) | \
772  PIN_AFIO_AF(PD09_UART3_RX, 7) | \
773  PIN_AFIO_AF(PD10, 0) | \
774  PIN_AFIO_AF(PD11, 0) | \
775  PIN_AFIO_AF(PD12_SERVO7, 2) | \
776  PIN_AFIO_AF(PD13_SERVO8, 2) | \
777  PIN_AFIO_AF(PD14_SERVO9, 2) | \
778  PIN_AFIO_AF(PD15_SERVO10, 2))
779 
780 #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(PE00_UART8_RX) | \
781  PIN_MODE_ALTERNATE(PE01_UART8_TX) | \
782  PIN_MODE_OUTPUT(PE02_SPI_SLAVE2) | \
783  PIN_MODE_OUTPUT(PE03_LED1) | \
784  PIN_MODE_OUTPUT(PE04_LED2) | \
785  PIN_MODE_ALTERNATE(PE05_SERVO11) | \
786  PIN_MODE_ALTERNATE(PE06_SERVO12) | \
787  PIN_MODE_ALTERNATE(PE07_UART7_RX) | \
788  PIN_MODE_ALTERNATE(PE08_UART7_TX) | \
789  PIN_MODE_INPUT(PE09_UART7_RTS) | \
790  PIN_MODE_INPUT(PE10_UART7_CTS) | \
791  PIN_MODE_OUTPUT(PE11_SPI_SLAVE3) | \
792  PIN_MODE_ALTERNATE(PE12_SPI4_CLK) | \
793  PIN_MODE_ALTERNATE(PE13_SPI4_MISO) | \
794  PIN_MODE_ALTERNATE(PE14_SPI4_MOSI) | \
795  PIN_MODE_INPUT(PE15))
796 
797 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00_UART8_RX) | \
798  PIN_OTYPE_PUSHPULL(PE01_UART8_TX) | \
799  PIN_OTYPE_PUSHPULL(PE02_SPI_SLAVE2) | \
800  PIN_OTYPE_PUSHPULL(PE03_LED1) | \
801  PIN_OTYPE_PUSHPULL(PE04_LED2) | \
802  PIN_OTYPE_PUSHPULL(PE05_SERVO11) | \
803  PIN_OTYPE_PUSHPULL(PE06_SERVO12) | \
804  PIN_OTYPE_PUSHPULL(PE07_UART7_RX) | \
805  PIN_OTYPE_PUSHPULL(PE08_UART7_TX) | \
806  PIN_OTYPE_OPENDRAIN(PE09_UART7_RTS) | \
807  PIN_OTYPE_OPENDRAIN(PE10_UART7_CTS) | \
808  PIN_OTYPE_PUSHPULL(PE11_SPI_SLAVE3) | \
809  PIN_OTYPE_PUSHPULL(PE12_SPI4_CLK) | \
810  PIN_OTYPE_PUSHPULL(PE13_SPI4_MISO) | \
811  PIN_OTYPE_PUSHPULL(PE14_SPI4_MOSI) | \
812  PIN_OTYPE_PUSHPULL(PE15))
813 
814 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PE00_UART8_RX) | \
815  PIN_OSPEED_SPEED_HIGH(PE01_UART8_TX) | \
816  PIN_OSPEED_SPEED_HIGH(PE02_SPI_SLAVE2) | \
817  PIN_OSPEED_SPEED_VERYLOW(PE03_LED1) | \
818  PIN_OSPEED_SPEED_VERYLOW(PE04_LED2) | \
819  PIN_OSPEED_SPEED_HIGH(PE05_SERVO11) | \
820  PIN_OSPEED_SPEED_HIGH(PE06_SERVO12) | \
821  PIN_OSPEED_SPEED_HIGH(PE07_UART7_RX) | \
822  PIN_OSPEED_SPEED_HIGH(PE08_UART7_TX) | \
823  PIN_OSPEED_SPEED_VERYLOW(PE09_UART7_RTS) | \
824  PIN_OSPEED_SPEED_VERYLOW(PE10_UART7_CTS) | \
825  PIN_OSPEED_SPEED_HIGH(PE11_SPI_SLAVE3) | \
826  PIN_OSPEED_SPEED_HIGH(PE12_SPI4_CLK) | \
827  PIN_OSPEED_SPEED_HIGH(PE13_SPI4_MISO) | \
828  PIN_OSPEED_SPEED_HIGH(PE14_SPI4_MOSI) | \
829  PIN_OSPEED_SPEED_VERYLOW(PE15))
830 
831 #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(PE00_UART8_RX) | \
832  PIN_PUPDR_FLOATING(PE01_UART8_TX) | \
833  PIN_PUPDR_FLOATING(PE02_SPI_SLAVE2) | \
834  PIN_PUPDR_FLOATING(PE03_LED1) | \
835  PIN_PUPDR_FLOATING(PE04_LED2) | \
836  PIN_PUPDR_FLOATING(PE05_SERVO11) | \
837  PIN_PUPDR_FLOATING(PE06_SERVO12) | \
838  PIN_PUPDR_FLOATING(PE07_UART7_RX) | \
839  PIN_PUPDR_FLOATING(PE08_UART7_TX) | \
840  PIN_PUPDR_PULLDOWN(PE09_UART7_RTS) | \
841  PIN_PUPDR_PULLDOWN(PE10_UART7_CTS) | \
842  PIN_PUPDR_FLOATING(PE11_SPI_SLAVE3) | \
843  PIN_PUPDR_FLOATING(PE12_SPI4_CLK) | \
844  PIN_PUPDR_FLOATING(PE13_SPI4_MISO) | \
845  PIN_PUPDR_FLOATING(PE14_SPI4_MOSI) | \
846  PIN_PUPDR_PULLDOWN(PE15))
847 
848 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_HIGH(PE00_UART8_RX) | \
849  PIN_ODR_LEVEL_HIGH(PE01_UART8_TX) | \
850  PIN_ODR_LEVEL_HIGH(PE02_SPI_SLAVE2) | \
851  PIN_ODR_LEVEL_LOW(PE03_LED1) | \
852  PIN_ODR_LEVEL_LOW(PE04_LED2) | \
853  PIN_ODR_LEVEL_LOW(PE05_SERVO11) | \
854  PIN_ODR_LEVEL_LOW(PE06_SERVO12) | \
855  PIN_ODR_LEVEL_HIGH(PE07_UART7_RX) | \
856  PIN_ODR_LEVEL_HIGH(PE08_UART7_TX) | \
857  PIN_ODR_LEVEL_HIGH(PE09_UART7_RTS) | \
858  PIN_ODR_LEVEL_HIGH(PE10_UART7_CTS) | \
859  PIN_ODR_LEVEL_HIGH(PE11_SPI_SLAVE3) | \
860  PIN_ODR_LEVEL_HIGH(PE12_SPI4_CLK) | \
861  PIN_ODR_LEVEL_HIGH(PE13_SPI4_MISO) | \
862  PIN_ODR_LEVEL_HIGH(PE14_SPI4_MOSI) | \
863  PIN_ODR_LEVEL_LOW(PE15))
864 
865 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00_UART8_RX, 8) | \
866  PIN_AFIO_AF(PE01_UART8_TX, 8) | \
867  PIN_AFIO_AF(PE02_SPI_SLAVE2, 0) | \
868  PIN_AFIO_AF(PE03_LED1, 0) | \
869  PIN_AFIO_AF(PE04_LED2, 0) | \
870  PIN_AFIO_AF(PE05_SERVO11, 4) | \
871  PIN_AFIO_AF(PE06_SERVO12, 4) | \
872  PIN_AFIO_AF(PE07_UART7_RX, 7))
873 
874 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(PE08_UART7_TX, 7) | \
875  PIN_AFIO_AF(PE09_UART7_RTS, 0) | \
876  PIN_AFIO_AF(PE10_UART7_CTS, 0) | \
877  PIN_AFIO_AF(PE11_SPI_SLAVE3, 0) | \
878  PIN_AFIO_AF(PE12_SPI4_CLK, 5) | \
879  PIN_AFIO_AF(PE13_SPI4_MISO, 5) | \
880  PIN_AFIO_AF(PE14_SPI4_MOSI, 5) | \
881  PIN_AFIO_AF(PE15, 0))
882 
883 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
884  PIN_MODE_INPUT(PF01) | \
885  PIN_MODE_INPUT(PF02) | \
886  PIN_MODE_INPUT(PF03) | \
887  PIN_MODE_INPUT(PF04) | \
888  PIN_MODE_INPUT(PF05) | \
889  PIN_MODE_INPUT(PF06) | \
890  PIN_MODE_INPUT(PF07) | \
891  PIN_MODE_INPUT(PF08) | \
892  PIN_MODE_INPUT(PF09) | \
893  PIN_MODE_INPUT(PF10) | \
894  PIN_MODE_INPUT(PF11) | \
895  PIN_MODE_INPUT(PF12) | \
896  PIN_MODE_INPUT(PF13) | \
897  PIN_MODE_INPUT(PF14) | \
898  PIN_MODE_INPUT(PF15))
899 
900 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
901  PIN_OTYPE_PUSHPULL(PF01) | \
902  PIN_OTYPE_PUSHPULL(PF02) | \
903  PIN_OTYPE_PUSHPULL(PF03) | \
904  PIN_OTYPE_PUSHPULL(PF04) | \
905  PIN_OTYPE_PUSHPULL(PF05) | \
906  PIN_OTYPE_PUSHPULL(PF06) | \
907  PIN_OTYPE_PUSHPULL(PF07) | \
908  PIN_OTYPE_PUSHPULL(PF08) | \
909  PIN_OTYPE_PUSHPULL(PF09) | \
910  PIN_OTYPE_PUSHPULL(PF10) | \
911  PIN_OTYPE_PUSHPULL(PF11) | \
912  PIN_OTYPE_PUSHPULL(PF12) | \
913  PIN_OTYPE_PUSHPULL(PF13) | \
914  PIN_OTYPE_PUSHPULL(PF14) | \
915  PIN_OTYPE_PUSHPULL(PF15))
916 
917 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
918  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
919  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
920  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
921  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
922  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
923  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
924  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
925  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
926  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
927  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
928  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
929  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
930  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
931  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
932  PIN_OSPEED_SPEED_VERYLOW(PF15))
933 
934 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
935  PIN_PUPDR_PULLDOWN(PF01) | \
936  PIN_PUPDR_PULLDOWN(PF02) | \
937  PIN_PUPDR_PULLDOWN(PF03) | \
938  PIN_PUPDR_PULLDOWN(PF04) | \
939  PIN_PUPDR_PULLDOWN(PF05) | \
940  PIN_PUPDR_PULLDOWN(PF06) | \
941  PIN_PUPDR_PULLDOWN(PF07) | \
942  PIN_PUPDR_PULLDOWN(PF08) | \
943  PIN_PUPDR_PULLDOWN(PF09) | \
944  PIN_PUPDR_PULLDOWN(PF10) | \
945  PIN_PUPDR_PULLDOWN(PF11) | \
946  PIN_PUPDR_PULLDOWN(PF12) | \
947  PIN_PUPDR_PULLDOWN(PF13) | \
948  PIN_PUPDR_PULLDOWN(PF14) | \
949  PIN_PUPDR_PULLDOWN(PF15))
950 
951 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
952  PIN_ODR_LEVEL_LOW(PF01) | \
953  PIN_ODR_LEVEL_LOW(PF02) | \
954  PIN_ODR_LEVEL_LOW(PF03) | \
955  PIN_ODR_LEVEL_LOW(PF04) | \
956  PIN_ODR_LEVEL_LOW(PF05) | \
957  PIN_ODR_LEVEL_LOW(PF06) | \
958  PIN_ODR_LEVEL_LOW(PF07) | \
959  PIN_ODR_LEVEL_LOW(PF08) | \
960  PIN_ODR_LEVEL_LOW(PF09) | \
961  PIN_ODR_LEVEL_LOW(PF10) | \
962  PIN_ODR_LEVEL_LOW(PF11) | \
963  PIN_ODR_LEVEL_LOW(PF12) | \
964  PIN_ODR_LEVEL_LOW(PF13) | \
965  PIN_ODR_LEVEL_LOW(PF14) | \
966  PIN_ODR_LEVEL_LOW(PF15))
967 
968 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
969  PIN_AFIO_AF(PF01, 0) | \
970  PIN_AFIO_AF(PF02, 0) | \
971  PIN_AFIO_AF(PF03, 0) | \
972  PIN_AFIO_AF(PF04, 0) | \
973  PIN_AFIO_AF(PF05, 0) | \
974  PIN_AFIO_AF(PF06, 0) | \
975  PIN_AFIO_AF(PF07, 0))
976 
977 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
978  PIN_AFIO_AF(PF09, 0) | \
979  PIN_AFIO_AF(PF10, 0) | \
980  PIN_AFIO_AF(PF11, 0) | \
981  PIN_AFIO_AF(PF12, 0) | \
982  PIN_AFIO_AF(PF13, 0) | \
983  PIN_AFIO_AF(PF14, 0) | \
984  PIN_AFIO_AF(PF15, 0))
985 
986 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
987  PIN_MODE_INPUT(PG01) | \
988  PIN_MODE_INPUT(PG02) | \
989  PIN_MODE_INPUT(PG03) | \
990  PIN_MODE_INPUT(PG04) | \
991  PIN_MODE_INPUT(PG05) | \
992  PIN_MODE_INPUT(PG06) | \
993  PIN_MODE_INPUT(PG07) | \
994  PIN_MODE_INPUT(PG08) | \
995  PIN_MODE_INPUT(PG09) | \
996  PIN_MODE_INPUT(PG10) | \
997  PIN_MODE_INPUT(PG11) | \
998  PIN_MODE_INPUT(PG12) | \
999  PIN_MODE_INPUT(PG13) | \
1000  PIN_MODE_INPUT(PG14) | \
1001  PIN_MODE_INPUT(PG15))
1002 
1003 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
1004  PIN_OTYPE_PUSHPULL(PG01) | \
1005  PIN_OTYPE_PUSHPULL(PG02) | \
1006  PIN_OTYPE_PUSHPULL(PG03) | \
1007  PIN_OTYPE_PUSHPULL(PG04) | \
1008  PIN_OTYPE_PUSHPULL(PG05) | \
1009  PIN_OTYPE_PUSHPULL(PG06) | \
1010  PIN_OTYPE_PUSHPULL(PG07) | \
1011  PIN_OTYPE_PUSHPULL(PG08) | \
1012  PIN_OTYPE_PUSHPULL(PG09) | \
1013  PIN_OTYPE_PUSHPULL(PG10) | \
1014  PIN_OTYPE_PUSHPULL(PG11) | \
1015  PIN_OTYPE_PUSHPULL(PG12) | \
1016  PIN_OTYPE_PUSHPULL(PG13) | \
1017  PIN_OTYPE_PUSHPULL(PG14) | \
1018  PIN_OTYPE_PUSHPULL(PG15))
1019 
1020 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
1021  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
1022  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
1023  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
1024  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
1025  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1026  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1027  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1028  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1029  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1030  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1031  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1032  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1033  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1034  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1035  PIN_OSPEED_SPEED_VERYLOW(PG15))
1036 
1037 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1038  PIN_PUPDR_PULLDOWN(PG01) | \
1039  PIN_PUPDR_PULLDOWN(PG02) | \
1040  PIN_PUPDR_PULLDOWN(PG03) | \
1041  PIN_PUPDR_PULLDOWN(PG04) | \
1042  PIN_PUPDR_PULLDOWN(PG05) | \
1043  PIN_PUPDR_PULLDOWN(PG06) | \
1044  PIN_PUPDR_PULLDOWN(PG07) | \
1045  PIN_PUPDR_PULLDOWN(PG08) | \
1046  PIN_PUPDR_PULLDOWN(PG09) | \
1047  PIN_PUPDR_PULLDOWN(PG10) | \
1048  PIN_PUPDR_PULLDOWN(PG11) | \
1049  PIN_PUPDR_PULLDOWN(PG12) | \
1050  PIN_PUPDR_PULLDOWN(PG13) | \
1051  PIN_PUPDR_PULLDOWN(PG14) | \
1052  PIN_PUPDR_PULLDOWN(PG15))
1053 
1054 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1055  PIN_ODR_LEVEL_LOW(PG01) | \
1056  PIN_ODR_LEVEL_LOW(PG02) | \
1057  PIN_ODR_LEVEL_LOW(PG03) | \
1058  PIN_ODR_LEVEL_LOW(PG04) | \
1059  PIN_ODR_LEVEL_LOW(PG05) | \
1060  PIN_ODR_LEVEL_LOW(PG06) | \
1061  PIN_ODR_LEVEL_LOW(PG07) | \
1062  PIN_ODR_LEVEL_LOW(PG08) | \
1063  PIN_ODR_LEVEL_LOW(PG09) | \
1064  PIN_ODR_LEVEL_LOW(PG10) | \
1065  PIN_ODR_LEVEL_LOW(PG11) | \
1066  PIN_ODR_LEVEL_LOW(PG12) | \
1067  PIN_ODR_LEVEL_LOW(PG13) | \
1068  PIN_ODR_LEVEL_LOW(PG14) | \
1069  PIN_ODR_LEVEL_LOW(PG15))
1070 
1071 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1072  PIN_AFIO_AF(PG01, 0) | \
1073  PIN_AFIO_AF(PG02, 0) | \
1074  PIN_AFIO_AF(PG03, 0) | \
1075  PIN_AFIO_AF(PG04, 0) | \
1076  PIN_AFIO_AF(PG05, 0) | \
1077  PIN_AFIO_AF(PG06, 0) | \
1078  PIN_AFIO_AF(PG07, 0))
1079 
1080 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1081  PIN_AFIO_AF(PG09, 0) | \
1082  PIN_AFIO_AF(PG10, 0) | \
1083  PIN_AFIO_AF(PG11, 0) | \
1084  PIN_AFIO_AF(PG12, 0) | \
1085  PIN_AFIO_AF(PG13, 0) | \
1086  PIN_AFIO_AF(PG14, 0) | \
1087  PIN_AFIO_AF(PG15, 0))
1088 
1089 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(PH00_OSC_IN) | \
1090  PIN_MODE_ALTERNATE(PH01_OSC_OUT) | \
1091  PIN_MODE_INPUT(PH02) | \
1092  PIN_MODE_INPUT(PH03) | \
1093  PIN_MODE_INPUT(PH04) | \
1094  PIN_MODE_INPUT(PH05) | \
1095  PIN_MODE_INPUT(PH06) | \
1096  PIN_MODE_INPUT(PH07) | \
1097  PIN_MODE_INPUT(PH08) | \
1098  PIN_MODE_INPUT(PH09) | \
1099  PIN_MODE_INPUT(PH10) | \
1100  PIN_MODE_INPUT(PH11) | \
1101  PIN_MODE_INPUT(PH12) | \
1102  PIN_MODE_INPUT(PH13) | \
1103  PIN_MODE_INPUT(PH14) | \
1104  PIN_MODE_INPUT(PH15))
1105 
1106 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(PH00_OSC_IN) | \
1107  PIN_OTYPE_PUSHPULL(PH01_OSC_OUT) | \
1108  PIN_OTYPE_PUSHPULL(PH02) | \
1109  PIN_OTYPE_PUSHPULL(PH03) | \
1110  PIN_OTYPE_PUSHPULL(PH04) | \
1111  PIN_OTYPE_PUSHPULL(PH05) | \
1112  PIN_OTYPE_PUSHPULL(PH06) | \
1113  PIN_OTYPE_PUSHPULL(PH07) | \
1114  PIN_OTYPE_PUSHPULL(PH08) | \
1115  PIN_OTYPE_PUSHPULL(PH09) | \
1116  PIN_OTYPE_PUSHPULL(PH10) | \
1117  PIN_OTYPE_PUSHPULL(PH11) | \
1118  PIN_OTYPE_PUSHPULL(PH12) | \
1119  PIN_OTYPE_PUSHPULL(PH13) | \
1120  PIN_OTYPE_PUSHPULL(PH14) | \
1121  PIN_OTYPE_PUSHPULL(PH15))
1122 
1123 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PH00_OSC_IN) | \
1124  PIN_OSPEED_SPEED_HIGH(PH01_OSC_OUT) | \
1125  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1126  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1127  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1128  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1129  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1130  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1131  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1132  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1133  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1134  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1135  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1136  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1137  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1138  PIN_OSPEED_SPEED_VERYLOW(PH15))
1139 
1140 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(PH00_OSC_IN) | \
1141  PIN_PUPDR_FLOATING(PH01_OSC_OUT) | \
1142  PIN_PUPDR_PULLDOWN(PH02) | \
1143  PIN_PUPDR_PULLDOWN(PH03) | \
1144  PIN_PUPDR_PULLDOWN(PH04) | \
1145  PIN_PUPDR_PULLDOWN(PH05) | \
1146  PIN_PUPDR_PULLDOWN(PH06) | \
1147  PIN_PUPDR_PULLDOWN(PH07) | \
1148  PIN_PUPDR_PULLDOWN(PH08) | \
1149  PIN_PUPDR_PULLDOWN(PH09) | \
1150  PIN_PUPDR_PULLDOWN(PH10) | \
1151  PIN_PUPDR_PULLDOWN(PH11) | \
1152  PIN_PUPDR_PULLDOWN(PH12) | \
1153  PIN_PUPDR_PULLDOWN(PH13) | \
1154  PIN_PUPDR_PULLDOWN(PH14) | \
1155  PIN_PUPDR_PULLDOWN(PH15))
1156 
1157 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(PH00_OSC_IN) | \
1158  PIN_ODR_LEVEL_HIGH(PH01_OSC_OUT) | \
1159  PIN_ODR_LEVEL_LOW(PH02) | \
1160  PIN_ODR_LEVEL_LOW(PH03) | \
1161  PIN_ODR_LEVEL_LOW(PH04) | \
1162  PIN_ODR_LEVEL_LOW(PH05) | \
1163  PIN_ODR_LEVEL_LOW(PH06) | \
1164  PIN_ODR_LEVEL_LOW(PH07) | \
1165  PIN_ODR_LEVEL_LOW(PH08) | \
1166  PIN_ODR_LEVEL_LOW(PH09) | \
1167  PIN_ODR_LEVEL_LOW(PH10) | \
1168  PIN_ODR_LEVEL_LOW(PH11) | \
1169  PIN_ODR_LEVEL_LOW(PH12) | \
1170  PIN_ODR_LEVEL_LOW(PH13) | \
1171  PIN_ODR_LEVEL_LOW(PH14) | \
1172  PIN_ODR_LEVEL_LOW(PH15))
1173 
1174 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(PH00_OSC_IN, 0) | \
1175  PIN_AFIO_AF(PH01_OSC_OUT, 0) | \
1176  PIN_AFIO_AF(PH02, 0) | \
1177  PIN_AFIO_AF(PH03, 0) | \
1178  PIN_AFIO_AF(PH04, 0) | \
1179  PIN_AFIO_AF(PH05, 0) | \
1180  PIN_AFIO_AF(PH06, 0) | \
1181  PIN_AFIO_AF(PH07, 0))
1182 
1183 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1184  PIN_AFIO_AF(PH09, 0) | \
1185  PIN_AFIO_AF(PH10, 0) | \
1186  PIN_AFIO_AF(PH11, 0) | \
1187  PIN_AFIO_AF(PH12, 0) | \
1188  PIN_AFIO_AF(PH13, 0) | \
1189  PIN_AFIO_AF(PH14, 0) | \
1190  PIN_AFIO_AF(PH15, 0))
1191 
1192 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1193  PIN_MODE_INPUT(PI01) | \
1194  PIN_MODE_INPUT(PI02) | \
1195  PIN_MODE_INPUT(PI03) | \
1196  PIN_MODE_INPUT(PI04) | \
1197  PIN_MODE_INPUT(PI05) | \
1198  PIN_MODE_INPUT(PI06) | \
1199  PIN_MODE_INPUT(PI07) | \
1200  PIN_MODE_INPUT(PI08) | \
1201  PIN_MODE_INPUT(PI09) | \
1202  PIN_MODE_INPUT(PI10) | \
1203  PIN_MODE_INPUT(PI11) | \
1204  PIN_MODE_INPUT(PI12) | \
1205  PIN_MODE_INPUT(PI13) | \
1206  PIN_MODE_INPUT(PI14) | \
1207  PIN_MODE_INPUT(PI15))
1208 
1209 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1210  PIN_OTYPE_PUSHPULL(PI01) | \
1211  PIN_OTYPE_PUSHPULL(PI02) | \
1212  PIN_OTYPE_PUSHPULL(PI03) | \
1213  PIN_OTYPE_PUSHPULL(PI04) | \
1214  PIN_OTYPE_PUSHPULL(PI05) | \
1215  PIN_OTYPE_PUSHPULL(PI06) | \
1216  PIN_OTYPE_PUSHPULL(PI07) | \
1217  PIN_OTYPE_PUSHPULL(PI08) | \
1218  PIN_OTYPE_PUSHPULL(PI09) | \
1219  PIN_OTYPE_PUSHPULL(PI10) | \
1220  PIN_OTYPE_PUSHPULL(PI11) | \
1221  PIN_OTYPE_PUSHPULL(PI12) | \
1222  PIN_OTYPE_PUSHPULL(PI13) | \
1223  PIN_OTYPE_PUSHPULL(PI14) | \
1224  PIN_OTYPE_PUSHPULL(PI15))
1225 
1226 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1227  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1228  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1229  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1230  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1231  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1232  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1233  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1234  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1235  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1236  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1237  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1238  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1239  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1240  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1241  PIN_OSPEED_SPEED_VERYLOW(PI15))
1242 
1243 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1244  PIN_PUPDR_PULLDOWN(PI01) | \
1245  PIN_PUPDR_PULLDOWN(PI02) | \
1246  PIN_PUPDR_PULLDOWN(PI03) | \
1247  PIN_PUPDR_PULLDOWN(PI04) | \
1248  PIN_PUPDR_PULLDOWN(PI05) | \
1249  PIN_PUPDR_PULLDOWN(PI06) | \
1250  PIN_PUPDR_PULLDOWN(PI07) | \
1251  PIN_PUPDR_PULLDOWN(PI08) | \
1252  PIN_PUPDR_PULLDOWN(PI09) | \
1253  PIN_PUPDR_PULLDOWN(PI10) | \
1254  PIN_PUPDR_PULLDOWN(PI11) | \
1255  PIN_PUPDR_PULLDOWN(PI12) | \
1256  PIN_PUPDR_PULLDOWN(PI13) | \
1257  PIN_PUPDR_PULLDOWN(PI14) | \
1258  PIN_PUPDR_PULLDOWN(PI15))
1259 
1260 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1261  PIN_ODR_LEVEL_LOW(PI01) | \
1262  PIN_ODR_LEVEL_LOW(PI02) | \
1263  PIN_ODR_LEVEL_LOW(PI03) | \
1264  PIN_ODR_LEVEL_LOW(PI04) | \
1265  PIN_ODR_LEVEL_LOW(PI05) | \
1266  PIN_ODR_LEVEL_LOW(PI06) | \
1267  PIN_ODR_LEVEL_LOW(PI07) | \
1268  PIN_ODR_LEVEL_LOW(PI08) | \
1269  PIN_ODR_LEVEL_LOW(PI09) | \
1270  PIN_ODR_LEVEL_LOW(PI10) | \
1271  PIN_ODR_LEVEL_LOW(PI11) | \
1272  PIN_ODR_LEVEL_LOW(PI12) | \
1273  PIN_ODR_LEVEL_LOW(PI13) | \
1274  PIN_ODR_LEVEL_LOW(PI14) | \
1275  PIN_ODR_LEVEL_LOW(PI15))
1276 
1277 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1278  PIN_AFIO_AF(PI01, 0) | \
1279  PIN_AFIO_AF(PI02, 0) | \
1280  PIN_AFIO_AF(PI03, 0) | \
1281  PIN_AFIO_AF(PI04, 0) | \
1282  PIN_AFIO_AF(PI05, 0) | \
1283  PIN_AFIO_AF(PI06, 0) | \
1284  PIN_AFIO_AF(PI07, 0))
1285 
1286 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1287  PIN_AFIO_AF(PI09, 0) | \
1288  PIN_AFIO_AF(PI10, 0) | \
1289  PIN_AFIO_AF(PI11, 0) | \
1290  PIN_AFIO_AF(PI12, 0) | \
1291  PIN_AFIO_AF(PI13, 0) | \
1292  PIN_AFIO_AF(PI14, 0) | \
1293  PIN_AFIO_AF(PI15, 0))
1294 
1295 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1296  PIN_MODE_INPUT(PJ01) | \
1297  PIN_MODE_INPUT(PJ02) | \
1298  PIN_MODE_INPUT(PJ03) | \
1299  PIN_MODE_INPUT(PJ04) | \
1300  PIN_MODE_INPUT(PJ05) | \
1301  PIN_MODE_INPUT(PJ06) | \
1302  PIN_MODE_INPUT(PJ07) | \
1303  PIN_MODE_INPUT(PJ08) | \
1304  PIN_MODE_INPUT(PJ09) | \
1305  PIN_MODE_INPUT(PJ10) | \
1306  PIN_MODE_INPUT(PJ11) | \
1307  PIN_MODE_INPUT(PJ12) | \
1308  PIN_MODE_INPUT(PJ13) | \
1309  PIN_MODE_INPUT(PJ14) | \
1310  PIN_MODE_INPUT(PJ15))
1311 
1312 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1313  PIN_OTYPE_PUSHPULL(PJ01) | \
1314  PIN_OTYPE_PUSHPULL(PJ02) | \
1315  PIN_OTYPE_PUSHPULL(PJ03) | \
1316  PIN_OTYPE_PUSHPULL(PJ04) | \
1317  PIN_OTYPE_PUSHPULL(PJ05) | \
1318  PIN_OTYPE_PUSHPULL(PJ06) | \
1319  PIN_OTYPE_PUSHPULL(PJ07) | \
1320  PIN_OTYPE_PUSHPULL(PJ08) | \
1321  PIN_OTYPE_PUSHPULL(PJ09) | \
1322  PIN_OTYPE_PUSHPULL(PJ10) | \
1323  PIN_OTYPE_PUSHPULL(PJ11) | \
1324  PIN_OTYPE_PUSHPULL(PJ12) | \
1325  PIN_OTYPE_PUSHPULL(PJ13) | \
1326  PIN_OTYPE_PUSHPULL(PJ14) | \
1327  PIN_OTYPE_PUSHPULL(PJ15))
1328 
1329 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1330  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1331  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1332  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1333  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1334  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1335  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1336  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1337  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1338  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1339  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1340  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1341  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1342  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1343  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1344  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1345 
1346 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1347  PIN_PUPDR_PULLDOWN(PJ01) | \
1348  PIN_PUPDR_PULLDOWN(PJ02) | \
1349  PIN_PUPDR_PULLDOWN(PJ03) | \
1350  PIN_PUPDR_PULLDOWN(PJ04) | \
1351  PIN_PUPDR_PULLDOWN(PJ05) | \
1352  PIN_PUPDR_PULLDOWN(PJ06) | \
1353  PIN_PUPDR_PULLDOWN(PJ07) | \
1354  PIN_PUPDR_PULLDOWN(PJ08) | \
1355  PIN_PUPDR_PULLDOWN(PJ09) | \
1356  PIN_PUPDR_PULLDOWN(PJ10) | \
1357  PIN_PUPDR_PULLDOWN(PJ11) | \
1358  PIN_PUPDR_PULLDOWN(PJ12) | \
1359  PIN_PUPDR_PULLDOWN(PJ13) | \
1360  PIN_PUPDR_PULLDOWN(PJ14) | \
1361  PIN_PUPDR_PULLDOWN(PJ15))
1362 
1363 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1364  PIN_ODR_LEVEL_LOW(PJ01) | \
1365  PIN_ODR_LEVEL_LOW(PJ02) | \
1366  PIN_ODR_LEVEL_LOW(PJ03) | \
1367  PIN_ODR_LEVEL_LOW(PJ04) | \
1368  PIN_ODR_LEVEL_LOW(PJ05) | \
1369  PIN_ODR_LEVEL_LOW(PJ06) | \
1370  PIN_ODR_LEVEL_LOW(PJ07) | \
1371  PIN_ODR_LEVEL_LOW(PJ08) | \
1372  PIN_ODR_LEVEL_LOW(PJ09) | \
1373  PIN_ODR_LEVEL_LOW(PJ10) | \
1374  PIN_ODR_LEVEL_LOW(PJ11) | \
1375  PIN_ODR_LEVEL_LOW(PJ12) | \
1376  PIN_ODR_LEVEL_LOW(PJ13) | \
1377  PIN_ODR_LEVEL_LOW(PJ14) | \
1378  PIN_ODR_LEVEL_LOW(PJ15))
1379 
1380 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1381  PIN_AFIO_AF(PJ01, 0) | \
1382  PIN_AFIO_AF(PJ02, 0) | \
1383  PIN_AFIO_AF(PJ03, 0) | \
1384  PIN_AFIO_AF(PJ04, 0) | \
1385  PIN_AFIO_AF(PJ05, 0) | \
1386  PIN_AFIO_AF(PJ06, 0) | \
1387  PIN_AFIO_AF(PJ07, 0))
1388 
1389 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1390  PIN_AFIO_AF(PJ09, 0) | \
1391  PIN_AFIO_AF(PJ10, 0) | \
1392  PIN_AFIO_AF(PJ11, 0) | \
1393  PIN_AFIO_AF(PJ12, 0) | \
1394  PIN_AFIO_AF(PJ13, 0) | \
1395  PIN_AFIO_AF(PJ14, 0) | \
1396  PIN_AFIO_AF(PJ15, 0))
1397 
1398 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1399  PIN_MODE_INPUT(PK01) | \
1400  PIN_MODE_INPUT(PK02) | \
1401  PIN_MODE_INPUT(PK03) | \
1402  PIN_MODE_INPUT(PK04) | \
1403  PIN_MODE_INPUT(PK05) | \
1404  PIN_MODE_INPUT(PK06) | \
1405  PIN_MODE_INPUT(PK07) | \
1406  PIN_MODE_INPUT(PK08) | \
1407  PIN_MODE_INPUT(PK09) | \
1408  PIN_MODE_INPUT(PK10) | \
1409  PIN_MODE_INPUT(PK11) | \
1410  PIN_MODE_INPUT(PK12) | \
1411  PIN_MODE_INPUT(PK13) | \
1412  PIN_MODE_INPUT(PK14) | \
1413  PIN_MODE_INPUT(PK15))
1414 
1415 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1416  PIN_OTYPE_PUSHPULL(PK01) | \
1417  PIN_OTYPE_PUSHPULL(PK02) | \
1418  PIN_OTYPE_PUSHPULL(PK03) | \
1419  PIN_OTYPE_PUSHPULL(PK04) | \
1420  PIN_OTYPE_PUSHPULL(PK05) | \
1421  PIN_OTYPE_PUSHPULL(PK06) | \
1422  PIN_OTYPE_PUSHPULL(PK07) | \
1423  PIN_OTYPE_PUSHPULL(PK08) | \
1424  PIN_OTYPE_PUSHPULL(PK09) | \
1425  PIN_OTYPE_PUSHPULL(PK10) | \
1426  PIN_OTYPE_PUSHPULL(PK11) | \
1427  PIN_OTYPE_PUSHPULL(PK12) | \
1428  PIN_OTYPE_PUSHPULL(PK13) | \
1429  PIN_OTYPE_PUSHPULL(PK14) | \
1430  PIN_OTYPE_PUSHPULL(PK15))
1431 
1432 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1433  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1434  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1435  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1436  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1437  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1438  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1439  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1440  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1441  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1442  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1443  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1444  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1445  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1446  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1447  PIN_OSPEED_SPEED_VERYLOW(PK15))
1448 
1449 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1450  PIN_PUPDR_PULLDOWN(PK01) | \
1451  PIN_PUPDR_PULLDOWN(PK02) | \
1452  PIN_PUPDR_PULLDOWN(PK03) | \
1453  PIN_PUPDR_PULLDOWN(PK04) | \
1454  PIN_PUPDR_PULLDOWN(PK05) | \
1455  PIN_PUPDR_PULLDOWN(PK06) | \
1456  PIN_PUPDR_PULLDOWN(PK07) | \
1457  PIN_PUPDR_PULLDOWN(PK08) | \
1458  PIN_PUPDR_PULLDOWN(PK09) | \
1459  PIN_PUPDR_PULLDOWN(PK10) | \
1460  PIN_PUPDR_PULLDOWN(PK11) | \
1461  PIN_PUPDR_PULLDOWN(PK12) | \
1462  PIN_PUPDR_PULLDOWN(PK13) | \
1463  PIN_PUPDR_PULLDOWN(PK14) | \
1464  PIN_PUPDR_PULLDOWN(PK15))
1465 
1466 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1467  PIN_ODR_LEVEL_LOW(PK01) | \
1468  PIN_ODR_LEVEL_LOW(PK02) | \
1469  PIN_ODR_LEVEL_LOW(PK03) | \
1470  PIN_ODR_LEVEL_LOW(PK04) | \
1471  PIN_ODR_LEVEL_LOW(PK05) | \
1472  PIN_ODR_LEVEL_LOW(PK06) | \
1473  PIN_ODR_LEVEL_LOW(PK07) | \
1474  PIN_ODR_LEVEL_LOW(PK08) | \
1475  PIN_ODR_LEVEL_LOW(PK09) | \
1476  PIN_ODR_LEVEL_LOW(PK10) | \
1477  PIN_ODR_LEVEL_LOW(PK11) | \
1478  PIN_ODR_LEVEL_LOW(PK12) | \
1479  PIN_ODR_LEVEL_LOW(PK13) | \
1480  PIN_ODR_LEVEL_LOW(PK14) | \
1481  PIN_ODR_LEVEL_LOW(PK15))
1482 
1483 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1484  PIN_AFIO_AF(PK01, 0) | \
1485  PIN_AFIO_AF(PK02, 0) | \
1486  PIN_AFIO_AF(PK03, 0) | \
1487  PIN_AFIO_AF(PK04, 0) | \
1488  PIN_AFIO_AF(PK05, 0) | \
1489  PIN_AFIO_AF(PK06, 0) | \
1490  PIN_AFIO_AF(PK07, 0))
1491 
1492 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1493  PIN_AFIO_AF(PK09, 0) | \
1494  PIN_AFIO_AF(PK10, 0) | \
1495  PIN_AFIO_AF(PK11, 0) | \
1496  PIN_AFIO_AF(PK12, 0) | \
1497  PIN_AFIO_AF(PK13, 0) | \
1498  PIN_AFIO_AF(PK14, 0) | \
1499  PIN_AFIO_AF(PK15, 0))
1500 
1501 #define AF_PA00_SERVO3 2U
1502 #define AF_LINE_SERVO3 2U
1503 #define AF_PA01_SERVO4 2U
1504 #define AF_LINE_SERVO4 2U
1505 #define AF_PA02_SERVO5 2U
1506 #define AF_LINE_SERVO5 2U
1507 #define AF_PA03_SERVO6 2U
1508 #define AF_LINE_SERVO6 2U
1509 #define AF_PA05_SPI1_SCK 5U
1510 #define AF_LINE_SPI1_SCK 5U
1511 #define AF_PA06_SPI1_MISO 5U
1512 #define AF_LINE_SPI1_MISO 5U
1513 #define AF_PA08_LED_WS2812 1U
1514 #define AF_LINE_LED_WS2812 1U
1515 #define AF_PA09_UART1_TX 7U
1516 #define AF_LINE_UART1_TX 7U
1517 #define AF_PA10_UART1_RX 7U
1518 #define AF_LINE_UART1_RX 7U
1519 #define AF_PA11_USB_DM 10U
1520 #define AF_LINE_USB_DM 10U
1521 #define AF_PA12_USB_DP 10U
1522 #define AF_LINE_USB_DP 10U
1523 #define AF_PA13_SWDIO 0U
1524 #define AF_LINE_SWDIO 0U
1525 #define AF_PA14_SWCLK 0U
1526 #define AF_LINE_SWCLK 0U
1527 #define AF_PA15_ALARM 1U
1528 #define AF_LINE_ALARM 1U
1529 #define AF_PB00_SERVO1 2U
1530 #define AF_LINE_SERVO1 2U
1531 #define AF_PB01_SERVO2 2U
1532 #define AF_LINE_SERVO2 2U
1533 #define AF_PB03_SPI3_SCK 6U
1534 #define AF_LINE_SPI3_SCK 6U
1535 #define AF_PB04_SPI3_MISO 6U
1536 #define AF_LINE_SPI3_MISO 6U
1537 #define AF_PB05_SPI3_MOSI 7U
1538 #define AF_LINE_SPI3_MOSI 7U
1539 #define AF_PB06_I2C1_SCL 4U
1540 #define AF_LINE_I2C1_SCL 4U
1541 #define AF_PB07_I2C1_SDA 4U
1542 #define AF_LINE_I2C1_SDA 4U
1543 #define AF_PB08_UART4_RX 8U
1544 #define AF_LINE_UART4_RX 8U
1545 #define AF_PB09_UART4_TX 8U
1546 #define AF_LINE_UART4_TX 8U
1547 #define AF_PB10_I2C2_SCL 4U
1548 #define AF_LINE_I2C2_SCL 4U
1549 #define AF_PB11_I2C2_SDA 4U
1550 #define AF_LINE_I2C2_SDA 4U
1551 #define AF_PB13_SPI2_SCK 5U
1552 #define AF_LINE_SPI2_SCK 5U
1553 #define AF_PB14_SPI2_MISO 5U
1554 #define AF_LINE_SPI2_MISO 5U
1555 #define AF_PB15_SPI2_MOSI 5U
1556 #define AF_LINE_SPI2_MOSI 5U
1557 #define AF_PC06_UART6_TX 7U
1558 #define AF_LINE_UART6_TX 7U
1559 #define AF_PC08_SDIO_D0 12U
1560 #define AF_LINE_SDIO_D0 12U
1561 #define AF_PC09_SDIO_D1 12U
1562 #define AF_LINE_SDIO_D1 12U
1563 #define AF_PC10_SDIO_D2 12U
1564 #define AF_LINE_SDIO_D2 12U
1565 #define AF_PC11_SDIO_D3 12U
1566 #define AF_LINE_SDIO_D3 12U
1567 #define AF_PC12_SDIO_CK 12U
1568 #define AF_LINE_SDIO_CK 12U
1569 #define AF_PD00_CAN1_RX 9U
1570 #define AF_LINE_CAN1_RX 9U
1571 #define AF_PD01_CAN1_TX 9U
1572 #define AF_LINE_CAN1_TX 9U
1573 #define AF_PD02_SDIO_CMD 12U
1574 #define AF_LINE_SDIO_CMD 12U
1575 #define AF_PD05_UART2_TX 7U
1576 #define AF_LINE_UART2_TX 7U
1577 #define AF_PD06_UART2_RX 7U
1578 #define AF_LINE_UART2_RX 7U
1579 #define AF_PD07_SPI1_MOSI 5U
1580 #define AF_LINE_SPI1_MOSI 5U
1581 #define AF_PD08_UART3_TX 7U
1582 #define AF_LINE_UART3_TX 7U
1583 #define AF_PD09_UART3_RX 7U
1584 #define AF_LINE_UART3_RX 7U
1585 #define AF_PD12_SERVO7 2U
1586 #define AF_LINE_SERVO7 2U
1587 #define AF_PD13_SERVO8 2U
1588 #define AF_LINE_SERVO8 2U
1589 #define AF_PD14_SERVO9 2U
1590 #define AF_LINE_SERVO9 2U
1591 #define AF_PD15_SERVO10 2U
1592 #define AF_LINE_SERVO10 2U
1593 #define AF_PE00_UART8_RX 8U
1594 #define AF_LINE_UART8_RX 8U
1595 #define AF_PE01_UART8_TX 8U
1596 #define AF_LINE_UART8_TX 8U
1597 #define AF_PE05_SERVO11 4U
1598 #define AF_LINE_SERVO11 4U
1599 #define AF_PE06_SERVO12 4U
1600 #define AF_LINE_SERVO12 4U
1601 #define AF_PE07_UART7_RX 7U
1602 #define AF_LINE_UART7_RX 7U
1603 #define AF_PE08_UART7_TX 7U
1604 #define AF_LINE_UART7_TX 7U
1605 #define AF_PE12_SPI4_CLK 5U
1606 #define AF_LINE_SPI4_CLK 5U
1607 #define AF_PE13_SPI4_MISO 5U
1608 #define AF_LINE_SPI4_MISO 5U
1609 #define AF_PE14_SPI4_MOSI 5U
1610 #define AF_LINE_SPI4_MOSI 5U
1611 #define AF_PH00_OSC_IN 0U
1612 #define AF_LINE_OSC_IN 0U
1613 #define AF_PH01_OSC_OUT 0U
1614 #define AF_LINE_OSC_OUT 0U
1615 
1616 
1617 #define SERVO3_TIM 5
1618 #define SERVO3_TIM_FN CH
1619 #define SERVO3_TIM_CH 1
1620 #define SERVO3_TIM_AF 2
1621 #define SERVO4_TIM 5
1622 #define SERVO4_TIM_FN CH
1623 #define SERVO4_TIM_CH 2
1624 #define SERVO4_TIM_AF 2
1625 #define SERVO5_TIM 5
1626 #define SERVO5_TIM_FN CH
1627 #define SERVO5_TIM_CH 3
1628 #define SERVO5_TIM_AF 2
1629 #define SERVO6_TIM 5
1630 #define SERVO6_TIM_FN CH
1631 #define SERVO6_TIM_CH 4
1632 #define SERVO6_TIM_AF 2
1633 #define ADC3_ADC 1
1634 #define ADC3_ADC_FN INP
1635 #define ADC3_ADC_INP 18
1636 #define ADC4_ADC 1
1637 #define ADC4_ADC_FN INP
1638 #define ADC4_ADC_INP 7
1639 #define LED_WS2812_TIM 1
1640 #define LED_WS2812_TIM_FN CH
1641 #define LED_WS2812_TIM_CH 1
1642 #define LED_WS2812_TIM_AF 1
1643 #define ALARM_TIM 2
1644 #define ALARM_TIM_FN CH
1645 #define ALARM_TIM_CH 1
1646 #define ALARM_TIM_AF 1
1647 #define SERVO1_TIM 3
1648 #define SERVO1_TIM_FN CH
1649 #define SERVO1_TIM_CH 3
1650 #define SERVO1_TIM_AF 2
1651 #define SERVO2_TIM 3
1652 #define SERVO2_TIM_FN CH
1653 #define SERVO2_TIM_CH 4
1654 #define SERVO2_TIM_AF 2
1655 #define ADC5_ADC 1
1656 #define ADC5_ADC_FN INP
1657 #define ADC5_ADC_INP 10
1658 #define ADC6_ADC 1
1659 #define ADC6_ADC_FN INP
1660 #define ADC6_ADC_INP 11
1661 #define ADC1_ADC 1
1662 #define ADC1_ADC_FN INP
1663 #define ADC1_ADC_INP 8
1664 #define ADC2_ADC 1
1665 #define ADC2_ADC_FN INP
1666 #define ADC2_ADC_INP 4
1667 #define RC1_TIM 3
1668 #define RC1_TIM_FN CH
1669 #define RC1_TIM_CH 2
1670 #define RC1_TIM_AF 2
1671 #define RC1_USART 6
1672 #define RC1_USART_FN RX
1673 #define RC1_USART_AF 7
1674 #define SERVO7_TIM 4
1675 #define SERVO7_TIM_FN CH
1676 #define SERVO7_TIM_CH 1
1677 #define SERVO7_TIM_AF 2
1678 #define SERVO8_TIM 4
1679 #define SERVO8_TIM_FN CH
1680 #define SERVO8_TIM_CH 2
1681 #define SERVO8_TIM_AF 2
1682 #define SERVO9_TIM 4
1683 #define SERVO9_TIM_FN CH
1684 #define SERVO9_TIM_CH 3
1685 #define SERVO9_TIM_AF 2
1686 #define SERVO10_TIM 4
1687 #define SERVO10_TIM_FN CH
1688 #define SERVO10_TIM_CH 4
1689 #define SERVO10_TIM_AF 2
1690 #define SERVO11_TIM 15
1691 #define SERVO11_TIM_FN CH
1692 #define SERVO11_TIM_CH 1
1693 #define SERVO11_TIM_AF 4
1694 #define SERVO12_TIM 15
1695 #define SERVO12_TIM_FN CH
1696 #define SERVO12_TIM_CH 2
1697 #define SERVO12_TIM_AF 4
1698 
1699 #define BOARD_GROUP_DECLFOREACH(line, group) \
1700  static const ioline_t group ## _ARRAY[] = {group}; \
1701  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1702 
1703 #define BOARD_GROUP_FOREACH(line, group) \
1704  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1705 
1706 
1707 #define BOARD_GROUP_DECLFOR(array, index, group) \
1708  static const ioline_t group ## _ARRAY[] = {group}; \
1709  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1710 
1711 #define BOARD_GROUP_FOR(array, index, group) \
1712  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1713 
1714 #define ENERGY_SAVE_INPUTS \
1715  LINE_SERVO3, \
1716  LINE_SERVO4, \
1717  LINE_SERVO5, \
1718  LINE_SERVO6, \
1719  LINE_SERVO1, \
1720  LINE_SERVO2, \
1721  LINE_SPI_SLAVE4, \
1722  LINE_SPI_SLAVE6, \
1723  LINE_SPI_SLAVE5, \
1724  LINE_SPI_SLAVE1, \
1725  LINE_SERVO7, \
1726  LINE_SERVO8, \
1727  LINE_SERVO9, \
1728  LINE_SERVO10, \
1729  LINE_SPI_SLAVE2, \
1730  LINE_LED1, \
1731  LINE_LED2, \
1732  LINE_SERVO11, \
1733  LINE_SERVO12, \
1734  LINE_SPI_SLAVE3
1735 #define ENERGY_SAVE_INPUTS_SIZE 20
1736 
1737 #define ENERGY_SAVE_LOWS \
1738  LINE_ALARM
1739 #define ENERGY_SAVE_LOWS_SIZE 1
1740 
1741 #if !defined(_FROM_ASM_)
1742 #ifdef __cplusplus
1743 extern "C" {
1744 #endif
1745  void boardInit(void);
1746 #ifdef __cplusplus
1747 }
1748 #endif
1749 #endif /* _FROM_ASM_ */
1750 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:317