Paparazzi UAS  v5.15_devel-99-g2ff7410
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
board.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #pragma once
18 
19 /*
20  ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
21 
22  Licensed under the Apache License, Version 2.0 (the "License");
23  you may not use this file except in compliance with the License.
24  You may obtain a copy of the License at
25 
26  http://www.apache.org/licenses/LICENSE-2.0
27 
28  Unless required by applicable law or agreed to in writing, software
29  distributed under the License is distributed on an "AS IS" BASIS,
30  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  See the License for the specific language governing permissions and
32  limitations under the License.
33 */
34 
35 /*
36  * Board identifier.
37  */
38 #define BOARD_ST_APOGEE
39 #define BOARD_NAME "AB/GRZ STM32F4 Apogee 1.0"
40 
41 /*
42  * Board oscillators-related settings.
43  * NOTE: LSE fitted.
44  */
45 #if !defined(STM32_LSECLK)
46 #define STM32_LSECLK 32768
47 #endif
48 
49 #if !defined(STM32_HSECLK)
50 #define STM32_HSECLK 16000000
51 #endif
52 
53 
54 /*
55  * Board voltages.
56  * Required for performance limits calculation.
57  */
58 #define STM32_VDD 300
59 
60 /*
61  * MCU type as defined in the ST header file stm32f4xx.h.
62  */
63 #define STM32F407xx
64 
65 /*
66  * PAPARAZZI CONFIGURATION
67  */
68 
69 
70 
71 /*
72  * AHB_CLK
73  */
74 #define AHB_CLK STM32_HCLK
75 
76 
77 /*
78  * LEDs
79  */
80 /* red, on PC0 */
81 #ifndef USE_LED_1
82 #define USE_LED_1 1
83 #endif
84 #define LED_1_GPIO GPIOC
85 #define LED_1_GPIO_PIN GPIO0
86 #define LED_1_GPIO_ON gpio_clear
87 #define LED_1_GPIO_OFF gpio_set
88 
89 /* orange, on PC13 */
90 #ifndef USE_LED_2
91 #define USE_LED_2 1
92 #endif
93 #define LED_2_GPIO GPIOC
94 #define LED_2_GPIO_PIN GPIO13
95 #define LED_2_GPIO_ON gpio_clear
96 #define LED_2_GPIO_OFF gpio_set
97 
98 /* green, on PC1 */
99 #ifndef USE_LED_3
100 #define USE_LED_3 1
101 #endif
102 #define LED_3_GPIO GPIOC
103 #define LED_3_GPIO_PIN GPIO1
104 #define LED_3_GPIO_ON gpio_clear
105 #define LED_3_GPIO_OFF gpio_set
106 
107 /* yellow, on PC3 */
108 #ifndef USE_LED_4
109 #define USE_LED_4 1
110 #endif
111 #define LED_4_GPIO GPIOC
112 #define LED_4_GPIO_PIN GPIO3
113 #define LED_4_GPIO_ON gpio_clear
114 #define LED_4_GPIO_OFF gpio_set
115 
116 /* AUX1, on PB1, 1 on LED_ON, 0 on LED_OFF */
117 #ifndef USE_LED_5
118 #define USE_LED_5 0
119 #endif
120 #define LED_5_GPIO GPIOB
121 #define LED_5_GPIO_PIN GPIO1
122 #define LED_5_GPIO_ON gpio_set
123 #define LED_5_GPIO_OFF gpio_clear
124 
125 /* AUX2, on PC5, 1 on LED_ON, 0 on LED_OFF */
126 #ifndef USE_LED_6
127 #define USE_LED_6 0
128 #endif
129 #define LED_6_GPIO GPIOC
130 #define LED_6_GPIO_PIN GPIO5
131 #define LED_6_GPIO_ON gpio_set
132 #define LED_6_GPIO_OFF gpio_clear
133 
134 /* AUX3, on PC4, 1 on LED_ON, 0 on LED_OFF */
135 #ifndef USE_LED_7
136 #define USE_LED_7 0
137 #endif
138 #define LED_7_GPIO GPIOC
139 #define LED_7_GPIO_PIN GPIO4
140 #define LED_7_GPIO_ON gpio_set
141 #define LED_7_GPIO_OFF gpio_clear
142 
143 /* AUX4, on PB15, 1 on LED_ON, 0 on LED_OFF */
144 #ifndef USE_LED_8
145 #define USE_LED_8 0
146 #endif
147 #define LED_8_GPIO GPIOB
148 #define LED_8_GPIO_PIN GPIO15
149 #define LED_8_GPIO_ON gpio_set
150 #define LED_8_GPIO_OFF gpio_clear
151 
152 
153 /* Pint to set Uart2 RX polarity, on PB13, output high inverts, low doesn't */
154 #define RC_POLARITY_GPIO_PORT GPIOB
155 #define RC_POLARITY_GPIO_PIN GPIO13
156 
157 /*
158  * ADCs
159  */
160 // AUX 1
161 #if USE_ADC_1
162 #define AD1_1_CHANNEL ADC_CHANNEL_IN9
163 #define ADC_1 AD1_1
164 #define ADC_1_GPIO_PORT GPIOB
165 #define ADC_1_GPIO_PIN GPIO1
166 #endif
167 
168 // AUX 2
169 #if USE_ADC_2
170 #define AD1_2_CHANNEL ADC_CHANNEL_IN15
171 #define ADC_2 AD1_2
172 #define ADC_2_GPIO_PORT GPIOC
173 #define ADC_2_GPIO_PIN GPIO5
174 #endif
175 
176 // AUX 3
177 #if USE_ADC_3
178 #define AD1_3_CHANNEL ADC_CHANNEL_IN14
179 #define ADC_3 AD1_3
180 #define ADC_3_GPIO_PORT GPIOC
181 #define ADC_3_GPIO_PIN GPIO4
182 #endif
183 
184 // Internal ADC for battery enabled by default
185 #ifndef USE_ADC_4
186 #define USE_ADC_4 1
187 #endif
188 #if USE_ADC_4
189 #define AD1_4_CHANNEL ADC_CHANNEL_IN4
190 #define ADC_4 AD1_4
191 #define ADC_4_GPIO_PORT GPIOA
192 #define ADC_4_GPIO_PIN GPIO4
193 #endif
194 
195 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
196 #ifndef ADC_CHANNEL_VSUPPLY
197 #define ADC_CHANNEL_VSUPPLY ADC_4
198 #endif
199 
200 #define DefaultVoltageOfAdc(adc) (0.006185*adc)
201 
202 /*
203  * PWM defines
204  */
205 #ifndef USE_PWM0
206 #define USE_PWM0 1
207 #endif
208 #if USE_PWM0
209 #define PWM_SERVO_0 0
210 #define PWM_SERVO_0_GPIO GPIOB
211 #define PWM_SERVO_0_PIN GPIO0
212 #define PWM_SERVO_0_AF GPIO_AF2
213 #define PWM_SERVO_0_DRIVER PWMD3
214 #define PWM_SERVO_0_CHANNEL 2
215 #define PWM_SERVO_0_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
216 #else
217 #define PWM_SERVO_0_ACTIVE PWM_OUTPUT_DISABLED
218 #endif
219 
220 #ifndef USE_PWM1
221 #define USE_PWM1 1
222 #endif
223 #if USE_PWM1
224 #define PWM_SERVO_1 1
225 #define PWM_SERVO_1_GPIO GPIOA
226 #define PWM_SERVO_1_PIN GPIO2
227 #define PWM_SERVO_1_AF GPIO_AF1
228 #define PWM_SERVO_1_DRIVER PWMD2
229 #define PWM_SERVO_1_CHANNEL 2
230 #define PWM_SERVO_1_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
231 #else
232 #define PWM_SERVO_1_ACTIVE PWM_OUTPUT_DISABLED
233 #endif
234 
235 #ifndef USE_PWM2
236 #define USE_PWM2 1
237 #endif
238 #if USE_PWM2
239 #define PWM_SERVO_2 2
240 #define PWM_SERVO_2_GPIO GPIOB
241 #define PWM_SERVO_2_PIN GPIO5
242 #define PWM_SERVO_2_AF GPIO_AF2
243 #define PWM_SERVO_2_DRIVER PWMD3
244 #define PWM_SERVO_2_CHANNEL 1
245 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
246 #else
247 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
248 #endif
249 
250 #ifndef USE_PWM3
251 #define USE_PWM3 1
252 #endif
253 #if USE_PWM3
254 #define PWM_SERVO_3 3
255 #define PWM_SERVO_3_GPIO GPIOB
256 #define PWM_SERVO_3_PIN GPIO4
257 #define PWM_SERVO_3_AF GPIO_AF2
258 #define PWM_SERVO_3_DRIVER PWMD3
259 #define PWM_SERVO_3_CHANNEL 0
260 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
261 #else
262 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
263 #endif
264 
265 #ifndef USE_PWM4
266 #define USE_PWM4 1
267 #endif
268 #if USE_PWM4
269 #define PWM_SERVO_4 4
270 #define PWM_SERVO_4_GPIO GPIOB
271 #define PWM_SERVO_4_PIN GPIO3
272 #define PWM_SERVO_4_AF GPIO_AF1
273 #define PWM_SERVO_4_DRIVER PWMD2
274 #define PWM_SERVO_4_CHANNEL 1
275 #define PWM_SERVO_4_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
276 #else
277 #define PWM_SERVO_4_ACTIVE PWM_OUTPUT_DISABLED
278 #endif
279 
280 #ifndef USE_PWM5
281 #define USE_PWM5 1
282 #endif
283 #if USE_PWM5
284 #define PWM_SERVO_5 5
285 #define PWM_SERVO_5_GPIO GPIOA
286 #define PWM_SERVO_5_PIN GPIO15
287 #define PWM_SERVO_5_AF GPIO_AF1
288 #define PWM_SERVO_5_DRIVER PWMD2
289 #define PWM_SERVO_5_CHANNEL 0
290 #define PWM_SERVO_5_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
291 #else
292 #define PWM_SERVO_5_ACTIVE PWM_OUTPUT_DISABLED
293 #endif
294 
295 #if USE_PWM6
296 #define PWM_SERVO_6 6
297 #define PWM_SERVO_6_GPIO GPIOB
298 #define PWM_SERVO_6_PIN GPIO1
299 #define PWM_SERVO_6_AF GPIO_AF2
300 #define PWM_SERVO_6_DRIVER PWMD3
301 #define PWM_SERVO_6_CHANNEL 3
302 #define PWM_SERVO_6_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
303 #else
304 #define PWM_SERVO_6_ACTIVE PWM_OUTPUT_DISABLED
305 #endif
306 
307 
308 #ifdef STM32_PWM_USE_TIM2
309 #define PWM_CONF_TIM2 STM32_PWM_USE_TIM2
310 #else
311 #define PWM_CONF_TIM2 1
312 #endif
313 #define PWM_CONF2_DEF { \
314  PWM_FREQUENCY, \
315  PWM_FREQUENCY/TIM2_SERVO_HZ, \
316  NULL, \
317  { \
318  { PWM_SERVO_5_ACTIVE, NULL }, \
319  { PWM_SERVO_4_ACTIVE, NULL }, \
320  { PWM_SERVO_1_ACTIVE, NULL }, \
321  { PWM_OUTPUT_DISABLED, NULL }, \
322  }, \
323  0, \
324  0 \
325 }
326 
327 #ifdef STM32_PWM_USE_TIM3
328 #define PWM_CONF_TIM3 STM32_PWM_USE_TIM3
329 #else
330 #define PWM_CONF_TIM3 1
331 #endif
332 #define PWM_CONF3_DEF { \
333  PWM_FREQUENCY, \
334  PWM_FREQUENCY/TIM3_SERVO_HZ, \
335  NULL, \
336  { \
337  { PWM_SERVO_3_ACTIVE, NULL }, \
338  { PWM_SERVO_2_ACTIVE, NULL }, \
339  { PWM_SERVO_0_ACTIVE, NULL }, \
340  { PWM_SERVO_6_ACTIVE, NULL }, \
341  }, \
342  0, \
343  0 \
344 }
345 
349 #define DSHOT_SERVO_0 0
350 #define DSHOT_SERVO_0_GPIO GPIOB
351 #define DSHOT_SERVO_0_PIN GPIO0
352 #define DSHOT_SERVO_0_AF GPIO_AF2
353 #define DSHOT_SERVO_0_DRIVER DSHOTD3
354 #define DSHOT_SERVO_0_CHANNEL 2
355 
356 #define DSHOT_SERVO_1 1
357 #define DSHOT_SERVO_1_GPIO GPIOA
358 #define DSHOT_SERVO_1_PIN GPIO2
359 #define DSHOT_SERVO_1_AF GPIO_AF1
360 #define DSHOT_SERVO_1_DRIVER DSHOTD2
361 #define DSHOT_SERVO_1_CHANNEL 2
362 
363 #define DSHOT_SERVO_2 2
364 #define DSHOT_SERVO_2_GPIO GPIOB
365 #define DSHOT_SERVO_2_PIN GPIO5
366 #define DSHOT_SERVO_2_AF GPIO_AF2
367 #define DSHOT_SERVO_2_DRIVER DSHOTD3
368 #define DSHOT_SERVO_2_CHANNEL 1
369 
370 #define DSHOT_SERVO_3 3
371 #define DSHOT_SERVO_3_GPIO GPIOB
372 #define DSHOT_SERVO_3_PIN GPIO4
373 #define DSHOT_SERVO_3_AF GPIO_AF2
374 #define DSHOT_SERVO_3_DRIVER DSHOTD3
375 #define DSHOT_SERVO_3_CHANNEL 0
376 
377 #define DSHOT_SERVO_4 4
378 #define DSHOT_SERVO_4_GPIO GPIOB
379 #define DSHOT_SERVO_4_PIN GPIO3
380 #define DSHOT_SERVO_4_AF GPIO_AF1
381 #define DSHOT_SERVO_4_DRIVER DSHOTD2
382 #define DSHOT_SERVO_4_CHANNEL 1
383 
384 #define DSHOT_SERVO_5 5
385 #define DSHOT_SERVO_5_GPIO GPIOA
386 #define DSHOT_SERVO_5_PIN GPIO15
387 #define DSHOT_SERVO_5_AF GPIO_AF1
388 #define DSHOT_SERVO_5_DRIVER DSHOTD2
389 #define DSHOT_SERVO_5_CHANNEL 0
390 
391 #if USE_DSHOT6
392 // DSHOT6 on AUX1 pin, not activated by default
393 #define DSHOT_SERVO_6 6
394 #define DSHOT_SERVO_6_GPIO GPIOB
395 #define DSHOT_SERVO_6_PIN GPIO1
396 #define DSHOT_SERVO_6_AF GPIO_AF2
397 #define DSHOT_SERVO_6_DRIVER DSHOTD3
398 #define DSHOT_SERVO_6_CHANNEL 3
399 #endif
400 
401 #ifndef DSHOT_TELEMETRY_DEV
402 #define DSHOT_TELEMETRY_DEV NULL
403 #endif
404 
405 #define DSHOT_CONF_TIM2 1
406 #define DSHOT_CONF2_DEF { \
407  .dma_stream = STM32_PWM2_UP_DMA_STREAM, \
408  .dma_channel = STM32_PWM2_UP_DMA_CHANNEL, \
409  .pwmp = &PWMD2, \
410  .tlm_sd = DSHOT_TELEMETRY_DEV \
411 }
412 
413 #define DSHOT_CONF_TIM3 1
414 #define DSHOT_CONF3_DEF { \
415  .dma_stream = STM32_PWM3_UP_DMA_STREAM, \
416  .dma_channel = STM32_PWM3_UP_DMA_CHANNEL, \
417  .pwmp = &PWMD3, \
418  .tlm_sd = DSHOT_TELEMETRY_DEV \
419 }
420 
424 #define RC_PPM_TICKS_PER_USEC 2
425 #define PPM_TIMER_FREQUENCY 2000000
426 #define PPM_CHANNEL ICU_CHANNEL_1
427 #define PPM_TIMER ICUD1
428 
429 /*
430  * Spektrum
431  */
432 
433 // shorter wait with chibios as the RTC oscillator takes longer to stabilize
434 #define SPEKTRUM_BIND_WAIT 30000
435 
436 /* The line that is pulled low at power up to initiate the bind process
437  * PB15: AUX4
438  */
439 #define SPEKTRUM_BIND_PIN GPIO15
440 #define SPEKTRUM_BIND_PIN_PORT GPIOB
441 
442 /* The line used to send the pulse train for the bind process
443  * When using UART2 on Apogee, this as to be a different pin than the uart2 rx
444  * Default pin for this is PA8: PPM_IN
445  */
446 #ifndef SPEKTRUM_PRIMARY_BIND_CONF_PORT
447 #define SPEKTRUM_PRIMARY_BIND_CONF_PORT GPIOA
448 #define SPEKTRUM_PRIMARY_BIND_CONF_PIN GPIO8
449 #endif
450 
451 /*
452  * PWM input
453  */
454 // PWM_INPUT 1 on PA8 (also PPM IN)
455 #define PWM_INPUT1_ICU ICUD1
456 #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
457 // PPM in (aka PA8) is used: not compatible with PPM RC receiver
458 #define PWM_INPUT1_GPIO_PORT GPIOA
459 #define PWM_INPUT1_GPIO_PIN GPIO8
460 #define PWM_INPUT1_GPIO_AF GPIO_AF1
461 
462 // PWM_INPUT 2 on PA3 (also SERVO 1)
463 #if (USE_PWM1 && USE_PWM_INPUT2)
464 #error "PW1 and PWM_INPUT2 are not compatible"
465 #endif
466 #define PWM_INPUT2_ICU ICUD9
467 #define PWM_INPUT2_CHANNEL ICU_CHANNEL_1
468 #define PWM_INPUT2_GPIO_PORT GPIOA
469 #define PWM_INPUT2_GPIO_PIN GPIO2
470 #define PWM_INPUT2_GPIO_AF GPIO_AF3
471 
475 #ifndef I2C1_CLOCK_SPEED
476 #define I2C1_CLOCK_SPEED 400000
477 #endif
478 #if I2C1_CLOCK_SPEED == 400000
479 #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
480 #elif I2C1_CLOCK_SPEED == 100000
481 #define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
482 #else
483 #error Invalid I2C1 clock speed
484 #endif
485 #define I2C1_CFG_DEF { \
486  OPMODE_I2C, \
487  I2C1_CLOCK_SPEED, \
488  I2C1_DUTY_CYCLE, \
489  }
490 
491 #ifndef I2C2_CLOCK_SPEED
492 #define I2C2_CLOCK_SPEED 400000
493 #endif
494 #if I2C2_CLOCK_SPEED == 400000
495 #define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
496 #elif I2C2_CLOCK_SPEED == 100000
497 #define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
498 #else
499 #error Invalid I2C2 clock speed
500 #endif
501 #define I2C2_CFG_DEF { \
502  OPMODE_I2C, \
503  I2C2_CLOCK_SPEED, \
504  I2C2_DUTY_CYCLE, \
505  }
506 
510 #define SPI1_GPIO_AF GPIO_AF5
511 #define SPI1_GPIO_PORT_MISO GPIOA
512 #define SPI1_GPIO_MISO GPIO6
513 #define SPI1_GPIO_PORT_MOSI GPIOA
514 #define SPI1_GPIO_MOSI GPIO7
515 #define SPI1_GPIO_PORT_SCK GPIOA
516 #define SPI1_GPIO_SCK GPIO5
517 
518 // SLAVE0 on SPI connector
519 #define SPI_SELECT_SLAVE0_PORT GPIOB
520 #define SPI_SELECT_SLAVE0_PIN GPIO9
521 // SLAVE1 on AUX1
522 #define SPI_SELECT_SLAVE1_PORT GPIOB
523 #define SPI_SELECT_SLAVE1_PIN GPIO1
524 // SLAVE2 on AUX2
525 #define SPI_SELECT_SLAVE2_PORT GPIOC
526 #define SPI_SELECT_SLAVE2_PIN GPIO5
527 // SLAVE3 on AUX3
528 #define SPI_SELECT_SLAVE3_PORT GPIOC
529 #define SPI_SELECT_SLAVE3_PIN GPIO4
530 // SLAVE4 on AUX4
531 #define SPI_SELECT_SLAVE4_PORT GPIOB
532 #define SPI_SELECT_SLAVE4_PIN GPIO15
533 
540 #ifndef USE_BARO_BOARD
541 #define USE_BARO_BOARD 1
542 #endif
543 
544 /*
545  * Actuators for fixedwing
546  */
547  /* Default actuators driver */
548 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
549 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
550 #define ActuatorsDefaultInit() ActuatorsPwmInit()
551 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
552 
553 
557 #define SDIO_D0_PORT GPIOC
558 #define SDIO_D0_PIN SDIO_D0
559 #define SDIO_D1_PORT GPIOC
560 #define SDIO_D1_PIN SDIO_D1
561 #define SDIO_D2_PORT GPIOC
562 #define SDIO_D2_PIN SDIO_D2
563 #define SDIO_D3_PORT GPIOC
564 #define SDIO_D3_PIN SDIO_D3
565 #define SDIO_CK_PORT GPIOC
566 #define SDIO_CK_PIN SDIO_CK
567 #define SDIO_CMD_PORT GPIOD
568 #define SDIO_CMD_PIN SDIO_CMD
569 #define SDIO_AF 12
570 // bat monitoring for file closing
571 #define SDLOG_BAT_ADC ADCD1
572 #define SDLOG_BAT_CHAN AD1_4_CHANNEL
573 // usb led status
574 #define SDLOG_USB_LED 4
575 #define SDLOG_USB_VBUS_PORT GPIOA
576 #define SDLOG_USB_VBUS_PIN GPIO9
577 
578 
582 #define WS2812D1_CFG_DEF { \
583  .dma_stream = STM32_PWM1_UP_DMA_STREAM, \
584  .dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
585  .dma_priority = STM32_PWM1_UP_DMA_PRIORITY, \
586  .pwm_channel = 0, \
587  .pwmp = &PWMD1 \
588 }
589 
590 
591 /*
592  * IO pins assignments.
593  */
594 /*
595  * IO pins assignments.
596  */
597 #define UART4_TX 0U
598 #define UART4_RX 1U
599 #define PWM2_CH3 2U
600 #define UART2_RX 3U
601 #define ADC1_IN4 4U
602 #define SPI1_SCK 5U
603 #define SPI1_MISO 6U
604 #define SPI1_MOSI 7U
605 #define CU1_CH1 8U
606 #define OTG_FS_VBUS 9U
607 #define USART1_RX 10U
608 #define OTG_FS_DM 11U
609 #define OTG_FS_DP 12U
610 #define SWDIO 13U
611 #define SWCLK 14U
612 #define PWM2_CH1 15U
613 
614 #define PWM3_CH3 0U
615 #define AUX1 1U
616 #define BOOT1 2U
617 #define PWM2_CH2 3U
618 #define PWM3_CH1 4U
619 #define PWM3_CH2 5U
620 #define USART1_TX 6U
621 #define I2C1_SDA 7U
622 #define I2C1_SCL 8U
623 #define SPI1_CS 9U
624 #define I2C2_SCL 10U
625 #define I2C2_SDA 11U
626 #define POWER_SWITCH 12U
627 #define RX2_POL 13U
628 #define SDIO_DETECT 14U
629 #define AUX4 15U
630 
631 #define LED1 0U
632 #define LED3 1U
633 #define PC02 2U
634 #define LED4 3U
635 #define AUX3 4U
636 #define AUX2 5U
637 #define USART6_TX 6U
638 #define USART6_RX 7U
639 #define SDIO_D0 8U
640 #define SDIO_D1 9U
641 #define SDIO_D2 10U
642 #define SDIO_D3 11U
643 #define SDIO_CK 12U
644 #define LED2 13U
645 #define OSC32_IN 14U
646 #define OSC32_OUT 15U
647 
648 #define PD00 0U
649 #define PD01 1U
650 #define SDIO_CMD 2U
651 #define PD03 3U
652 #define PD04 4U
653 #define PD05 5U
654 #define PD06 6U
655 #define PD07 7U
656 #define PD08 8U
657 #define PD09 9U
658 #define PD10 10U
659 #define PD11 11U
660 #define PD12 12U
661 #define PD13 13U
662 #define PD14 14U
663 #define PD15 15U
664 
665 #define PE00 0U
666 #define PE01 1U
667 #define PE02 2U
668 #define PE03 3U
669 #define PE04 4U
670 #define PE05 5U
671 #define PE06 6U
672 #define PE07 7U
673 #define PE08 8U
674 #define PE09 9U
675 #define PE10 10U
676 #define PE11 11U
677 #define PE12 12U
678 #define PE13 13U
679 #define PE14 14U
680 #define PE15 15U
681 
682 #define PF00 0U
683 #define PF01 1U
684 #define PF02 2U
685 #define PF03 3U
686 #define PF04 4U
687 #define PF05 5U
688 #define PF06 6U
689 #define PF07 7U
690 #define PF08 8U
691 #define PF09 9U
692 #define PF10 10U
693 #define PF11 11U
694 #define PF12 12U
695 #define PF13 13U
696 #define PF14 14U
697 #define PF15 15U
698 
699 #define PG00 0U
700 #define PG01 1U
701 #define PG02 2U
702 #define PG03 3U
703 #define PG04 4U
704 #define PG05 5U
705 #define PG06 6U
706 #define PG07 7U
707 #define PG08 8U
708 #define PG09 9U
709 #define PG10 10U
710 #define PG11 11U
711 #define PG12 12U
712 #define PG13 13U
713 #define PG14 14U
714 #define PG15 15U
715 
716 #define OSC_IN 0U
717 #define OSC_OUT 1U
718 #define PH02 2U
719 #define PH03 3U
720 #define PH04 4U
721 #define PH05 5U
722 #define PH06 6U
723 #define PH07 7U
724 #define PH08 8U
725 #define PH09 9U
726 #define PH10 10U
727 #define PH11 11U
728 #define PH12 12U
729 #define PH13 13U
730 #define PH14 14U
731 #define PH15 15U
732 
733 #define PI00 0U
734 #define PI01 1U
735 #define PI02 2U
736 #define PI03 3U
737 #define PI04 4U
738 #define PI05 5U
739 #define PI06 6U
740 #define PI07 7U
741 #define PI08 8U
742 #define PI09 9U
743 #define PI10 10U
744 #define PI11 11U
745 #define PI12 12U
746 #define PI13 13U
747 #define PI14 14U
748 #define PI15 15U
749 
750 #define PJ00 0U
751 #define PJ01 1U
752 #define PJ02 2U
753 #define PJ03 3U
754 #define PJ04 4U
755 #define PJ05 5U
756 #define PJ06 6U
757 #define PJ07 7U
758 #define PJ08 8U
759 #define PJ09 9U
760 #define PJ10 10U
761 #define PJ11 11U
762 #define PJ12 12U
763 #define PJ13 13U
764 #define PJ14 14U
765 #define PJ15 15U
766 
767 #define PK00 0U
768 #define PK01 1U
769 #define PK02 2U
770 #define PK03 3U
771 #define PK04 4U
772 #define PK05 5U
773 #define PK06 6U
774 #define PK07 7U
775 #define PK08 8U
776 #define PK09 9U
777 #define PK10 10U
778 #define PK11 11U
779 #define PK12 12U
780 #define PK13 13U
781 #define PK14 14U
782 #define PK15 15U
783 
784 /*
785  * IO lines assignments.
786  */
787 #define LINE_UART4_TX PAL_LINE(GPIOA, 0U)
788 #define LINE_UART4_RX PAL_LINE(GPIOA, 1U)
789 #define LINE_PWM2_CH3 PAL_LINE(GPIOA, 2U)
790 #define LINE_UART2_RX PAL_LINE(GPIOA, 3U)
791 #define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U)
792 #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
793 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
794 #define LINE_SPI1_MOSI PAL_LINE(GPIOA, 7U)
795 #define LINE_CU1_CH1 PAL_LINE(GPIOA, 8U)
796 #define LINE_OTG_FS_VBUS PAL_LINE(GPIOA, 9U)
797 #define LINE_USART1_RX PAL_LINE(GPIOA, 10U)
798 #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
799 #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
800 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
801 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
802 #define LINE_PWM2_CH1 PAL_LINE(GPIOA, 15U)
803 
804 #define LINE_PWM3_CH3 PAL_LINE(GPIOB, 0U)
805 #define LINE_AUX1 PAL_LINE(GPIOB, 1U)
806 #define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
807 #define LINE_PWM2_CH2 PAL_LINE(GPIOB, 3U)
808 #define LINE_PWM3_CH1 PAL_LINE(GPIOB, 4U)
809 #define LINE_PWM3_CH2 PAL_LINE(GPIOB, 5U)
810 #define LINE_USART1_TX PAL_LINE(GPIOB, 6U)
811 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
812 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
813 #define LINE_SPI1_CS PAL_LINE(GPIOB, 9U)
814 #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
815 #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
816 #define LINE_POWER_SWITCH PAL_LINE(GPIOB, 12U)
817 #define LINE_RX2_POL PAL_LINE(GPIOB, 13U)
818 #define LINE_SDIO_DETECT PAL_LINE(GPIOB, 14U)
819 #define LINE_AUX4 PAL_LINE(GPIOB, 15U)
820 
821 #define LINE_LED1 PAL_LINE(GPIOC, 0U)
822 #define LINE_LED3 PAL_LINE(GPIOC, 1U)
823 #define LINE_LED4 PAL_LINE(GPIOC, 3U)
824 #define LINE_AUX3 PAL_LINE(GPIOC, 4U)
825 #define LINE_AUX2 PAL_LINE(GPIOC, 5U)
826 #define LINE_USART6_TX PAL_LINE(GPIOC, 6U)
827 #define LINE_USART6_RX PAL_LINE(GPIOC, 7U)
828 #define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
829 #define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
830 #define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
831 #define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
832 #define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
833 #define LINE_LED2 PAL_LINE(GPIOC, 13U)
834 #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
835 #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
836 
837 #define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
838 
839 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
840 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
841 
842 
843 /*
844  * I/O ports initial setup, this configuration is established soon after reset
845  * in the initialization code.
846  * Please refer to the STM32 Reference Manual for details.
847  */
848 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
849 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
850 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
851 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
852 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
853 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
854 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
855 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
856 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
857 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
858 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
859 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
860 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
861 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
862 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
863 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
864 
865 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(UART4_TX) | \
866  PIN_MODE_ALTERNATE(UART4_RX) | \
867  PIN_MODE_INPUT(PWM2_CH3) | \
868  PIN_MODE_ALTERNATE(UART2_RX) | \
869  PIN_MODE_ANALOG(ADC1_IN4) | \
870  PIN_MODE_ALTERNATE(SPI1_SCK) | \
871  PIN_MODE_ALTERNATE(SPI1_MISO) | \
872  PIN_MODE_ALTERNATE(SPI1_MOSI) | \
873  PIN_MODE_ALTERNATE(CU1_CH1) | \
874  PIN_MODE_INPUT(OTG_FS_VBUS) | \
875  PIN_MODE_ALTERNATE(USART1_RX) | \
876  PIN_MODE_ALTERNATE(OTG_FS_DM) | \
877  PIN_MODE_ALTERNATE(OTG_FS_DP) | \
878  PIN_MODE_ALTERNATE(SWDIO) | \
879  PIN_MODE_ALTERNATE(SWCLK) | \
880  PIN_MODE_INPUT(PWM2_CH1))
881 
882 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(UART4_TX) | \
883  PIN_OTYPE_PUSHPULL(UART4_RX) | \
884  PIN_OTYPE_OPENDRAIN(PWM2_CH3) | \
885  PIN_OTYPE_PUSHPULL(UART2_RX) | \
886  PIN_OTYPE_PUSHPULL(ADC1_IN4) | \
887  PIN_OTYPE_PUSHPULL(SPI1_SCK) | \
888  PIN_OTYPE_PUSHPULL(SPI1_MISO) | \
889  PIN_OTYPE_PUSHPULL(SPI1_MOSI) | \
890  PIN_OTYPE_PUSHPULL(CU1_CH1) | \
891  PIN_OTYPE_OPENDRAIN(OTG_FS_VBUS) | \
892  PIN_OTYPE_PUSHPULL(USART1_RX) | \
893  PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
894  PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
895  PIN_OTYPE_PUSHPULL(SWDIO) | \
896  PIN_OTYPE_PUSHPULL(SWCLK) | \
897  PIN_OTYPE_OPENDRAIN(PWM2_CH1))
898 
899 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART4_TX) | \
900  PIN_OSPEED_SPEED_HIGH(UART4_RX) | \
901  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH3) | \
902  PIN_OSPEED_SPEED_HIGH(UART2_RX) | \
903  PIN_OSPEED_SPEED_VERYLOW(ADC1_IN4) | \
904  PIN_OSPEED_SPEED_HIGH(SPI1_SCK) | \
905  PIN_OSPEED_SPEED_HIGH(SPI1_MISO) | \
906  PIN_OSPEED_SPEED_HIGH(SPI1_MOSI) | \
907  PIN_OSPEED_SPEED_HIGH(CU1_CH1) | \
908  PIN_OSPEED_SPEED_VERYLOW(OTG_FS_VBUS) | \
909  PIN_OSPEED_SPEED_HIGH(USART1_RX) | \
910  PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
911  PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
912  PIN_OSPEED_SPEED_HIGH(SWDIO) | \
913  PIN_OSPEED_SPEED_HIGH(SWCLK) | \
914  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH1))
915 
916 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(UART4_TX) | \
917  PIN_PUPDR_FLOATING(UART4_RX) | \
918  PIN_PUPDR_FLOATING(PWM2_CH3) | \
919  PIN_PUPDR_FLOATING(UART2_RX) | \
920  PIN_PUPDR_FLOATING(ADC1_IN4) | \
921  PIN_PUPDR_FLOATING(SPI1_SCK) | \
922  PIN_PUPDR_FLOATING(SPI1_MISO) | \
923  PIN_PUPDR_FLOATING(SPI1_MOSI) | \
924  PIN_PUPDR_FLOATING(CU1_CH1) | \
925  PIN_PUPDR_PULLDOWN(OTG_FS_VBUS) | \
926  PIN_PUPDR_FLOATING(USART1_RX) | \
927  PIN_PUPDR_FLOATING(OTG_FS_DM) | \
928  PIN_PUPDR_FLOATING(OTG_FS_DP) | \
929  PIN_PUPDR_FLOATING(SWDIO) | \
930  PIN_PUPDR_FLOATING(SWCLK) | \
931  PIN_PUPDR_FLOATING(PWM2_CH1))
932 
933 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_HIGH(UART4_TX) | \
934  PIN_ODR_LEVEL_HIGH(UART4_RX) | \
935  PIN_ODR_LEVEL_LOW(PWM2_CH3) | \
936  PIN_ODR_LEVEL_HIGH(UART2_RX) | \
937  PIN_ODR_LEVEL_LOW(ADC1_IN4) | \
938  PIN_ODR_LEVEL_HIGH(SPI1_SCK) | \
939  PIN_ODR_LEVEL_HIGH(SPI1_MISO) | \
940  PIN_ODR_LEVEL_HIGH(SPI1_MOSI) | \
941  PIN_ODR_LEVEL_HIGH(CU1_CH1) | \
942  PIN_ODR_LEVEL_LOW(OTG_FS_VBUS) | \
943  PIN_ODR_LEVEL_HIGH(USART1_RX) | \
944  PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
945  PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
946  PIN_ODR_LEVEL_HIGH(SWDIO) | \
947  PIN_ODR_LEVEL_HIGH(SWCLK) | \
948  PIN_ODR_LEVEL_LOW(PWM2_CH1))
949 
950 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(UART4_TX, 8) | \
951  PIN_AFIO_AF(UART4_RX, 8) | \
952  PIN_AFIO_AF(PWM2_CH3, 0) | \
953  PIN_AFIO_AF(UART2_RX, 7) | \
954  PIN_AFIO_AF(ADC1_IN4, 0) | \
955  PIN_AFIO_AF(SPI1_SCK, 5) | \
956  PIN_AFIO_AF(SPI1_MISO, 5) | \
957  PIN_AFIO_AF(SPI1_MOSI, 5))
958 
959 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(CU1_CH1, 1) | \
960  PIN_AFIO_AF(OTG_FS_VBUS, 0) | \
961  PIN_AFIO_AF(USART1_RX, 7) | \
962  PIN_AFIO_AF(OTG_FS_DM, 10) | \
963  PIN_AFIO_AF(OTG_FS_DP, 10) | \
964  PIN_AFIO_AF(SWDIO, 0) | \
965  PIN_AFIO_AF(SWCLK, 0) | \
966  PIN_AFIO_AF(PWM2_CH1, 0))
967 
968 #define VAL_GPIOB_MODER (PIN_MODE_INPUT(PWM3_CH3) | \
969  PIN_MODE_INPUT(AUX1) | \
970  PIN_MODE_INPUT(BOOT1) | \
971  PIN_MODE_INPUT(PWM2_CH2) | \
972  PIN_MODE_INPUT(PWM3_CH1) | \
973  PIN_MODE_INPUT(PWM3_CH2) | \
974  PIN_MODE_ALTERNATE(USART1_TX) | \
975  PIN_MODE_ALTERNATE(I2C1_SDA) | \
976  PIN_MODE_ALTERNATE(I2C1_SCL) | \
977  PIN_MODE_OUTPUT(SPI1_CS) | \
978  PIN_MODE_ALTERNATE(I2C2_SCL) | \
979  PIN_MODE_ALTERNATE(I2C2_SDA) | \
980  PIN_MODE_OUTPUT(POWER_SWITCH) | \
981  PIN_MODE_OUTPUT(RX2_POL) | \
982  PIN_MODE_INPUT(SDIO_DETECT) | \
983  PIN_MODE_INPUT(AUX4))
984 
985 #define VAL_GPIOB_OTYPER (PIN_OTYPE_OPENDRAIN(PWM3_CH3) | \
986  PIN_OTYPE_OPENDRAIN(AUX1) | \
987  PIN_OTYPE_OPENDRAIN(BOOT1) | \
988  PIN_OTYPE_OPENDRAIN(PWM2_CH2) | \
989  PIN_OTYPE_OPENDRAIN(PWM3_CH1) | \
990  PIN_OTYPE_OPENDRAIN(PWM3_CH2) | \
991  PIN_OTYPE_PUSHPULL(USART1_TX) | \
992  PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
993  PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
994  PIN_OTYPE_PUSHPULL(SPI1_CS) | \
995  PIN_OTYPE_OPENDRAIN(I2C2_SCL) | \
996  PIN_OTYPE_OPENDRAIN(I2C2_SDA) | \
997  PIN_OTYPE_PUSHPULL(POWER_SWITCH) | \
998  PIN_OTYPE_PUSHPULL(RX2_POL) | \
999  PIN_OTYPE_OPENDRAIN(SDIO_DETECT) | \
1000  PIN_OTYPE_OPENDRAIN(AUX4))
1001 
1002 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PWM3_CH3) | \
1003  PIN_OSPEED_SPEED_VERYLOW(AUX1) | \
1004  PIN_OSPEED_SPEED_VERYLOW(BOOT1) | \
1005  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH2) | \
1006  PIN_OSPEED_SPEED_VERYLOW(PWM3_CH1) | \
1007  PIN_OSPEED_SPEED_VERYLOW(PWM3_CH2) | \
1008  PIN_OSPEED_SPEED_HIGH(USART1_TX) | \
1009  PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
1010  PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
1011  PIN_OSPEED_SPEED_HIGH(SPI1_CS) | \
1012  PIN_OSPEED_SPEED_HIGH(I2C2_SCL) | \
1013  PIN_OSPEED_SPEED_HIGH(I2C2_SDA) | \
1014  PIN_OSPEED_SPEED_HIGH(POWER_SWITCH) | \
1015  PIN_OSPEED_SPEED_HIGH(RX2_POL) | \
1016  PIN_OSPEED_SPEED_VERYLOW(SDIO_DETECT) | \
1017  PIN_OSPEED_SPEED_VERYLOW(AUX4))
1018 
1019 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(PWM3_CH3) | \
1020  PIN_PUPDR_FLOATING(AUX1) | \
1021  PIN_PUPDR_FLOATING(BOOT1) | \
1022  PIN_PUPDR_FLOATING(PWM2_CH2) | \
1023  PIN_PUPDR_FLOATING(PWM3_CH1) | \
1024  PIN_PUPDR_FLOATING(PWM3_CH2) | \
1025  PIN_PUPDR_FLOATING(USART1_TX) | \
1026  PIN_PUPDR_PULLUP(I2C1_SDA) | \
1027  PIN_PUPDR_PULLUP(I2C1_SCL) | \
1028  PIN_PUPDR_FLOATING(SPI1_CS) | \
1029  PIN_PUPDR_PULLUP(I2C2_SCL) | \
1030  PIN_PUPDR_PULLUP(I2C2_SDA) | \
1031  PIN_PUPDR_FLOATING(POWER_SWITCH) | \
1032  PIN_PUPDR_FLOATING(RX2_POL) | \
1033  PIN_PUPDR_PULLUP(SDIO_DETECT) | \
1034  PIN_PUPDR_FLOATING(AUX4))
1035 
1036 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(PWM3_CH3) | \
1037  PIN_ODR_LEVEL_LOW(AUX1) | \
1038  PIN_ODR_LEVEL_LOW(BOOT1) | \
1039  PIN_ODR_LEVEL_LOW(PWM2_CH2) | \
1040  PIN_ODR_LEVEL_LOW(PWM3_CH1) | \
1041  PIN_ODR_LEVEL_LOW(PWM3_CH2) | \
1042  PIN_ODR_LEVEL_HIGH(USART1_TX) | \
1043  PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
1044  PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
1045  PIN_ODR_LEVEL_HIGH(SPI1_CS) | \
1046  PIN_ODR_LEVEL_HIGH(I2C2_SCL) | \
1047  PIN_ODR_LEVEL_HIGH(I2C2_SDA) | \
1048  PIN_ODR_LEVEL_HIGH(POWER_SWITCH) | \
1049  PIN_ODR_LEVEL_HIGH(RX2_POL) | \
1050  PIN_ODR_LEVEL_LOW(SDIO_DETECT) | \
1051  PIN_ODR_LEVEL_LOW(AUX4))
1052 
1053 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(PWM3_CH3, 0) | \
1054  PIN_AFIO_AF(AUX1, 0) | \
1055  PIN_AFIO_AF(BOOT1, 0) | \
1056  PIN_AFIO_AF(PWM2_CH2, 0) | \
1057  PIN_AFIO_AF(PWM3_CH1, 0) | \
1058  PIN_AFIO_AF(PWM3_CH2, 0) | \
1059  PIN_AFIO_AF(USART1_TX, 7) | \
1060  PIN_AFIO_AF(I2C1_SDA, 4))
1061 
1062 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(I2C1_SCL, 4) | \
1063  PIN_AFIO_AF(SPI1_CS, 0) | \
1064  PIN_AFIO_AF(I2C2_SCL, 4) | \
1065  PIN_AFIO_AF(I2C2_SDA, 4) | \
1066  PIN_AFIO_AF(POWER_SWITCH, 0) | \
1067  PIN_AFIO_AF(RX2_POL, 0) | \
1068  PIN_AFIO_AF(SDIO_DETECT, 0) | \
1069  PIN_AFIO_AF(AUX4, 0))
1070 
1071 #define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(LED1) | \
1072  PIN_MODE_OUTPUT(LED3) | \
1073  PIN_MODE_INPUT(PC02) | \
1074  PIN_MODE_OUTPUT(LED4) | \
1075  PIN_MODE_INPUT(AUX3) | \
1076  PIN_MODE_INPUT(AUX2) | \
1077  PIN_MODE_ALTERNATE(USART6_TX) | \
1078  PIN_MODE_ALTERNATE(USART6_RX) | \
1079  PIN_MODE_ALTERNATE(SDIO_D0) | \
1080  PIN_MODE_ALTERNATE(SDIO_D1) | \
1081  PIN_MODE_ALTERNATE(SDIO_D2) | \
1082  PIN_MODE_ALTERNATE(SDIO_D3) | \
1083  PIN_MODE_ALTERNATE(SDIO_CK) | \
1084  PIN_MODE_OUTPUT(LED2) | \
1085  PIN_MODE_ALTERNATE(OSC32_IN) | \
1086  PIN_MODE_ALTERNATE(OSC32_OUT))
1087 
1088 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(LED1) | \
1089  PIN_OTYPE_PUSHPULL(LED3) | \
1090  PIN_OTYPE_PUSHPULL(PC02) | \
1091  PIN_OTYPE_PUSHPULL(LED4) | \
1092  PIN_OTYPE_OPENDRAIN(AUX3) | \
1093  PIN_OTYPE_OPENDRAIN(AUX2) | \
1094  PIN_OTYPE_PUSHPULL(USART6_TX) | \
1095  PIN_OTYPE_PUSHPULL(USART6_RX) | \
1096  PIN_OTYPE_PUSHPULL(SDIO_D0) | \
1097  PIN_OTYPE_PUSHPULL(SDIO_D1) | \
1098  PIN_OTYPE_PUSHPULL(SDIO_D2) | \
1099  PIN_OTYPE_PUSHPULL(SDIO_D3) | \
1100  PIN_OTYPE_PUSHPULL(SDIO_CK) | \
1101  PIN_OTYPE_PUSHPULL(LED2) | \
1102  PIN_OTYPE_PUSHPULL(OSC32_IN) | \
1103  PIN_OTYPE_PUSHPULL(OSC32_OUT))
1104 
1105 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(LED1) | \
1106  PIN_OSPEED_SPEED_VERYLOW(LED3) | \
1107  PIN_OSPEED_SPEED_VERYLOW(PC02) | \
1108  PIN_OSPEED_SPEED_VERYLOW(LED4) | \
1109  PIN_OSPEED_SPEED_VERYLOW(AUX3) | \
1110  PIN_OSPEED_SPEED_VERYLOW(AUX2) | \
1111  PIN_OSPEED_SPEED_HIGH(USART6_TX) | \
1112  PIN_OSPEED_SPEED_HIGH(USART6_RX) | \
1113  PIN_OSPEED_SPEED_HIGH(SDIO_D0) | \
1114  PIN_OSPEED_SPEED_HIGH(SDIO_D1) | \
1115  PIN_OSPEED_SPEED_HIGH(SDIO_D2) | \
1116  PIN_OSPEED_SPEED_HIGH(SDIO_D3) | \
1117  PIN_OSPEED_SPEED_HIGH(SDIO_CK) | \
1118  PIN_OSPEED_SPEED_VERYLOW(LED2) | \
1119  PIN_OSPEED_SPEED_HIGH(OSC32_IN) | \
1120  PIN_OSPEED_SPEED_HIGH(OSC32_OUT))
1121 
1122 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(LED1) | \
1123  PIN_PUPDR_FLOATING(LED3) | \
1124  PIN_PUPDR_PULLDOWN(PC02) | \
1125  PIN_PUPDR_FLOATING(LED4) | \
1126  PIN_PUPDR_FLOATING(AUX3) | \
1127  PIN_PUPDR_FLOATING(AUX2) | \
1128  PIN_PUPDR_FLOATING(USART6_TX) | \
1129  PIN_PUPDR_FLOATING(USART6_RX) | \
1130  PIN_PUPDR_PULLUP(SDIO_D0) | \
1131  PIN_PUPDR_PULLUP(SDIO_D1) | \
1132  PIN_PUPDR_PULLUP(SDIO_D2) | \
1133  PIN_PUPDR_PULLUP(SDIO_D3) | \
1134  PIN_PUPDR_FLOATING(SDIO_CK) | \
1135  PIN_PUPDR_FLOATING(LED2) | \
1136  PIN_PUPDR_FLOATING(OSC32_IN) | \
1137  PIN_PUPDR_FLOATING(OSC32_OUT))
1138 
1139 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(LED1) | \
1140  PIN_ODR_LEVEL_LOW(LED3) | \
1141  PIN_ODR_LEVEL_LOW(PC02) | \
1142  PIN_ODR_LEVEL_LOW(LED4) | \
1143  PIN_ODR_LEVEL_LOW(AUX3) | \
1144  PIN_ODR_LEVEL_LOW(AUX2) | \
1145  PIN_ODR_LEVEL_HIGH(USART6_TX) | \
1146  PIN_ODR_LEVEL_HIGH(USART6_RX) | \
1147  PIN_ODR_LEVEL_HIGH(SDIO_D0) | \
1148  PIN_ODR_LEVEL_HIGH(SDIO_D1) | \
1149  PIN_ODR_LEVEL_HIGH(SDIO_D2) | \
1150  PIN_ODR_LEVEL_HIGH(SDIO_D3) | \
1151  PIN_ODR_LEVEL_HIGH(SDIO_CK) | \
1152  PIN_ODR_LEVEL_LOW(LED2) | \
1153  PIN_ODR_LEVEL_HIGH(OSC32_IN) | \
1154  PIN_ODR_LEVEL_HIGH(OSC32_OUT))
1155 
1156 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(LED1, 0) | \
1157  PIN_AFIO_AF(LED3, 0) | \
1158  PIN_AFIO_AF(PC02, 0) | \
1159  PIN_AFIO_AF(LED4, 0) | \
1160  PIN_AFIO_AF(AUX3, 0) | \
1161  PIN_AFIO_AF(AUX2, 0) | \
1162  PIN_AFIO_AF(USART6_TX, 8) | \
1163  PIN_AFIO_AF(USART6_RX, 8))
1164 
1165 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(SDIO_D0, 12) | \
1166  PIN_AFIO_AF(SDIO_D1, 12) | \
1167  PIN_AFIO_AF(SDIO_D2, 12) | \
1168  PIN_AFIO_AF(SDIO_D3, 12) | \
1169  PIN_AFIO_AF(SDIO_CK, 12) | \
1170  PIN_AFIO_AF(LED2, 0) | \
1171  PIN_AFIO_AF(OSC32_IN, 0) | \
1172  PIN_AFIO_AF(OSC32_OUT, 0))
1173 
1174 #define VAL_GPIOD_MODER (PIN_MODE_INPUT(PD00) | \
1175  PIN_MODE_INPUT(PD01) | \
1176  PIN_MODE_ALTERNATE(SDIO_CMD) | \
1177  PIN_MODE_INPUT(PD03) | \
1178  PIN_MODE_INPUT(PD04) | \
1179  PIN_MODE_INPUT(PD05) | \
1180  PIN_MODE_INPUT(PD06) | \
1181  PIN_MODE_INPUT(PD07) | \
1182  PIN_MODE_INPUT(PD08) | \
1183  PIN_MODE_INPUT(PD09) | \
1184  PIN_MODE_INPUT(PD10) | \
1185  PIN_MODE_INPUT(PD11) | \
1186  PIN_MODE_INPUT(PD12) | \
1187  PIN_MODE_INPUT(PD13) | \
1188  PIN_MODE_INPUT(PD14) | \
1189  PIN_MODE_INPUT(PD15))
1190 
1191 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00) | \
1192  PIN_OTYPE_PUSHPULL(PD01) | \
1193  PIN_OTYPE_PUSHPULL(SDIO_CMD) | \
1194  PIN_OTYPE_PUSHPULL(PD03) | \
1195  PIN_OTYPE_PUSHPULL(PD04) | \
1196  PIN_OTYPE_PUSHPULL(PD05) | \
1197  PIN_OTYPE_PUSHPULL(PD06) | \
1198  PIN_OTYPE_PUSHPULL(PD07) | \
1199  PIN_OTYPE_PUSHPULL(PD08) | \
1200  PIN_OTYPE_PUSHPULL(PD09) | \
1201  PIN_OTYPE_PUSHPULL(PD10) | \
1202  PIN_OTYPE_PUSHPULL(PD11) | \
1203  PIN_OTYPE_PUSHPULL(PD12) | \
1204  PIN_OTYPE_PUSHPULL(PD13) | \
1205  PIN_OTYPE_PUSHPULL(PD14) | \
1206  PIN_OTYPE_PUSHPULL(PD15))
1207 
1208 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PD00) | \
1209  PIN_OSPEED_SPEED_VERYLOW(PD01) | \
1210  PIN_OSPEED_SPEED_HIGH(SDIO_CMD) | \
1211  PIN_OSPEED_SPEED_VERYLOW(PD03) | \
1212  PIN_OSPEED_SPEED_VERYLOW(PD04) | \
1213  PIN_OSPEED_SPEED_VERYLOW(PD05) | \
1214  PIN_OSPEED_SPEED_VERYLOW(PD06) | \
1215  PIN_OSPEED_SPEED_VERYLOW(PD07) | \
1216  PIN_OSPEED_SPEED_VERYLOW(PD08) | \
1217  PIN_OSPEED_SPEED_VERYLOW(PD09) | \
1218  PIN_OSPEED_SPEED_VERYLOW(PD10) | \
1219  PIN_OSPEED_SPEED_VERYLOW(PD11) | \
1220  PIN_OSPEED_SPEED_VERYLOW(PD12) | \
1221  PIN_OSPEED_SPEED_VERYLOW(PD13) | \
1222  PIN_OSPEED_SPEED_VERYLOW(PD14) | \
1223  PIN_OSPEED_SPEED_VERYLOW(PD15))
1224 
1225 #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(PD00) | \
1226  PIN_PUPDR_PULLDOWN(PD01) | \
1227  PIN_PUPDR_PULLUP(SDIO_CMD) | \
1228  PIN_PUPDR_PULLDOWN(PD03) | \
1229  PIN_PUPDR_PULLDOWN(PD04) | \
1230  PIN_PUPDR_PULLDOWN(PD05) | \
1231  PIN_PUPDR_PULLDOWN(PD06) | \
1232  PIN_PUPDR_PULLDOWN(PD07) | \
1233  PIN_PUPDR_PULLDOWN(PD08) | \
1234  PIN_PUPDR_PULLDOWN(PD09) | \
1235  PIN_PUPDR_PULLDOWN(PD10) | \
1236  PIN_PUPDR_PULLDOWN(PD11) | \
1237  PIN_PUPDR_PULLDOWN(PD12) | \
1238  PIN_PUPDR_PULLDOWN(PD13) | \
1239  PIN_PUPDR_PULLDOWN(PD14) | \
1240  PIN_PUPDR_PULLDOWN(PD15))
1241 
1242 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_LOW(PD00) | \
1243  PIN_ODR_LEVEL_LOW(PD01) | \
1244  PIN_ODR_LEVEL_HIGH(SDIO_CMD) | \
1245  PIN_ODR_LEVEL_LOW(PD03) | \
1246  PIN_ODR_LEVEL_LOW(PD04) | \
1247  PIN_ODR_LEVEL_LOW(PD05) | \
1248  PIN_ODR_LEVEL_LOW(PD06) | \
1249  PIN_ODR_LEVEL_LOW(PD07) | \
1250  PIN_ODR_LEVEL_LOW(PD08) | \
1251  PIN_ODR_LEVEL_LOW(PD09) | \
1252  PIN_ODR_LEVEL_LOW(PD10) | \
1253  PIN_ODR_LEVEL_LOW(PD11) | \
1254  PIN_ODR_LEVEL_LOW(PD12) | \
1255  PIN_ODR_LEVEL_LOW(PD13) | \
1256  PIN_ODR_LEVEL_LOW(PD14) | \
1257  PIN_ODR_LEVEL_LOW(PD15))
1258 
1259 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00, 0) | \
1260  PIN_AFIO_AF(PD01, 0) | \
1261  PIN_AFIO_AF(SDIO_CMD, 12) | \
1262  PIN_AFIO_AF(PD03, 0) | \
1263  PIN_AFIO_AF(PD04, 0) | \
1264  PIN_AFIO_AF(PD05, 0) | \
1265  PIN_AFIO_AF(PD06, 0) | \
1266  PIN_AFIO_AF(PD07, 0))
1267 
1268 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08, 0) | \
1269  PIN_AFIO_AF(PD09, 0) | \
1270  PIN_AFIO_AF(PD10, 0) | \
1271  PIN_AFIO_AF(PD11, 0) | \
1272  PIN_AFIO_AF(PD12, 0) | \
1273  PIN_AFIO_AF(PD13, 0) | \
1274  PIN_AFIO_AF(PD14, 0) | \
1275  PIN_AFIO_AF(PD15, 0))
1276 
1277 #define VAL_GPIOE_MODER (PIN_MODE_INPUT(PE00) | \
1278  PIN_MODE_INPUT(PE01) | \
1279  PIN_MODE_INPUT(PE02) | \
1280  PIN_MODE_INPUT(PE03) | \
1281  PIN_MODE_INPUT(PE04) | \
1282  PIN_MODE_INPUT(PE05) | \
1283  PIN_MODE_INPUT(PE06) | \
1284  PIN_MODE_INPUT(PE07) | \
1285  PIN_MODE_INPUT(PE08) | \
1286  PIN_MODE_INPUT(PE09) | \
1287  PIN_MODE_INPUT(PE10) | \
1288  PIN_MODE_INPUT(PE11) | \
1289  PIN_MODE_INPUT(PE12) | \
1290  PIN_MODE_INPUT(PE13) | \
1291  PIN_MODE_INPUT(PE14) | \
1292  PIN_MODE_INPUT(PE15))
1293 
1294 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00) | \
1295  PIN_OTYPE_PUSHPULL(PE01) | \
1296  PIN_OTYPE_PUSHPULL(PE02) | \
1297  PIN_OTYPE_PUSHPULL(PE03) | \
1298  PIN_OTYPE_PUSHPULL(PE04) | \
1299  PIN_OTYPE_PUSHPULL(PE05) | \
1300  PIN_OTYPE_PUSHPULL(PE06) | \
1301  PIN_OTYPE_PUSHPULL(PE07) | \
1302  PIN_OTYPE_PUSHPULL(PE08) | \
1303  PIN_OTYPE_PUSHPULL(PE09) | \
1304  PIN_OTYPE_PUSHPULL(PE10) | \
1305  PIN_OTYPE_PUSHPULL(PE11) | \
1306  PIN_OTYPE_PUSHPULL(PE12) | \
1307  PIN_OTYPE_PUSHPULL(PE13) | \
1308  PIN_OTYPE_PUSHPULL(PE14) | \
1309  PIN_OTYPE_PUSHPULL(PE15))
1310 
1311 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PE00) | \
1312  PIN_OSPEED_SPEED_VERYLOW(PE01) | \
1313  PIN_OSPEED_SPEED_VERYLOW(PE02) | \
1314  PIN_OSPEED_SPEED_VERYLOW(PE03) | \
1315  PIN_OSPEED_SPEED_VERYLOW(PE04) | \
1316  PIN_OSPEED_SPEED_VERYLOW(PE05) | \
1317  PIN_OSPEED_SPEED_VERYLOW(PE06) | \
1318  PIN_OSPEED_SPEED_VERYLOW(PE07) | \
1319  PIN_OSPEED_SPEED_VERYLOW(PE08) | \
1320  PIN_OSPEED_SPEED_VERYLOW(PE09) | \
1321  PIN_OSPEED_SPEED_VERYLOW(PE10) | \
1322  PIN_OSPEED_SPEED_VERYLOW(PE11) | \
1323  PIN_OSPEED_SPEED_VERYLOW(PE12) | \
1324  PIN_OSPEED_SPEED_VERYLOW(PE13) | \
1325  PIN_OSPEED_SPEED_VERYLOW(PE14) | \
1326  PIN_OSPEED_SPEED_VERYLOW(PE15))
1327 
1328 #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLDOWN(PE00) | \
1329  PIN_PUPDR_PULLDOWN(PE01) | \
1330  PIN_PUPDR_PULLDOWN(PE02) | \
1331  PIN_PUPDR_PULLDOWN(PE03) | \
1332  PIN_PUPDR_PULLDOWN(PE04) | \
1333  PIN_PUPDR_PULLDOWN(PE05) | \
1334  PIN_PUPDR_PULLDOWN(PE06) | \
1335  PIN_PUPDR_PULLDOWN(PE07) | \
1336  PIN_PUPDR_PULLDOWN(PE08) | \
1337  PIN_PUPDR_PULLDOWN(PE09) | \
1338  PIN_PUPDR_PULLDOWN(PE10) | \
1339  PIN_PUPDR_PULLDOWN(PE11) | \
1340  PIN_PUPDR_PULLDOWN(PE12) | \
1341  PIN_PUPDR_PULLDOWN(PE13) | \
1342  PIN_PUPDR_PULLDOWN(PE14) | \
1343  PIN_PUPDR_PULLDOWN(PE15))
1344 
1345 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_LOW(PE00) | \
1346  PIN_ODR_LEVEL_LOW(PE01) | \
1347  PIN_ODR_LEVEL_LOW(PE02) | \
1348  PIN_ODR_LEVEL_LOW(PE03) | \
1349  PIN_ODR_LEVEL_LOW(PE04) | \
1350  PIN_ODR_LEVEL_LOW(PE05) | \
1351  PIN_ODR_LEVEL_LOW(PE06) | \
1352  PIN_ODR_LEVEL_LOW(PE07) | \
1353  PIN_ODR_LEVEL_LOW(PE08) | \
1354  PIN_ODR_LEVEL_LOW(PE09) | \
1355  PIN_ODR_LEVEL_LOW(PE10) | \
1356  PIN_ODR_LEVEL_LOW(PE11) | \
1357  PIN_ODR_LEVEL_LOW(PE12) | \
1358  PIN_ODR_LEVEL_LOW(PE13) | \
1359  PIN_ODR_LEVEL_LOW(PE14) | \
1360  PIN_ODR_LEVEL_LOW(PE15))
1361 
1362 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00, 0) | \
1363  PIN_AFIO_AF(PE01, 0) | \
1364  PIN_AFIO_AF(PE02, 0) | \
1365  PIN_AFIO_AF(PE03, 0) | \
1366  PIN_AFIO_AF(PE04, 0) | \
1367  PIN_AFIO_AF(PE05, 0) | \
1368  PIN_AFIO_AF(PE06, 0) | \
1369  PIN_AFIO_AF(PE07, 0))
1370 
1371 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(PE08, 0) | \
1372  PIN_AFIO_AF(PE09, 0) | \
1373  PIN_AFIO_AF(PE10, 0) | \
1374  PIN_AFIO_AF(PE11, 0) | \
1375  PIN_AFIO_AF(PE12, 0) | \
1376  PIN_AFIO_AF(PE13, 0) | \
1377  PIN_AFIO_AF(PE14, 0) | \
1378  PIN_AFIO_AF(PE15, 0))
1379 
1380 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
1381  PIN_MODE_INPUT(PF01) | \
1382  PIN_MODE_INPUT(PF02) | \
1383  PIN_MODE_INPUT(PF03) | \
1384  PIN_MODE_INPUT(PF04) | \
1385  PIN_MODE_INPUT(PF05) | \
1386  PIN_MODE_INPUT(PF06) | \
1387  PIN_MODE_INPUT(PF07) | \
1388  PIN_MODE_INPUT(PF08) | \
1389  PIN_MODE_INPUT(PF09) | \
1390  PIN_MODE_INPUT(PF10) | \
1391  PIN_MODE_INPUT(PF11) | \
1392  PIN_MODE_INPUT(PF12) | \
1393  PIN_MODE_INPUT(PF13) | \
1394  PIN_MODE_INPUT(PF14) | \
1395  PIN_MODE_INPUT(PF15))
1396 
1397 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
1398  PIN_OTYPE_PUSHPULL(PF01) | \
1399  PIN_OTYPE_PUSHPULL(PF02) | \
1400  PIN_OTYPE_PUSHPULL(PF03) | \
1401  PIN_OTYPE_PUSHPULL(PF04) | \
1402  PIN_OTYPE_PUSHPULL(PF05) | \
1403  PIN_OTYPE_PUSHPULL(PF06) | \
1404  PIN_OTYPE_PUSHPULL(PF07) | \
1405  PIN_OTYPE_PUSHPULL(PF08) | \
1406  PIN_OTYPE_PUSHPULL(PF09) | \
1407  PIN_OTYPE_PUSHPULL(PF10) | \
1408  PIN_OTYPE_PUSHPULL(PF11) | \
1409  PIN_OTYPE_PUSHPULL(PF12) | \
1410  PIN_OTYPE_PUSHPULL(PF13) | \
1411  PIN_OTYPE_PUSHPULL(PF14) | \
1412  PIN_OTYPE_PUSHPULL(PF15))
1413 
1414 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
1415  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
1416  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
1417  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
1418  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
1419  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
1420  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
1421  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
1422  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
1423  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
1424  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
1425  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
1426  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
1427  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
1428  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
1429  PIN_OSPEED_SPEED_VERYLOW(PF15))
1430 
1431 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
1432  PIN_PUPDR_PULLDOWN(PF01) | \
1433  PIN_PUPDR_PULLDOWN(PF02) | \
1434  PIN_PUPDR_PULLDOWN(PF03) | \
1435  PIN_PUPDR_PULLDOWN(PF04) | \
1436  PIN_PUPDR_PULLDOWN(PF05) | \
1437  PIN_PUPDR_PULLDOWN(PF06) | \
1438  PIN_PUPDR_PULLDOWN(PF07) | \
1439  PIN_PUPDR_PULLDOWN(PF08) | \
1440  PIN_PUPDR_PULLDOWN(PF09) | \
1441  PIN_PUPDR_PULLDOWN(PF10) | \
1442  PIN_PUPDR_PULLDOWN(PF11) | \
1443  PIN_PUPDR_PULLDOWN(PF12) | \
1444  PIN_PUPDR_PULLDOWN(PF13) | \
1445  PIN_PUPDR_PULLDOWN(PF14) | \
1446  PIN_PUPDR_PULLDOWN(PF15))
1447 
1448 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
1449  PIN_ODR_LEVEL_LOW(PF01) | \
1450  PIN_ODR_LEVEL_LOW(PF02) | \
1451  PIN_ODR_LEVEL_LOW(PF03) | \
1452  PIN_ODR_LEVEL_LOW(PF04) | \
1453  PIN_ODR_LEVEL_LOW(PF05) | \
1454  PIN_ODR_LEVEL_LOW(PF06) | \
1455  PIN_ODR_LEVEL_LOW(PF07) | \
1456  PIN_ODR_LEVEL_LOW(PF08) | \
1457  PIN_ODR_LEVEL_LOW(PF09) | \
1458  PIN_ODR_LEVEL_LOW(PF10) | \
1459  PIN_ODR_LEVEL_LOW(PF11) | \
1460  PIN_ODR_LEVEL_LOW(PF12) | \
1461  PIN_ODR_LEVEL_LOW(PF13) | \
1462  PIN_ODR_LEVEL_LOW(PF14) | \
1463  PIN_ODR_LEVEL_LOW(PF15))
1464 
1465 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
1466  PIN_AFIO_AF(PF01, 0) | \
1467  PIN_AFIO_AF(PF02, 0) | \
1468  PIN_AFIO_AF(PF03, 0) | \
1469  PIN_AFIO_AF(PF04, 0) | \
1470  PIN_AFIO_AF(PF05, 0) | \
1471  PIN_AFIO_AF(PF06, 0) | \
1472  PIN_AFIO_AF(PF07, 0))
1473 
1474 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
1475  PIN_AFIO_AF(PF09, 0) | \
1476  PIN_AFIO_AF(PF10, 0) | \
1477  PIN_AFIO_AF(PF11, 0) | \
1478  PIN_AFIO_AF(PF12, 0) | \
1479  PIN_AFIO_AF(PF13, 0) | \
1480  PIN_AFIO_AF(PF14, 0) | \
1481  PIN_AFIO_AF(PF15, 0))
1482 
1483 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
1484  PIN_MODE_INPUT(PG01) | \
1485  PIN_MODE_INPUT(PG02) | \
1486  PIN_MODE_INPUT(PG03) | \
1487  PIN_MODE_INPUT(PG04) | \
1488  PIN_MODE_INPUT(PG05) | \
1489  PIN_MODE_INPUT(PG06) | \
1490  PIN_MODE_INPUT(PG07) | \
1491  PIN_MODE_INPUT(PG08) | \
1492  PIN_MODE_INPUT(PG09) | \
1493  PIN_MODE_INPUT(PG10) | \
1494  PIN_MODE_INPUT(PG11) | \
1495  PIN_MODE_INPUT(PG12) | \
1496  PIN_MODE_INPUT(PG13) | \
1497  PIN_MODE_INPUT(PG14) | \
1498  PIN_MODE_INPUT(PG15))
1499 
1500 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
1501  PIN_OTYPE_PUSHPULL(PG01) | \
1502  PIN_OTYPE_PUSHPULL(PG02) | \
1503  PIN_OTYPE_PUSHPULL(PG03) | \
1504  PIN_OTYPE_PUSHPULL(PG04) | \
1505  PIN_OTYPE_PUSHPULL(PG05) | \
1506  PIN_OTYPE_PUSHPULL(PG06) | \
1507  PIN_OTYPE_PUSHPULL(PG07) | \
1508  PIN_OTYPE_PUSHPULL(PG08) | \
1509  PIN_OTYPE_PUSHPULL(PG09) | \
1510  PIN_OTYPE_PUSHPULL(PG10) | \
1511  PIN_OTYPE_PUSHPULL(PG11) | \
1512  PIN_OTYPE_PUSHPULL(PG12) | \
1513  PIN_OTYPE_PUSHPULL(PG13) | \
1514  PIN_OTYPE_PUSHPULL(PG14) | \
1515  PIN_OTYPE_PUSHPULL(PG15))
1516 
1517 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
1518  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
1519  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
1520  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
1521  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
1522  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1523  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1524  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1525  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1526  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1527  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1528  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1529  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1530  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1531  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1532  PIN_OSPEED_SPEED_VERYLOW(PG15))
1533 
1534 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1535  PIN_PUPDR_PULLDOWN(PG01) | \
1536  PIN_PUPDR_PULLDOWN(PG02) | \
1537  PIN_PUPDR_PULLDOWN(PG03) | \
1538  PIN_PUPDR_PULLDOWN(PG04) | \
1539  PIN_PUPDR_PULLDOWN(PG05) | \
1540  PIN_PUPDR_PULLDOWN(PG06) | \
1541  PIN_PUPDR_PULLDOWN(PG07) | \
1542  PIN_PUPDR_PULLDOWN(PG08) | \
1543  PIN_PUPDR_PULLDOWN(PG09) | \
1544  PIN_PUPDR_PULLDOWN(PG10) | \
1545  PIN_PUPDR_PULLDOWN(PG11) | \
1546  PIN_PUPDR_PULLDOWN(PG12) | \
1547  PIN_PUPDR_PULLDOWN(PG13) | \
1548  PIN_PUPDR_PULLDOWN(PG14) | \
1549  PIN_PUPDR_PULLDOWN(PG15))
1550 
1551 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1552  PIN_ODR_LEVEL_LOW(PG01) | \
1553  PIN_ODR_LEVEL_LOW(PG02) | \
1554  PIN_ODR_LEVEL_LOW(PG03) | \
1555  PIN_ODR_LEVEL_LOW(PG04) | \
1556  PIN_ODR_LEVEL_LOW(PG05) | \
1557  PIN_ODR_LEVEL_LOW(PG06) | \
1558  PIN_ODR_LEVEL_LOW(PG07) | \
1559  PIN_ODR_LEVEL_LOW(PG08) | \
1560  PIN_ODR_LEVEL_LOW(PG09) | \
1561  PIN_ODR_LEVEL_LOW(PG10) | \
1562  PIN_ODR_LEVEL_LOW(PG11) | \
1563  PIN_ODR_LEVEL_LOW(PG12) | \
1564  PIN_ODR_LEVEL_LOW(PG13) | \
1565  PIN_ODR_LEVEL_LOW(PG14) | \
1566  PIN_ODR_LEVEL_LOW(PG15))
1567 
1568 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1569  PIN_AFIO_AF(PG01, 0) | \
1570  PIN_AFIO_AF(PG02, 0) | \
1571  PIN_AFIO_AF(PG03, 0) | \
1572  PIN_AFIO_AF(PG04, 0) | \
1573  PIN_AFIO_AF(PG05, 0) | \
1574  PIN_AFIO_AF(PG06, 0) | \
1575  PIN_AFIO_AF(PG07, 0))
1576 
1577 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1578  PIN_AFIO_AF(PG09, 0) | \
1579  PIN_AFIO_AF(PG10, 0) | \
1580  PIN_AFIO_AF(PG11, 0) | \
1581  PIN_AFIO_AF(PG12, 0) | \
1582  PIN_AFIO_AF(PG13, 0) | \
1583  PIN_AFIO_AF(PG14, 0) | \
1584  PIN_AFIO_AF(PG15, 0))
1585 
1586 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1587  PIN_MODE_ALTERNATE(OSC_OUT) | \
1588  PIN_MODE_INPUT(PH02) | \
1589  PIN_MODE_INPUT(PH03) | \
1590  PIN_MODE_INPUT(PH04) | \
1591  PIN_MODE_INPUT(PH05) | \
1592  PIN_MODE_INPUT(PH06) | \
1593  PIN_MODE_INPUT(PH07) | \
1594  PIN_MODE_INPUT(PH08) | \
1595  PIN_MODE_INPUT(PH09) | \
1596  PIN_MODE_INPUT(PH10) | \
1597  PIN_MODE_INPUT(PH11) | \
1598  PIN_MODE_INPUT(PH12) | \
1599  PIN_MODE_INPUT(PH13) | \
1600  PIN_MODE_INPUT(PH14) | \
1601  PIN_MODE_INPUT(PH15))
1602 
1603 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1604  PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1605  PIN_OTYPE_PUSHPULL(PH02) | \
1606  PIN_OTYPE_PUSHPULL(PH03) | \
1607  PIN_OTYPE_PUSHPULL(PH04) | \
1608  PIN_OTYPE_PUSHPULL(PH05) | \
1609  PIN_OTYPE_PUSHPULL(PH06) | \
1610  PIN_OTYPE_PUSHPULL(PH07) | \
1611  PIN_OTYPE_PUSHPULL(PH08) | \
1612  PIN_OTYPE_PUSHPULL(PH09) | \
1613  PIN_OTYPE_PUSHPULL(PH10) | \
1614  PIN_OTYPE_PUSHPULL(PH11) | \
1615  PIN_OTYPE_PUSHPULL(PH12) | \
1616  PIN_OTYPE_PUSHPULL(PH13) | \
1617  PIN_OTYPE_PUSHPULL(PH14) | \
1618  PIN_OTYPE_PUSHPULL(PH15))
1619 
1620 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1621  PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1622  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1623  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1624  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1625  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1626  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1627  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1628  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1629  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1630  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1631  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1632  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1633  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1634  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1635  PIN_OSPEED_SPEED_VERYLOW(PH15))
1636 
1637 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1638  PIN_PUPDR_FLOATING(OSC_OUT) | \
1639  PIN_PUPDR_PULLDOWN(PH02) | \
1640  PIN_PUPDR_PULLDOWN(PH03) | \
1641  PIN_PUPDR_PULLDOWN(PH04) | \
1642  PIN_PUPDR_PULLDOWN(PH05) | \
1643  PIN_PUPDR_PULLDOWN(PH06) | \
1644  PIN_PUPDR_PULLDOWN(PH07) | \
1645  PIN_PUPDR_PULLDOWN(PH08) | \
1646  PIN_PUPDR_PULLDOWN(PH09) | \
1647  PIN_PUPDR_PULLDOWN(PH10) | \
1648  PIN_PUPDR_PULLDOWN(PH11) | \
1649  PIN_PUPDR_PULLDOWN(PH12) | \
1650  PIN_PUPDR_PULLDOWN(PH13) | \
1651  PIN_PUPDR_PULLDOWN(PH14) | \
1652  PIN_PUPDR_PULLDOWN(PH15))
1653 
1654 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1655  PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1656  PIN_ODR_LEVEL_LOW(PH02) | \
1657  PIN_ODR_LEVEL_LOW(PH03) | \
1658  PIN_ODR_LEVEL_LOW(PH04) | \
1659  PIN_ODR_LEVEL_LOW(PH05) | \
1660  PIN_ODR_LEVEL_LOW(PH06) | \
1661  PIN_ODR_LEVEL_LOW(PH07) | \
1662  PIN_ODR_LEVEL_LOW(PH08) | \
1663  PIN_ODR_LEVEL_LOW(PH09) | \
1664  PIN_ODR_LEVEL_LOW(PH10) | \
1665  PIN_ODR_LEVEL_LOW(PH11) | \
1666  PIN_ODR_LEVEL_LOW(PH12) | \
1667  PIN_ODR_LEVEL_LOW(PH13) | \
1668  PIN_ODR_LEVEL_LOW(PH14) | \
1669  PIN_ODR_LEVEL_LOW(PH15))
1670 
1671 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1672  PIN_AFIO_AF(OSC_OUT, 0) | \
1673  PIN_AFIO_AF(PH02, 0) | \
1674  PIN_AFIO_AF(PH03, 0) | \
1675  PIN_AFIO_AF(PH04, 0) | \
1676  PIN_AFIO_AF(PH05, 0) | \
1677  PIN_AFIO_AF(PH06, 0) | \
1678  PIN_AFIO_AF(PH07, 0))
1679 
1680 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1681  PIN_AFIO_AF(PH09, 0) | \
1682  PIN_AFIO_AF(PH10, 0) | \
1683  PIN_AFIO_AF(PH11, 0) | \
1684  PIN_AFIO_AF(PH12, 0) | \
1685  PIN_AFIO_AF(PH13, 0) | \
1686  PIN_AFIO_AF(PH14, 0) | \
1687  PIN_AFIO_AF(PH15, 0))
1688 
1689 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1690  PIN_MODE_INPUT(PI01) | \
1691  PIN_MODE_INPUT(PI02) | \
1692  PIN_MODE_INPUT(PI03) | \
1693  PIN_MODE_INPUT(PI04) | \
1694  PIN_MODE_INPUT(PI05) | \
1695  PIN_MODE_INPUT(PI06) | \
1696  PIN_MODE_INPUT(PI07) | \
1697  PIN_MODE_INPUT(PI08) | \
1698  PIN_MODE_INPUT(PI09) | \
1699  PIN_MODE_INPUT(PI10) | \
1700  PIN_MODE_INPUT(PI11) | \
1701  PIN_MODE_INPUT(PI12) | \
1702  PIN_MODE_INPUT(PI13) | \
1703  PIN_MODE_INPUT(PI14) | \
1704  PIN_MODE_INPUT(PI15))
1705 
1706 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1707  PIN_OTYPE_PUSHPULL(PI01) | \
1708  PIN_OTYPE_PUSHPULL(PI02) | \
1709  PIN_OTYPE_PUSHPULL(PI03) | \
1710  PIN_OTYPE_PUSHPULL(PI04) | \
1711  PIN_OTYPE_PUSHPULL(PI05) | \
1712  PIN_OTYPE_PUSHPULL(PI06) | \
1713  PIN_OTYPE_PUSHPULL(PI07) | \
1714  PIN_OTYPE_PUSHPULL(PI08) | \
1715  PIN_OTYPE_PUSHPULL(PI09) | \
1716  PIN_OTYPE_PUSHPULL(PI10) | \
1717  PIN_OTYPE_PUSHPULL(PI11) | \
1718  PIN_OTYPE_PUSHPULL(PI12) | \
1719  PIN_OTYPE_PUSHPULL(PI13) | \
1720  PIN_OTYPE_PUSHPULL(PI14) | \
1721  PIN_OTYPE_PUSHPULL(PI15))
1722 
1723 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1724  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1725  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1726  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1727  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1728  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1729  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1730  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1731  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1732  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1733  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1734  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1735  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1736  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1737  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1738  PIN_OSPEED_SPEED_VERYLOW(PI15))
1739 
1740 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1741  PIN_PUPDR_PULLDOWN(PI01) | \
1742  PIN_PUPDR_PULLDOWN(PI02) | \
1743  PIN_PUPDR_PULLDOWN(PI03) | \
1744  PIN_PUPDR_PULLDOWN(PI04) | \
1745  PIN_PUPDR_PULLDOWN(PI05) | \
1746  PIN_PUPDR_PULLDOWN(PI06) | \
1747  PIN_PUPDR_PULLDOWN(PI07) | \
1748  PIN_PUPDR_PULLDOWN(PI08) | \
1749  PIN_PUPDR_PULLDOWN(PI09) | \
1750  PIN_PUPDR_PULLDOWN(PI10) | \
1751  PIN_PUPDR_PULLDOWN(PI11) | \
1752  PIN_PUPDR_PULLDOWN(PI12) | \
1753  PIN_PUPDR_PULLDOWN(PI13) | \
1754  PIN_PUPDR_PULLDOWN(PI14) | \
1755  PIN_PUPDR_PULLDOWN(PI15))
1756 
1757 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1758  PIN_ODR_LEVEL_LOW(PI01) | \
1759  PIN_ODR_LEVEL_LOW(PI02) | \
1760  PIN_ODR_LEVEL_LOW(PI03) | \
1761  PIN_ODR_LEVEL_LOW(PI04) | \
1762  PIN_ODR_LEVEL_LOW(PI05) | \
1763  PIN_ODR_LEVEL_LOW(PI06) | \
1764  PIN_ODR_LEVEL_LOW(PI07) | \
1765  PIN_ODR_LEVEL_LOW(PI08) | \
1766  PIN_ODR_LEVEL_LOW(PI09) | \
1767  PIN_ODR_LEVEL_LOW(PI10) | \
1768  PIN_ODR_LEVEL_LOW(PI11) | \
1769  PIN_ODR_LEVEL_LOW(PI12) | \
1770  PIN_ODR_LEVEL_LOW(PI13) | \
1771  PIN_ODR_LEVEL_LOW(PI14) | \
1772  PIN_ODR_LEVEL_LOW(PI15))
1773 
1774 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1775  PIN_AFIO_AF(PI01, 0) | \
1776  PIN_AFIO_AF(PI02, 0) | \
1777  PIN_AFIO_AF(PI03, 0) | \
1778  PIN_AFIO_AF(PI04, 0) | \
1779  PIN_AFIO_AF(PI05, 0) | \
1780  PIN_AFIO_AF(PI06, 0) | \
1781  PIN_AFIO_AF(PI07, 0))
1782 
1783 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1784  PIN_AFIO_AF(PI09, 0) | \
1785  PIN_AFIO_AF(PI10, 0) | \
1786  PIN_AFIO_AF(PI11, 0) | \
1787  PIN_AFIO_AF(PI12, 0) | \
1788  PIN_AFIO_AF(PI13, 0) | \
1789  PIN_AFIO_AF(PI14, 0) | \
1790  PIN_AFIO_AF(PI15, 0))
1791 
1792 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1793  PIN_MODE_INPUT(PJ01) | \
1794  PIN_MODE_INPUT(PJ02) | \
1795  PIN_MODE_INPUT(PJ03) | \
1796  PIN_MODE_INPUT(PJ04) | \
1797  PIN_MODE_INPUT(PJ05) | \
1798  PIN_MODE_INPUT(PJ06) | \
1799  PIN_MODE_INPUT(PJ07) | \
1800  PIN_MODE_INPUT(PJ08) | \
1801  PIN_MODE_INPUT(PJ09) | \
1802  PIN_MODE_INPUT(PJ10) | \
1803  PIN_MODE_INPUT(PJ11) | \
1804  PIN_MODE_INPUT(PJ12) | \
1805  PIN_MODE_INPUT(PJ13) | \
1806  PIN_MODE_INPUT(PJ14) | \
1807  PIN_MODE_INPUT(PJ15))
1808 
1809 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1810  PIN_OTYPE_PUSHPULL(PJ01) | \
1811  PIN_OTYPE_PUSHPULL(PJ02) | \
1812  PIN_OTYPE_PUSHPULL(PJ03) | \
1813  PIN_OTYPE_PUSHPULL(PJ04) | \
1814  PIN_OTYPE_PUSHPULL(PJ05) | \
1815  PIN_OTYPE_PUSHPULL(PJ06) | \
1816  PIN_OTYPE_PUSHPULL(PJ07) | \
1817  PIN_OTYPE_PUSHPULL(PJ08) | \
1818  PIN_OTYPE_PUSHPULL(PJ09) | \
1819  PIN_OTYPE_PUSHPULL(PJ10) | \
1820  PIN_OTYPE_PUSHPULL(PJ11) | \
1821  PIN_OTYPE_PUSHPULL(PJ12) | \
1822  PIN_OTYPE_PUSHPULL(PJ13) | \
1823  PIN_OTYPE_PUSHPULL(PJ14) | \
1824  PIN_OTYPE_PUSHPULL(PJ15))
1825 
1826 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1827  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1828  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1829  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1830  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1831  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1832  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1833  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1834  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1835  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1836  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1837  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1838  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1839  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1840  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1841  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1842 
1843 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1844  PIN_PUPDR_PULLDOWN(PJ01) | \
1845  PIN_PUPDR_PULLDOWN(PJ02) | \
1846  PIN_PUPDR_PULLDOWN(PJ03) | \
1847  PIN_PUPDR_PULLDOWN(PJ04) | \
1848  PIN_PUPDR_PULLDOWN(PJ05) | \
1849  PIN_PUPDR_PULLDOWN(PJ06) | \
1850  PIN_PUPDR_PULLDOWN(PJ07) | \
1851  PIN_PUPDR_PULLDOWN(PJ08) | \
1852  PIN_PUPDR_PULLDOWN(PJ09) | \
1853  PIN_PUPDR_PULLDOWN(PJ10) | \
1854  PIN_PUPDR_PULLDOWN(PJ11) | \
1855  PIN_PUPDR_PULLDOWN(PJ12) | \
1856  PIN_PUPDR_PULLDOWN(PJ13) | \
1857  PIN_PUPDR_PULLDOWN(PJ14) | \
1858  PIN_PUPDR_PULLDOWN(PJ15))
1859 
1860 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1861  PIN_ODR_LEVEL_LOW(PJ01) | \
1862  PIN_ODR_LEVEL_LOW(PJ02) | \
1863  PIN_ODR_LEVEL_LOW(PJ03) | \
1864  PIN_ODR_LEVEL_LOW(PJ04) | \
1865  PIN_ODR_LEVEL_LOW(PJ05) | \
1866  PIN_ODR_LEVEL_LOW(PJ06) | \
1867  PIN_ODR_LEVEL_LOW(PJ07) | \
1868  PIN_ODR_LEVEL_LOW(PJ08) | \
1869  PIN_ODR_LEVEL_LOW(PJ09) | \
1870  PIN_ODR_LEVEL_LOW(PJ10) | \
1871  PIN_ODR_LEVEL_LOW(PJ11) | \
1872  PIN_ODR_LEVEL_LOW(PJ12) | \
1873  PIN_ODR_LEVEL_LOW(PJ13) | \
1874  PIN_ODR_LEVEL_LOW(PJ14) | \
1875  PIN_ODR_LEVEL_LOW(PJ15))
1876 
1877 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1878  PIN_AFIO_AF(PJ01, 0) | \
1879  PIN_AFIO_AF(PJ02, 0) | \
1880  PIN_AFIO_AF(PJ03, 0) | \
1881  PIN_AFIO_AF(PJ04, 0) | \
1882  PIN_AFIO_AF(PJ05, 0) | \
1883  PIN_AFIO_AF(PJ06, 0) | \
1884  PIN_AFIO_AF(PJ07, 0))
1885 
1886 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1887  PIN_AFIO_AF(PJ09, 0) | \
1888  PIN_AFIO_AF(PJ10, 0) | \
1889  PIN_AFIO_AF(PJ11, 0) | \
1890  PIN_AFIO_AF(PJ12, 0) | \
1891  PIN_AFIO_AF(PJ13, 0) | \
1892  PIN_AFIO_AF(PJ14, 0) | \
1893  PIN_AFIO_AF(PJ15, 0))
1894 
1895 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1896  PIN_MODE_INPUT(PK01) | \
1897  PIN_MODE_INPUT(PK02) | \
1898  PIN_MODE_INPUT(PK03) | \
1899  PIN_MODE_INPUT(PK04) | \
1900  PIN_MODE_INPUT(PK05) | \
1901  PIN_MODE_INPUT(PK06) | \
1902  PIN_MODE_INPUT(PK07) | \
1903  PIN_MODE_INPUT(PK08) | \
1904  PIN_MODE_INPUT(PK09) | \
1905  PIN_MODE_INPUT(PK10) | \
1906  PIN_MODE_INPUT(PK11) | \
1907  PIN_MODE_INPUT(PK12) | \
1908  PIN_MODE_INPUT(PK13) | \
1909  PIN_MODE_INPUT(PK14) | \
1910  PIN_MODE_INPUT(PK15))
1911 
1912 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1913  PIN_OTYPE_PUSHPULL(PK01) | \
1914  PIN_OTYPE_PUSHPULL(PK02) | \
1915  PIN_OTYPE_PUSHPULL(PK03) | \
1916  PIN_OTYPE_PUSHPULL(PK04) | \
1917  PIN_OTYPE_PUSHPULL(PK05) | \
1918  PIN_OTYPE_PUSHPULL(PK06) | \
1919  PIN_OTYPE_PUSHPULL(PK07) | \
1920  PIN_OTYPE_PUSHPULL(PK08) | \
1921  PIN_OTYPE_PUSHPULL(PK09) | \
1922  PIN_OTYPE_PUSHPULL(PK10) | \
1923  PIN_OTYPE_PUSHPULL(PK11) | \
1924  PIN_OTYPE_PUSHPULL(PK12) | \
1925  PIN_OTYPE_PUSHPULL(PK13) | \
1926  PIN_OTYPE_PUSHPULL(PK14) | \
1927  PIN_OTYPE_PUSHPULL(PK15))
1928 
1929 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1930  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1931  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1932  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1933  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1934  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1935  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1936  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1937  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1938  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1939  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1940  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1941  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1942  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1943  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1944  PIN_OSPEED_SPEED_VERYLOW(PK15))
1945 
1946 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1947  PIN_PUPDR_PULLDOWN(PK01) | \
1948  PIN_PUPDR_PULLDOWN(PK02) | \
1949  PIN_PUPDR_PULLDOWN(PK03) | \
1950  PIN_PUPDR_PULLDOWN(PK04) | \
1951  PIN_PUPDR_PULLDOWN(PK05) | \
1952  PIN_PUPDR_PULLDOWN(PK06) | \
1953  PIN_PUPDR_PULLDOWN(PK07) | \
1954  PIN_PUPDR_PULLDOWN(PK08) | \
1955  PIN_PUPDR_PULLDOWN(PK09) | \
1956  PIN_PUPDR_PULLDOWN(PK10) | \
1957  PIN_PUPDR_PULLDOWN(PK11) | \
1958  PIN_PUPDR_PULLDOWN(PK12) | \
1959  PIN_PUPDR_PULLDOWN(PK13) | \
1960  PIN_PUPDR_PULLDOWN(PK14) | \
1961  PIN_PUPDR_PULLDOWN(PK15))
1962 
1963 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1964  PIN_ODR_LEVEL_LOW(PK01) | \
1965  PIN_ODR_LEVEL_LOW(PK02) | \
1966  PIN_ODR_LEVEL_LOW(PK03) | \
1967  PIN_ODR_LEVEL_LOW(PK04) | \
1968  PIN_ODR_LEVEL_LOW(PK05) | \
1969  PIN_ODR_LEVEL_LOW(PK06) | \
1970  PIN_ODR_LEVEL_LOW(PK07) | \
1971  PIN_ODR_LEVEL_LOW(PK08) | \
1972  PIN_ODR_LEVEL_LOW(PK09) | \
1973  PIN_ODR_LEVEL_LOW(PK10) | \
1974  PIN_ODR_LEVEL_LOW(PK11) | \
1975  PIN_ODR_LEVEL_LOW(PK12) | \
1976  PIN_ODR_LEVEL_LOW(PK13) | \
1977  PIN_ODR_LEVEL_LOW(PK14) | \
1978  PIN_ODR_LEVEL_LOW(PK15))
1979 
1980 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1981  PIN_AFIO_AF(PK01, 0) | \
1982  PIN_AFIO_AF(PK02, 0) | \
1983  PIN_AFIO_AF(PK03, 0) | \
1984  PIN_AFIO_AF(PK04, 0) | \
1985  PIN_AFIO_AF(PK05, 0) | \
1986  PIN_AFIO_AF(PK06, 0) | \
1987  PIN_AFIO_AF(PK07, 0))
1988 
1989 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1990  PIN_AFIO_AF(PK09, 0) | \
1991  PIN_AFIO_AF(PK10, 0) | \
1992  PIN_AFIO_AF(PK11, 0) | \
1993  PIN_AFIO_AF(PK12, 0) | \
1994  PIN_AFIO_AF(PK13, 0) | \
1995  PIN_AFIO_AF(PK14, 0) | \
1996  PIN_AFIO_AF(PK15, 0))
1997 
1998 #define AF_UART4_TX 8U
1999 #define AF_LINE_UART4_TX 8U
2000 #define AF_UART4_RX 8U
2001 #define AF_LINE_UART4_RX 8U
2002 #define AF_UART2_RX 7U
2003 #define AF_LINE_UART2_RX 7U
2004 #define AF_SPI1_SCK 5U
2005 #define AF_LINE_SPI1_SCK 5U
2006 #define AF_SPI1_MISO 5U
2007 #define AF_LINE_SPI1_MISO 5U
2008 #define AF_SPI1_MOSI 5U
2009 #define AF_LINE_SPI1_MOSI 5U
2010 #define AF_CU1_CH1 1U
2011 #define AF_LINE_CU1_CH1 1U
2012 #define AF_USART1_RX 7U
2013 #define AF_LINE_USART1_RX 7U
2014 #define AF_OTG_FS_DM 10U
2015 #define AF_LINE_OTG_FS_DM 10U
2016 #define AF_OTG_FS_DP 10U
2017 #define AF_LINE_OTG_FS_DP 10U
2018 #define AF_SWDIO 0U
2019 #define AF_LINE_SWDIO 0U
2020 #define AF_SWCLK 0U
2021 #define AF_LINE_SWCLK 0U
2022 #define AF_USART1_TX 7U
2023 #define AF_LINE_USART1_TX 7U
2024 #define AF_I2C1_SDA 4U
2025 #define AF_LINE_I2C1_SDA 4U
2026 #define AF_I2C1_SCL 4U
2027 #define AF_LINE_I2C1_SCL 4U
2028 #define AF_I2C2_SCL 4U
2029 #define AF_LINE_I2C2_SCL 4U
2030 #define AF_I2C2_SDA 4U
2031 #define AF_LINE_I2C2_SDA 4U
2032 #define AF_USART6_TX 8U
2033 #define AF_LINE_USART6_TX 8U
2034 #define AF_USART6_RX 8U
2035 #define AF_LINE_USART6_RX 8U
2036 #define AF_SDIO_D0 12U
2037 #define AF_LINE_SDIO_D0 12U
2038 #define AF_SDIO_D1 12U
2039 #define AF_LINE_SDIO_D1 12U
2040 #define AF_SDIO_D2 12U
2041 #define AF_LINE_SDIO_D2 12U
2042 #define AF_SDIO_D3 12U
2043 #define AF_LINE_SDIO_D3 12U
2044 #define AF_SDIO_CK 12U
2045 #define AF_LINE_SDIO_CK 12U
2046 #define AF_OSC32_IN 0U
2047 #define AF_LINE_OSC32_IN 0U
2048 #define AF_OSC32_OUT 0U
2049 #define AF_LINE_OSC32_OUT 0U
2050 #define AF_SDIO_CMD 12U
2051 #define AF_LINE_SDIO_CMD 12U
2052 #define AF_OSC_IN 0U
2053 #define AF_LINE_OSC_IN 0U
2054 #define AF_OSC_OUT 0U
2055 #define AF_LINE_OSC_OUT 0U
2056 
2057 
2058 #if !defined(_FROM_ASM_)
2059 #ifdef __cplusplus
2060 extern "C" {
2061 #endif
2062  void boardInit(void);
2063 #ifdef __cplusplus
2064 }
2065 #endif
2066 #endif /* _FROM_ASM_ */
2067 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:261