Paparazzi UAS  v5.14.0_stable-0-g3f680d1
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 RC_PPM_TICKS_PER_USEC 2
350 #define PPM_TIMER_FREQUENCY 2000000
351 #define PPM_CHANNEL ICU_CHANNEL_1
352 #define PPM_TIMER ICUD1
353 
354 /*
355  * Spektrum
356  */
357 
358 // shorter wait with chibios as the RTC oscillator takes longer to stabilize
359 #define SPEKTRUM_BIND_WAIT 30000
360 
361 /* The line that is pulled low at power up to initiate the bind process
362  * PB15: AUX4
363  */
364 #define SPEKTRUM_BIND_PIN GPIO15
365 #define SPEKTRUM_BIND_PIN_PORT GPIOB
366 
367 /* The line used to send the pulse train for the bind process
368  * When using UART2 on Apogee, this as to be a different pin than the uart2 rx
369  * Default pin for this is PA8: PPM_IN
370  */
371 #ifndef SPEKTRUM_PRIMARY_BIND_CONF_PORT
372 #define SPEKTRUM_PRIMARY_BIND_CONF_PORT GPIOA
373 #define SPEKTRUM_PRIMARY_BIND_CONF_PIN GPIO8
374 #endif
375 
376 /*
377  * PWM input
378  */
379 // PWM_INPUT 1 on PA8 (also PPM IN)
380 #define PWM_INPUT1_ICU ICUD1
381 #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
382 // PPM in (aka PA8) is used: not compatible with PPM RC receiver
383 #define PWM_INPUT1_GPIO_PORT GPIOA
384 #define PWM_INPUT1_GPIO_PIN GPIO8
385 #define PWM_INPUT1_GPIO_AF GPIO_AF1
386 
387 // PWM_INPUT 2 on PA3 (also SERVO 1)
388 #if (USE_PWM1 && USE_PWM_INPUT2)
389 #error "PW1 and PWM_INPUT2 are not compatible"
390 #endif
391 #define PWM_INPUT2_ICU ICUD9
392 #define PWM_INPUT2_CHANNEL ICU_CHANNEL_1
393 #define PWM_INPUT2_GPIO_PORT GPIOA
394 #define PWM_INPUT2_GPIO_PIN GPIO2
395 #define PWM_INPUT2_GPIO_AF GPIO_AF3
396 
400 #ifndef I2C1_CLOCK_SPEED
401 #define I2C1_CLOCK_SPEED 400000
402 #endif
403 #if I2C1_CLOCK_SPEED == 400000
404 #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
405 #elif I2C1_CLOCK_SPEED == 100000
406 #define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
407 #else
408 #error Invalid I2C1 clock speed
409 #endif
410 #define I2C1_CFG_DEF { \
411  OPMODE_I2C, \
412  I2C1_CLOCK_SPEED, \
413  I2C1_DUTY_CYCLE, \
414  }
415 
416 #ifndef I2C2_CLOCK_SPEED
417 #define I2C2_CLOCK_SPEED 400000
418 #endif
419 #if I2C2_CLOCK_SPEED == 400000
420 #define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
421 #elif I2C2_CLOCK_SPEED == 100000
422 #define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
423 #else
424 #error Invalid I2C2 clock speed
425 #endif
426 #define I2C2_CFG_DEF { \
427  OPMODE_I2C, \
428  I2C2_CLOCK_SPEED, \
429  I2C2_DUTY_CYCLE, \
430  }
431 
435 #define SPI1_GPIO_AF GPIO_AF5
436 #define SPI1_GPIO_PORT_MISO GPIOA
437 #define SPI1_GPIO_MISO GPIO6
438 #define SPI1_GPIO_PORT_MOSI GPIOA
439 #define SPI1_GPIO_MOSI GPIO7
440 #define SPI1_GPIO_PORT_SCK GPIOA
441 #define SPI1_GPIO_SCK GPIO5
442 
443 // SLAVE0 on SPI connector
444 #define SPI_SELECT_SLAVE0_PORT GPIOB
445 #define SPI_SELECT_SLAVE0_PIN GPIO9
446 // SLAVE1 on AUX1
447 #define SPI_SELECT_SLAVE1_PORT GPIOB
448 #define SPI_SELECT_SLAVE1_PIN GPIO1
449 // SLAVE2 on AUX2
450 #define SPI_SELECT_SLAVE2_PORT GPIOC
451 #define SPI_SELECT_SLAVE2_PIN GPIO5
452 // SLAVE3 on AUX3
453 #define SPI_SELECT_SLAVE3_PORT GPIOC
454 #define SPI_SELECT_SLAVE3_PIN GPIO4
455 // SLAVE4 on AUX4
456 #define SPI_SELECT_SLAVE4_PORT GPIOB
457 #define SPI_SELECT_SLAVE4_PIN GPIO15
458 
465 #ifndef USE_BARO_BOARD
466 #define USE_BARO_BOARD 1
467 #endif
468 
469 /*
470  * Actuators for fixedwing
471  */
472  /* Default actuators driver */
473 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
474 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
475 #define ActuatorsDefaultInit() ActuatorsPwmInit()
476 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
477 
478 
482 #define SDIO_D0_PORT GPIOC
483 #define SDIO_D0_PIN SDIO_D0
484 #define SDIO_D1_PORT GPIOC
485 #define SDIO_D1_PIN SDIO_D1
486 #define SDIO_D2_PORT GPIOC
487 #define SDIO_D2_PIN SDIO_D2
488 #define SDIO_D3_PORT GPIOC
489 #define SDIO_D3_PIN SDIO_D3
490 #define SDIO_CK_PORT GPIOC
491 #define SDIO_CK_PIN SDIO_CK
492 #define SDIO_CMD_PORT GPIOD
493 #define SDIO_CMD_PIN SDIO_CMD
494 #define SDIO_AF 12
495 // bat monitoring for file closing
496 #define SDLOG_BAT_ADC ADCD1
497 #define SDLOG_BAT_CHAN AD1_4_CHANNEL
498 // usb led status
499 #define SDLOG_USB_LED 4
500 #define SDLOG_USB_VBUS_PORT GPIOA
501 #define SDLOG_USB_VBUS_PIN GPIO9
502 
503 
504 
505 
506 /*
507  * IO pins assignments.
508  */
509 /*
510  * IO pins assignments.
511  */
512 #define UART4_TX 0U
513 #define UART4_RX 1U
514 #define PWM2_CH3 2U
515 #define UART2_RX 3U
516 #define ADC1_IN4 4U
517 #define SPI1_SCK 5U
518 #define SPI1_MISO 6U
519 #define SPI1_MOSI 7U
520 #define CU1_CH1 8U
521 #define OTG_FS_VBUS 9U
522 #define USART1_RX 10U
523 #define OTG_FS_DM 11U
524 #define OTG_FS_DP 12U
525 #define SWDIO 13U
526 #define SWCLK 14U
527 #define PWM2_CH1 15U
528 
529 #define PWM3_CH3 0U
530 #define AUX1 1U
531 #define BOOT1 2U
532 #define PWM2_CH2 3U
533 #define PWM3_CH1 4U
534 #define PWM3_CH2 5U
535 #define USART1_TX 6U
536 #define I2C1_SDA 7U
537 #define I2C1_SCL 8U
538 #define SPI1_CS 9U
539 #define I2C2_SCL 10U
540 #define I2C2_SDA 11U
541 #define POWER_SWITCH 12U
542 #define RX2_POL 13U
543 #define SDIO_DETECT 14U
544 #define AUX4 15U
545 
546 #define LED1 0U
547 #define LED3 1U
548 #define PC02 2U
549 #define LED4 3U
550 #define AUX3 4U
551 #define AUX2 5U
552 #define USART6_TX 6U
553 #define USART6_RX 7U
554 #define SDIO_D0 8U
555 #define SDIO_D1 9U
556 #define SDIO_D2 10U
557 #define SDIO_D3 11U
558 #define SDIO_CK 12U
559 #define LED2 13U
560 #define OSC32_IN 14U
561 #define OSC32_OUT 15U
562 
563 #define PD00 0U
564 #define PD01 1U
565 #define SDIO_CMD 2U
566 #define PD03 3U
567 #define PD04 4U
568 #define PD05 5U
569 #define PD06 6U
570 #define PD07 7U
571 #define PD08 8U
572 #define PD09 9U
573 #define PD10 10U
574 #define PD11 11U
575 #define PD12 12U
576 #define PD13 13U
577 #define PD14 14U
578 #define PD15 15U
579 
580 #define PE00 0U
581 #define PE01 1U
582 #define PE02 2U
583 #define PE03 3U
584 #define PE04 4U
585 #define PE05 5U
586 #define PE06 6U
587 #define PE07 7U
588 #define PE08 8U
589 #define PE09 9U
590 #define PE10 10U
591 #define PE11 11U
592 #define PE12 12U
593 #define PE13 13U
594 #define PE14 14U
595 #define PE15 15U
596 
597 #define PF00 0U
598 #define PF01 1U
599 #define PF02 2U
600 #define PF03 3U
601 #define PF04 4U
602 #define PF05 5U
603 #define PF06 6U
604 #define PF07 7U
605 #define PF08 8U
606 #define PF09 9U
607 #define PF10 10U
608 #define PF11 11U
609 #define PF12 12U
610 #define PF13 13U
611 #define PF14 14U
612 #define PF15 15U
613 
614 #define PG00 0U
615 #define PG01 1U
616 #define PG02 2U
617 #define PG03 3U
618 #define PG04 4U
619 #define PG05 5U
620 #define PG06 6U
621 #define PG07 7U
622 #define PG08 8U
623 #define PG09 9U
624 #define PG10 10U
625 #define PG11 11U
626 #define PG12 12U
627 #define PG13 13U
628 #define PG14 14U
629 #define PG15 15U
630 
631 #define OSC_IN 0U
632 #define OSC_OUT 1U
633 #define PH02 2U
634 #define PH03 3U
635 #define PH04 4U
636 #define PH05 5U
637 #define PH06 6U
638 #define PH07 7U
639 #define PH08 8U
640 #define PH09 9U
641 #define PH10 10U
642 #define PH11 11U
643 #define PH12 12U
644 #define PH13 13U
645 #define PH14 14U
646 #define PH15 15U
647 
648 #define PI00 0U
649 #define PI01 1U
650 #define PI02 2U
651 #define PI03 3U
652 #define PI04 4U
653 #define PI05 5U
654 #define PI06 6U
655 #define PI07 7U
656 #define PI08 8U
657 #define PI09 9U
658 #define PI10 10U
659 #define PI11 11U
660 #define PI12 12U
661 #define PI13 13U
662 #define PI14 14U
663 #define PI15 15U
664 
665 #define PJ00 0U
666 #define PJ01 1U
667 #define PJ02 2U
668 #define PJ03 3U
669 #define PJ04 4U
670 #define PJ05 5U
671 #define PJ06 6U
672 #define PJ07 7U
673 #define PJ08 8U
674 #define PJ09 9U
675 #define PJ10 10U
676 #define PJ11 11U
677 #define PJ12 12U
678 #define PJ13 13U
679 #define PJ14 14U
680 #define PJ15 15U
681 
682 #define PK00 0U
683 #define PK01 1U
684 #define PK02 2U
685 #define PK03 3U
686 #define PK04 4U
687 #define PK05 5U
688 #define PK06 6U
689 #define PK07 7U
690 #define PK08 8U
691 #define PK09 9U
692 #define PK10 10U
693 #define PK11 11U
694 #define PK12 12U
695 #define PK13 13U
696 #define PK14 14U
697 #define PK15 15U
698 
699 /*
700  * IO lines assignments.
701  */
702 #define LINE_UART4_TX PAL_LINE(GPIOA, 0U)
703 #define LINE_UART4_RX PAL_LINE(GPIOA, 1U)
704 #define LINE_PWM2_CH3 PAL_LINE(GPIOA, 2U)
705 #define LINE_UART2_RX PAL_LINE(GPIOA, 3U)
706 #define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U)
707 #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
708 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
709 #define LINE_SPI1_MOSI PAL_LINE(GPIOA, 7U)
710 #define LINE_CU1_CH1 PAL_LINE(GPIOA, 8U)
711 #define LINE_OTG_FS_VBUS PAL_LINE(GPIOA, 9U)
712 #define LINE_USART1_RX PAL_LINE(GPIOA, 10U)
713 #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
714 #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
715 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
716 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
717 #define LINE_PWM2_CH1 PAL_LINE(GPIOA, 15U)
718 
719 #define LINE_PWM3_CH3 PAL_LINE(GPIOB, 0U)
720 #define LINE_AUX1 PAL_LINE(GPIOB, 1U)
721 #define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
722 #define LINE_PWM2_CH2 PAL_LINE(GPIOB, 3U)
723 #define LINE_PWM3_CH1 PAL_LINE(GPIOB, 4U)
724 #define LINE_PWM3_CH2 PAL_LINE(GPIOB, 5U)
725 #define LINE_USART1_TX PAL_LINE(GPIOB, 6U)
726 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
727 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
728 #define LINE_SPI1_CS PAL_LINE(GPIOB, 9U)
729 #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
730 #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
731 #define LINE_POWER_SWITCH PAL_LINE(GPIOB, 12U)
732 #define LINE_RX2_POL PAL_LINE(GPIOB, 13U)
733 #define LINE_SDIO_DETECT PAL_LINE(GPIOB, 14U)
734 #define LINE_AUX4 PAL_LINE(GPIOB, 15U)
735 
736 #define LINE_LED1 PAL_LINE(GPIOC, 0U)
737 #define LINE_LED3 PAL_LINE(GPIOC, 1U)
738 #define LINE_LED4 PAL_LINE(GPIOC, 3U)
739 #define LINE_AUX3 PAL_LINE(GPIOC, 4U)
740 #define LINE_AUX2 PAL_LINE(GPIOC, 5U)
741 #define LINE_USART6_TX PAL_LINE(GPIOC, 6U)
742 #define LINE_USART6_RX PAL_LINE(GPIOC, 7U)
743 #define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
744 #define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
745 #define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
746 #define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
747 #define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
748 #define LINE_LED2 PAL_LINE(GPIOC, 13U)
749 #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
750 #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
751 
752 #define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
753 
754 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
755 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
756 
757 
758 /*
759  * I/O ports initial setup, this configuration is established soon after reset
760  * in the initialization code.
761  * Please refer to the STM32 Reference Manual for details.
762  */
763 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
764 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
765 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
766 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
767 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
768 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
769 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
770 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
771 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
772 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
773 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
774 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
775 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
776 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
777 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
778 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
779 
780 #define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(UART4_TX) | \
781  PIN_MODE_ALTERNATE(UART4_RX) | \
782  PIN_MODE_INPUT(PWM2_CH3) | \
783  PIN_MODE_ALTERNATE(UART2_RX) | \
784  PIN_MODE_ANALOG(ADC1_IN4) | \
785  PIN_MODE_ALTERNATE(SPI1_SCK) | \
786  PIN_MODE_ALTERNATE(SPI1_MISO) | \
787  PIN_MODE_ALTERNATE(SPI1_MOSI) | \
788  PIN_MODE_ALTERNATE(CU1_CH1) | \
789  PIN_MODE_INPUT(OTG_FS_VBUS) | \
790  PIN_MODE_ALTERNATE(USART1_RX) | \
791  PIN_MODE_ALTERNATE(OTG_FS_DM) | \
792  PIN_MODE_ALTERNATE(OTG_FS_DP) | \
793  PIN_MODE_ALTERNATE(SWDIO) | \
794  PIN_MODE_ALTERNATE(SWCLK) | \
795  PIN_MODE_INPUT(PWM2_CH1))
796 
797 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(UART4_TX) | \
798  PIN_OTYPE_PUSHPULL(UART4_RX) | \
799  PIN_OTYPE_OPENDRAIN(PWM2_CH3) | \
800  PIN_OTYPE_PUSHPULL(UART2_RX) | \
801  PIN_OTYPE_PUSHPULL(ADC1_IN4) | \
802  PIN_OTYPE_PUSHPULL(SPI1_SCK) | \
803  PIN_OTYPE_PUSHPULL(SPI1_MISO) | \
804  PIN_OTYPE_PUSHPULL(SPI1_MOSI) | \
805  PIN_OTYPE_PUSHPULL(CU1_CH1) | \
806  PIN_OTYPE_OPENDRAIN(OTG_FS_VBUS) | \
807  PIN_OTYPE_PUSHPULL(USART1_RX) | \
808  PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
809  PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
810  PIN_OTYPE_PUSHPULL(SWDIO) | \
811  PIN_OTYPE_PUSHPULL(SWCLK) | \
812  PIN_OTYPE_OPENDRAIN(PWM2_CH1))
813 
814 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART4_TX) | \
815  PIN_OSPEED_SPEED_HIGH(UART4_RX) | \
816  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH3) | \
817  PIN_OSPEED_SPEED_HIGH(UART2_RX) | \
818  PIN_OSPEED_SPEED_VERYLOW(ADC1_IN4) | \
819  PIN_OSPEED_SPEED_HIGH(SPI1_SCK) | \
820  PIN_OSPEED_SPEED_HIGH(SPI1_MISO) | \
821  PIN_OSPEED_SPEED_HIGH(SPI1_MOSI) | \
822  PIN_OSPEED_SPEED_HIGH(CU1_CH1) | \
823  PIN_OSPEED_SPEED_VERYLOW(OTG_FS_VBUS) | \
824  PIN_OSPEED_SPEED_HIGH(USART1_RX) | \
825  PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
826  PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
827  PIN_OSPEED_SPEED_HIGH(SWDIO) | \
828  PIN_OSPEED_SPEED_HIGH(SWCLK) | \
829  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH1))
830 
831 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(UART4_TX) | \
832  PIN_PUPDR_FLOATING(UART4_RX) | \
833  PIN_PUPDR_FLOATING(PWM2_CH3) | \
834  PIN_PUPDR_FLOATING(UART2_RX) | \
835  PIN_PUPDR_FLOATING(ADC1_IN4) | \
836  PIN_PUPDR_FLOATING(SPI1_SCK) | \
837  PIN_PUPDR_FLOATING(SPI1_MISO) | \
838  PIN_PUPDR_FLOATING(SPI1_MOSI) | \
839  PIN_PUPDR_FLOATING(CU1_CH1) | \
840  PIN_PUPDR_PULLDOWN(OTG_FS_VBUS) | \
841  PIN_PUPDR_FLOATING(USART1_RX) | \
842  PIN_PUPDR_FLOATING(OTG_FS_DM) | \
843  PIN_PUPDR_FLOATING(OTG_FS_DP) | \
844  PIN_PUPDR_FLOATING(SWDIO) | \
845  PIN_PUPDR_FLOATING(SWCLK) | \
846  PIN_PUPDR_FLOATING(PWM2_CH1))
847 
848 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_HIGH(UART4_TX) | \
849  PIN_ODR_LEVEL_HIGH(UART4_RX) | \
850  PIN_ODR_LEVEL_LOW(PWM2_CH3) | \
851  PIN_ODR_LEVEL_HIGH(UART2_RX) | \
852  PIN_ODR_LEVEL_LOW(ADC1_IN4) | \
853  PIN_ODR_LEVEL_HIGH(SPI1_SCK) | \
854  PIN_ODR_LEVEL_HIGH(SPI1_MISO) | \
855  PIN_ODR_LEVEL_HIGH(SPI1_MOSI) | \
856  PIN_ODR_LEVEL_HIGH(CU1_CH1) | \
857  PIN_ODR_LEVEL_LOW(OTG_FS_VBUS) | \
858  PIN_ODR_LEVEL_HIGH(USART1_RX) | \
859  PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
860  PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
861  PIN_ODR_LEVEL_HIGH(SWDIO) | \
862  PIN_ODR_LEVEL_HIGH(SWCLK) | \
863  PIN_ODR_LEVEL_LOW(PWM2_CH1))
864 
865 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(UART4_TX, 8) | \
866  PIN_AFIO_AF(UART4_RX, 8) | \
867  PIN_AFIO_AF(PWM2_CH3, 0) | \
868  PIN_AFIO_AF(UART2_RX, 7) | \
869  PIN_AFIO_AF(ADC1_IN4, 0) | \
870  PIN_AFIO_AF(SPI1_SCK, 5) | \
871  PIN_AFIO_AF(SPI1_MISO, 5) | \
872  PIN_AFIO_AF(SPI1_MOSI, 5))
873 
874 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(CU1_CH1, 1) | \
875  PIN_AFIO_AF(OTG_FS_VBUS, 0) | \
876  PIN_AFIO_AF(USART1_RX, 7) | \
877  PIN_AFIO_AF(OTG_FS_DM, 10) | \
878  PIN_AFIO_AF(OTG_FS_DP, 10) | \
879  PIN_AFIO_AF(SWDIO, 0) | \
880  PIN_AFIO_AF(SWCLK, 0) | \
881  PIN_AFIO_AF(PWM2_CH1, 0))
882 
883 #define VAL_GPIOB_MODER (PIN_MODE_INPUT(PWM3_CH3) | \
884  PIN_MODE_INPUT(AUX1) | \
885  PIN_MODE_INPUT(BOOT1) | \
886  PIN_MODE_INPUT(PWM2_CH2) | \
887  PIN_MODE_INPUT(PWM3_CH1) | \
888  PIN_MODE_INPUT(PWM3_CH2) | \
889  PIN_MODE_ALTERNATE(USART1_TX) | \
890  PIN_MODE_ALTERNATE(I2C1_SDA) | \
891  PIN_MODE_ALTERNATE(I2C1_SCL) | \
892  PIN_MODE_OUTPUT(SPI1_CS) | \
893  PIN_MODE_ALTERNATE(I2C2_SCL) | \
894  PIN_MODE_ALTERNATE(I2C2_SDA) | \
895  PIN_MODE_OUTPUT(POWER_SWITCH) | \
896  PIN_MODE_OUTPUT(RX2_POL) | \
897  PIN_MODE_INPUT(SDIO_DETECT) | \
898  PIN_MODE_INPUT(AUX4))
899 
900 #define VAL_GPIOB_OTYPER (PIN_OTYPE_OPENDRAIN(PWM3_CH3) | \
901  PIN_OTYPE_OPENDRAIN(AUX1) | \
902  PIN_OTYPE_OPENDRAIN(BOOT1) | \
903  PIN_OTYPE_OPENDRAIN(PWM2_CH2) | \
904  PIN_OTYPE_OPENDRAIN(PWM3_CH1) | \
905  PIN_OTYPE_OPENDRAIN(PWM3_CH2) | \
906  PIN_OTYPE_PUSHPULL(USART1_TX) | \
907  PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
908  PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
909  PIN_OTYPE_PUSHPULL(SPI1_CS) | \
910  PIN_OTYPE_OPENDRAIN(I2C2_SCL) | \
911  PIN_OTYPE_OPENDRAIN(I2C2_SDA) | \
912  PIN_OTYPE_PUSHPULL(POWER_SWITCH) | \
913  PIN_OTYPE_PUSHPULL(RX2_POL) | \
914  PIN_OTYPE_OPENDRAIN(SDIO_DETECT) | \
915  PIN_OTYPE_OPENDRAIN(AUX4))
916 
917 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PWM3_CH3) | \
918  PIN_OSPEED_SPEED_VERYLOW(AUX1) | \
919  PIN_OSPEED_SPEED_VERYLOW(BOOT1) | \
920  PIN_OSPEED_SPEED_VERYLOW(PWM2_CH2) | \
921  PIN_OSPEED_SPEED_VERYLOW(PWM3_CH1) | \
922  PIN_OSPEED_SPEED_VERYLOW(PWM3_CH2) | \
923  PIN_OSPEED_SPEED_HIGH(USART1_TX) | \
924  PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
925  PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
926  PIN_OSPEED_SPEED_HIGH(SPI1_CS) | \
927  PIN_OSPEED_SPEED_HIGH(I2C2_SCL) | \
928  PIN_OSPEED_SPEED_HIGH(I2C2_SDA) | \
929  PIN_OSPEED_SPEED_HIGH(POWER_SWITCH) | \
930  PIN_OSPEED_SPEED_HIGH(RX2_POL) | \
931  PIN_OSPEED_SPEED_VERYLOW(SDIO_DETECT) | \
932  PIN_OSPEED_SPEED_VERYLOW(AUX4))
933 
934 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(PWM3_CH3) | \
935  PIN_PUPDR_FLOATING(AUX1) | \
936  PIN_PUPDR_FLOATING(BOOT1) | \
937  PIN_PUPDR_FLOATING(PWM2_CH2) | \
938  PIN_PUPDR_FLOATING(PWM3_CH1) | \
939  PIN_PUPDR_FLOATING(PWM3_CH2) | \
940  PIN_PUPDR_FLOATING(USART1_TX) | \
941  PIN_PUPDR_PULLUP(I2C1_SDA) | \
942  PIN_PUPDR_PULLUP(I2C1_SCL) | \
943  PIN_PUPDR_FLOATING(SPI1_CS) | \
944  PIN_PUPDR_PULLUP(I2C2_SCL) | \
945  PIN_PUPDR_PULLUP(I2C2_SDA) | \
946  PIN_PUPDR_FLOATING(POWER_SWITCH) | \
947  PIN_PUPDR_FLOATING(RX2_POL) | \
948  PIN_PUPDR_PULLUP(SDIO_DETECT) | \
949  PIN_PUPDR_FLOATING(AUX4))
950 
951 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(PWM3_CH3) | \
952  PIN_ODR_LEVEL_LOW(AUX1) | \
953  PIN_ODR_LEVEL_LOW(BOOT1) | \
954  PIN_ODR_LEVEL_LOW(PWM2_CH2) | \
955  PIN_ODR_LEVEL_LOW(PWM3_CH1) | \
956  PIN_ODR_LEVEL_LOW(PWM3_CH2) | \
957  PIN_ODR_LEVEL_HIGH(USART1_TX) | \
958  PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
959  PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
960  PIN_ODR_LEVEL_HIGH(SPI1_CS) | \
961  PIN_ODR_LEVEL_HIGH(I2C2_SCL) | \
962  PIN_ODR_LEVEL_HIGH(I2C2_SDA) | \
963  PIN_ODR_LEVEL_HIGH(POWER_SWITCH) | \
964  PIN_ODR_LEVEL_HIGH(RX2_POL) | \
965  PIN_ODR_LEVEL_LOW(SDIO_DETECT) | \
966  PIN_ODR_LEVEL_LOW(AUX4))
967 
968 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(PWM3_CH3, 0) | \
969  PIN_AFIO_AF(AUX1, 0) | \
970  PIN_AFIO_AF(BOOT1, 0) | \
971  PIN_AFIO_AF(PWM2_CH2, 0) | \
972  PIN_AFIO_AF(PWM3_CH1, 0) | \
973  PIN_AFIO_AF(PWM3_CH2, 0) | \
974  PIN_AFIO_AF(USART1_TX, 7) | \
975  PIN_AFIO_AF(I2C1_SDA, 4))
976 
977 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(I2C1_SCL, 4) | \
978  PIN_AFIO_AF(SPI1_CS, 0) | \
979  PIN_AFIO_AF(I2C2_SCL, 4) | \
980  PIN_AFIO_AF(I2C2_SDA, 4) | \
981  PIN_AFIO_AF(POWER_SWITCH, 0) | \
982  PIN_AFIO_AF(RX2_POL, 0) | \
983  PIN_AFIO_AF(SDIO_DETECT, 0) | \
984  PIN_AFIO_AF(AUX4, 0))
985 
986 #define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(LED1) | \
987  PIN_MODE_OUTPUT(LED3) | \
988  PIN_MODE_INPUT(PC02) | \
989  PIN_MODE_OUTPUT(LED4) | \
990  PIN_MODE_INPUT(AUX3) | \
991  PIN_MODE_INPUT(AUX2) | \
992  PIN_MODE_ALTERNATE(USART6_TX) | \
993  PIN_MODE_ALTERNATE(USART6_RX) | \
994  PIN_MODE_ALTERNATE(SDIO_D0) | \
995  PIN_MODE_ALTERNATE(SDIO_D1) | \
996  PIN_MODE_ALTERNATE(SDIO_D2) | \
997  PIN_MODE_ALTERNATE(SDIO_D3) | \
998  PIN_MODE_ALTERNATE(SDIO_CK) | \
999  PIN_MODE_OUTPUT(LED2) | \
1000  PIN_MODE_ALTERNATE(OSC32_IN) | \
1001  PIN_MODE_ALTERNATE(OSC32_OUT))
1002 
1003 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(LED1) | \
1004  PIN_OTYPE_PUSHPULL(LED3) | \
1005  PIN_OTYPE_PUSHPULL(PC02) | \
1006  PIN_OTYPE_PUSHPULL(LED4) | \
1007  PIN_OTYPE_OPENDRAIN(AUX3) | \
1008  PIN_OTYPE_OPENDRAIN(AUX2) | \
1009  PIN_OTYPE_PUSHPULL(USART6_TX) | \
1010  PIN_OTYPE_PUSHPULL(USART6_RX) | \
1011  PIN_OTYPE_PUSHPULL(SDIO_D0) | \
1012  PIN_OTYPE_PUSHPULL(SDIO_D1) | \
1013  PIN_OTYPE_PUSHPULL(SDIO_D2) | \
1014  PIN_OTYPE_PUSHPULL(SDIO_D3) | \
1015  PIN_OTYPE_PUSHPULL(SDIO_CK) | \
1016  PIN_OTYPE_PUSHPULL(LED2) | \
1017  PIN_OTYPE_PUSHPULL(OSC32_IN) | \
1018  PIN_OTYPE_PUSHPULL(OSC32_OUT))
1019 
1020 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(LED1) | \
1021  PIN_OSPEED_SPEED_VERYLOW(LED3) | \
1022  PIN_OSPEED_SPEED_VERYLOW(PC02) | \
1023  PIN_OSPEED_SPEED_VERYLOW(LED4) | \
1024  PIN_OSPEED_SPEED_VERYLOW(AUX3) | \
1025  PIN_OSPEED_SPEED_VERYLOW(AUX2) | \
1026  PIN_OSPEED_SPEED_HIGH(USART6_TX) | \
1027  PIN_OSPEED_SPEED_HIGH(USART6_RX) | \
1028  PIN_OSPEED_SPEED_HIGH(SDIO_D0) | \
1029  PIN_OSPEED_SPEED_HIGH(SDIO_D1) | \
1030  PIN_OSPEED_SPEED_HIGH(SDIO_D2) | \
1031  PIN_OSPEED_SPEED_HIGH(SDIO_D3) | \
1032  PIN_OSPEED_SPEED_HIGH(SDIO_CK) | \
1033  PIN_OSPEED_SPEED_VERYLOW(LED2) | \
1034  PIN_OSPEED_SPEED_HIGH(OSC32_IN) | \
1035  PIN_OSPEED_SPEED_HIGH(OSC32_OUT))
1036 
1037 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(LED1) | \
1038  PIN_PUPDR_FLOATING(LED3) | \
1039  PIN_PUPDR_PULLDOWN(PC02) | \
1040  PIN_PUPDR_FLOATING(LED4) | \
1041  PIN_PUPDR_FLOATING(AUX3) | \
1042  PIN_PUPDR_FLOATING(AUX2) | \
1043  PIN_PUPDR_FLOATING(USART6_TX) | \
1044  PIN_PUPDR_FLOATING(USART6_RX) | \
1045  PIN_PUPDR_PULLUP(SDIO_D0) | \
1046  PIN_PUPDR_PULLUP(SDIO_D1) | \
1047  PIN_PUPDR_PULLUP(SDIO_D2) | \
1048  PIN_PUPDR_PULLUP(SDIO_D3) | \
1049  PIN_PUPDR_FLOATING(SDIO_CK) | \
1050  PIN_PUPDR_FLOATING(LED2) | \
1051  PIN_PUPDR_FLOATING(OSC32_IN) | \
1052  PIN_PUPDR_FLOATING(OSC32_OUT))
1053 
1054 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(LED1) | \
1055  PIN_ODR_LEVEL_LOW(LED3) | \
1056  PIN_ODR_LEVEL_LOW(PC02) | \
1057  PIN_ODR_LEVEL_LOW(LED4) | \
1058  PIN_ODR_LEVEL_LOW(AUX3) | \
1059  PIN_ODR_LEVEL_LOW(AUX2) | \
1060  PIN_ODR_LEVEL_HIGH(USART6_TX) | \
1061  PIN_ODR_LEVEL_HIGH(USART6_RX) | \
1062  PIN_ODR_LEVEL_HIGH(SDIO_D0) | \
1063  PIN_ODR_LEVEL_HIGH(SDIO_D1) | \
1064  PIN_ODR_LEVEL_HIGH(SDIO_D2) | \
1065  PIN_ODR_LEVEL_HIGH(SDIO_D3) | \
1066  PIN_ODR_LEVEL_HIGH(SDIO_CK) | \
1067  PIN_ODR_LEVEL_LOW(LED2) | \
1068  PIN_ODR_LEVEL_HIGH(OSC32_IN) | \
1069  PIN_ODR_LEVEL_HIGH(OSC32_OUT))
1070 
1071 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(LED1, 0) | \
1072  PIN_AFIO_AF(LED3, 0) | \
1073  PIN_AFIO_AF(PC02, 0) | \
1074  PIN_AFIO_AF(LED4, 0) | \
1075  PIN_AFIO_AF(AUX3, 0) | \
1076  PIN_AFIO_AF(AUX2, 0) | \
1077  PIN_AFIO_AF(USART6_TX, 8) | \
1078  PIN_AFIO_AF(USART6_RX, 8))
1079 
1080 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(SDIO_D0, 12) | \
1081  PIN_AFIO_AF(SDIO_D1, 12) | \
1082  PIN_AFIO_AF(SDIO_D2, 12) | \
1083  PIN_AFIO_AF(SDIO_D3, 12) | \
1084  PIN_AFIO_AF(SDIO_CK, 12) | \
1085  PIN_AFIO_AF(LED2, 0) | \
1086  PIN_AFIO_AF(OSC32_IN, 0) | \
1087  PIN_AFIO_AF(OSC32_OUT, 0))
1088 
1089 #define VAL_GPIOD_MODER (PIN_MODE_INPUT(PD00) | \
1090  PIN_MODE_INPUT(PD01) | \
1091  PIN_MODE_ALTERNATE(SDIO_CMD) | \
1092  PIN_MODE_INPUT(PD03) | \
1093  PIN_MODE_INPUT(PD04) | \
1094  PIN_MODE_INPUT(PD05) | \
1095  PIN_MODE_INPUT(PD06) | \
1096  PIN_MODE_INPUT(PD07) | \
1097  PIN_MODE_INPUT(PD08) | \
1098  PIN_MODE_INPUT(PD09) | \
1099  PIN_MODE_INPUT(PD10) | \
1100  PIN_MODE_INPUT(PD11) | \
1101  PIN_MODE_INPUT(PD12) | \
1102  PIN_MODE_INPUT(PD13) | \
1103  PIN_MODE_INPUT(PD14) | \
1104  PIN_MODE_INPUT(PD15))
1105 
1106 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00) | \
1107  PIN_OTYPE_PUSHPULL(PD01) | \
1108  PIN_OTYPE_PUSHPULL(SDIO_CMD) | \
1109  PIN_OTYPE_PUSHPULL(PD03) | \
1110  PIN_OTYPE_PUSHPULL(PD04) | \
1111  PIN_OTYPE_PUSHPULL(PD05) | \
1112  PIN_OTYPE_PUSHPULL(PD06) | \
1113  PIN_OTYPE_PUSHPULL(PD07) | \
1114  PIN_OTYPE_PUSHPULL(PD08) | \
1115  PIN_OTYPE_PUSHPULL(PD09) | \
1116  PIN_OTYPE_PUSHPULL(PD10) | \
1117  PIN_OTYPE_PUSHPULL(PD11) | \
1118  PIN_OTYPE_PUSHPULL(PD12) | \
1119  PIN_OTYPE_PUSHPULL(PD13) | \
1120  PIN_OTYPE_PUSHPULL(PD14) | \
1121  PIN_OTYPE_PUSHPULL(PD15))
1122 
1123 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PD00) | \
1124  PIN_OSPEED_SPEED_VERYLOW(PD01) | \
1125  PIN_OSPEED_SPEED_HIGH(SDIO_CMD) | \
1126  PIN_OSPEED_SPEED_VERYLOW(PD03) | \
1127  PIN_OSPEED_SPEED_VERYLOW(PD04) | \
1128  PIN_OSPEED_SPEED_VERYLOW(PD05) | \
1129  PIN_OSPEED_SPEED_VERYLOW(PD06) | \
1130  PIN_OSPEED_SPEED_VERYLOW(PD07) | \
1131  PIN_OSPEED_SPEED_VERYLOW(PD08) | \
1132  PIN_OSPEED_SPEED_VERYLOW(PD09) | \
1133  PIN_OSPEED_SPEED_VERYLOW(PD10) | \
1134  PIN_OSPEED_SPEED_VERYLOW(PD11) | \
1135  PIN_OSPEED_SPEED_VERYLOW(PD12) | \
1136  PIN_OSPEED_SPEED_VERYLOW(PD13) | \
1137  PIN_OSPEED_SPEED_VERYLOW(PD14) | \
1138  PIN_OSPEED_SPEED_VERYLOW(PD15))
1139 
1140 #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(PD00) | \
1141  PIN_PUPDR_PULLDOWN(PD01) | \
1142  PIN_PUPDR_PULLUP(SDIO_CMD) | \
1143  PIN_PUPDR_PULLDOWN(PD03) | \
1144  PIN_PUPDR_PULLDOWN(PD04) | \
1145  PIN_PUPDR_PULLDOWN(PD05) | \
1146  PIN_PUPDR_PULLDOWN(PD06) | \
1147  PIN_PUPDR_PULLDOWN(PD07) | \
1148  PIN_PUPDR_PULLDOWN(PD08) | \
1149  PIN_PUPDR_PULLDOWN(PD09) | \
1150  PIN_PUPDR_PULLDOWN(PD10) | \
1151  PIN_PUPDR_PULLDOWN(PD11) | \
1152  PIN_PUPDR_PULLDOWN(PD12) | \
1153  PIN_PUPDR_PULLDOWN(PD13) | \
1154  PIN_PUPDR_PULLDOWN(PD14) | \
1155  PIN_PUPDR_PULLDOWN(PD15))
1156 
1157 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_LOW(PD00) | \
1158  PIN_ODR_LEVEL_LOW(PD01) | \
1159  PIN_ODR_LEVEL_HIGH(SDIO_CMD) | \
1160  PIN_ODR_LEVEL_LOW(PD03) | \
1161  PIN_ODR_LEVEL_LOW(PD04) | \
1162  PIN_ODR_LEVEL_LOW(PD05) | \
1163  PIN_ODR_LEVEL_LOW(PD06) | \
1164  PIN_ODR_LEVEL_LOW(PD07) | \
1165  PIN_ODR_LEVEL_LOW(PD08) | \
1166  PIN_ODR_LEVEL_LOW(PD09) | \
1167  PIN_ODR_LEVEL_LOW(PD10) | \
1168  PIN_ODR_LEVEL_LOW(PD11) | \
1169  PIN_ODR_LEVEL_LOW(PD12) | \
1170  PIN_ODR_LEVEL_LOW(PD13) | \
1171  PIN_ODR_LEVEL_LOW(PD14) | \
1172  PIN_ODR_LEVEL_LOW(PD15))
1173 
1174 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00, 0) | \
1175  PIN_AFIO_AF(PD01, 0) | \
1176  PIN_AFIO_AF(SDIO_CMD, 12) | \
1177  PIN_AFIO_AF(PD03, 0) | \
1178  PIN_AFIO_AF(PD04, 0) | \
1179  PIN_AFIO_AF(PD05, 0) | \
1180  PIN_AFIO_AF(PD06, 0) | \
1181  PIN_AFIO_AF(PD07, 0))
1182 
1183 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08, 0) | \
1184  PIN_AFIO_AF(PD09, 0) | \
1185  PIN_AFIO_AF(PD10, 0) | \
1186  PIN_AFIO_AF(PD11, 0) | \
1187  PIN_AFIO_AF(PD12, 0) | \
1188  PIN_AFIO_AF(PD13, 0) | \
1189  PIN_AFIO_AF(PD14, 0) | \
1190  PIN_AFIO_AF(PD15, 0))
1191 
1192 #define VAL_GPIOE_MODER (PIN_MODE_INPUT(PE00) | \
1193  PIN_MODE_INPUT(PE01) | \
1194  PIN_MODE_INPUT(PE02) | \
1195  PIN_MODE_INPUT(PE03) | \
1196  PIN_MODE_INPUT(PE04) | \
1197  PIN_MODE_INPUT(PE05) | \
1198  PIN_MODE_INPUT(PE06) | \
1199  PIN_MODE_INPUT(PE07) | \
1200  PIN_MODE_INPUT(PE08) | \
1201  PIN_MODE_INPUT(PE09) | \
1202  PIN_MODE_INPUT(PE10) | \
1203  PIN_MODE_INPUT(PE11) | \
1204  PIN_MODE_INPUT(PE12) | \
1205  PIN_MODE_INPUT(PE13) | \
1206  PIN_MODE_INPUT(PE14) | \
1207  PIN_MODE_INPUT(PE15))
1208 
1209 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00) | \
1210  PIN_OTYPE_PUSHPULL(PE01) | \
1211  PIN_OTYPE_PUSHPULL(PE02) | \
1212  PIN_OTYPE_PUSHPULL(PE03) | \
1213  PIN_OTYPE_PUSHPULL(PE04) | \
1214  PIN_OTYPE_PUSHPULL(PE05) | \
1215  PIN_OTYPE_PUSHPULL(PE06) | \
1216  PIN_OTYPE_PUSHPULL(PE07) | \
1217  PIN_OTYPE_PUSHPULL(PE08) | \
1218  PIN_OTYPE_PUSHPULL(PE09) | \
1219  PIN_OTYPE_PUSHPULL(PE10) | \
1220  PIN_OTYPE_PUSHPULL(PE11) | \
1221  PIN_OTYPE_PUSHPULL(PE12) | \
1222  PIN_OTYPE_PUSHPULL(PE13) | \
1223  PIN_OTYPE_PUSHPULL(PE14) | \
1224  PIN_OTYPE_PUSHPULL(PE15))
1225 
1226 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PE00) | \
1227  PIN_OSPEED_SPEED_VERYLOW(PE01) | \
1228  PIN_OSPEED_SPEED_VERYLOW(PE02) | \
1229  PIN_OSPEED_SPEED_VERYLOW(PE03) | \
1230  PIN_OSPEED_SPEED_VERYLOW(PE04) | \
1231  PIN_OSPEED_SPEED_VERYLOW(PE05) | \
1232  PIN_OSPEED_SPEED_VERYLOW(PE06) | \
1233  PIN_OSPEED_SPEED_VERYLOW(PE07) | \
1234  PIN_OSPEED_SPEED_VERYLOW(PE08) | \
1235  PIN_OSPEED_SPEED_VERYLOW(PE09) | \
1236  PIN_OSPEED_SPEED_VERYLOW(PE10) | \
1237  PIN_OSPEED_SPEED_VERYLOW(PE11) | \
1238  PIN_OSPEED_SPEED_VERYLOW(PE12) | \
1239  PIN_OSPEED_SPEED_VERYLOW(PE13) | \
1240  PIN_OSPEED_SPEED_VERYLOW(PE14) | \
1241  PIN_OSPEED_SPEED_VERYLOW(PE15))
1242 
1243 #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLDOWN(PE00) | \
1244  PIN_PUPDR_PULLDOWN(PE01) | \
1245  PIN_PUPDR_PULLDOWN(PE02) | \
1246  PIN_PUPDR_PULLDOWN(PE03) | \
1247  PIN_PUPDR_PULLDOWN(PE04) | \
1248  PIN_PUPDR_PULLDOWN(PE05) | \
1249  PIN_PUPDR_PULLDOWN(PE06) | \
1250  PIN_PUPDR_PULLDOWN(PE07) | \
1251  PIN_PUPDR_PULLDOWN(PE08) | \
1252  PIN_PUPDR_PULLDOWN(PE09) | \
1253  PIN_PUPDR_PULLDOWN(PE10) | \
1254  PIN_PUPDR_PULLDOWN(PE11) | \
1255  PIN_PUPDR_PULLDOWN(PE12) | \
1256  PIN_PUPDR_PULLDOWN(PE13) | \
1257  PIN_PUPDR_PULLDOWN(PE14) | \
1258  PIN_PUPDR_PULLDOWN(PE15))
1259 
1260 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_LOW(PE00) | \
1261  PIN_ODR_LEVEL_LOW(PE01) | \
1262  PIN_ODR_LEVEL_LOW(PE02) | \
1263  PIN_ODR_LEVEL_LOW(PE03) | \
1264  PIN_ODR_LEVEL_LOW(PE04) | \
1265  PIN_ODR_LEVEL_LOW(PE05) | \
1266  PIN_ODR_LEVEL_LOW(PE06) | \
1267  PIN_ODR_LEVEL_LOW(PE07) | \
1268  PIN_ODR_LEVEL_LOW(PE08) | \
1269  PIN_ODR_LEVEL_LOW(PE09) | \
1270  PIN_ODR_LEVEL_LOW(PE10) | \
1271  PIN_ODR_LEVEL_LOW(PE11) | \
1272  PIN_ODR_LEVEL_LOW(PE12) | \
1273  PIN_ODR_LEVEL_LOW(PE13) | \
1274  PIN_ODR_LEVEL_LOW(PE14) | \
1275  PIN_ODR_LEVEL_LOW(PE15))
1276 
1277 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00, 0) | \
1278  PIN_AFIO_AF(PE01, 0) | \
1279  PIN_AFIO_AF(PE02, 0) | \
1280  PIN_AFIO_AF(PE03, 0) | \
1281  PIN_AFIO_AF(PE04, 0) | \
1282  PIN_AFIO_AF(PE05, 0) | \
1283  PIN_AFIO_AF(PE06, 0) | \
1284  PIN_AFIO_AF(PE07, 0))
1285 
1286 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(PE08, 0) | \
1287  PIN_AFIO_AF(PE09, 0) | \
1288  PIN_AFIO_AF(PE10, 0) | \
1289  PIN_AFIO_AF(PE11, 0) | \
1290  PIN_AFIO_AF(PE12, 0) | \
1291  PIN_AFIO_AF(PE13, 0) | \
1292  PIN_AFIO_AF(PE14, 0) | \
1293  PIN_AFIO_AF(PE15, 0))
1294 
1295 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
1296  PIN_MODE_INPUT(PF01) | \
1297  PIN_MODE_INPUT(PF02) | \
1298  PIN_MODE_INPUT(PF03) | \
1299  PIN_MODE_INPUT(PF04) | \
1300  PIN_MODE_INPUT(PF05) | \
1301  PIN_MODE_INPUT(PF06) | \
1302  PIN_MODE_INPUT(PF07) | \
1303  PIN_MODE_INPUT(PF08) | \
1304  PIN_MODE_INPUT(PF09) | \
1305  PIN_MODE_INPUT(PF10) | \
1306  PIN_MODE_INPUT(PF11) | \
1307  PIN_MODE_INPUT(PF12) | \
1308  PIN_MODE_INPUT(PF13) | \
1309  PIN_MODE_INPUT(PF14) | \
1310  PIN_MODE_INPUT(PF15))
1311 
1312 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
1313  PIN_OTYPE_PUSHPULL(PF01) | \
1314  PIN_OTYPE_PUSHPULL(PF02) | \
1315  PIN_OTYPE_PUSHPULL(PF03) | \
1316  PIN_OTYPE_PUSHPULL(PF04) | \
1317  PIN_OTYPE_PUSHPULL(PF05) | \
1318  PIN_OTYPE_PUSHPULL(PF06) | \
1319  PIN_OTYPE_PUSHPULL(PF07) | \
1320  PIN_OTYPE_PUSHPULL(PF08) | \
1321  PIN_OTYPE_PUSHPULL(PF09) | \
1322  PIN_OTYPE_PUSHPULL(PF10) | \
1323  PIN_OTYPE_PUSHPULL(PF11) | \
1324  PIN_OTYPE_PUSHPULL(PF12) | \
1325  PIN_OTYPE_PUSHPULL(PF13) | \
1326  PIN_OTYPE_PUSHPULL(PF14) | \
1327  PIN_OTYPE_PUSHPULL(PF15))
1328 
1329 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
1330  PIN_OSPEED_SPEED_VERYLOW(PF01) | \
1331  PIN_OSPEED_SPEED_VERYLOW(PF02) | \
1332  PIN_OSPEED_SPEED_VERYLOW(PF03) | \
1333  PIN_OSPEED_SPEED_VERYLOW(PF04) | \
1334  PIN_OSPEED_SPEED_VERYLOW(PF05) | \
1335  PIN_OSPEED_SPEED_VERYLOW(PF06) | \
1336  PIN_OSPEED_SPEED_VERYLOW(PF07) | \
1337  PIN_OSPEED_SPEED_VERYLOW(PF08) | \
1338  PIN_OSPEED_SPEED_VERYLOW(PF09) | \
1339  PIN_OSPEED_SPEED_VERYLOW(PF10) | \
1340  PIN_OSPEED_SPEED_VERYLOW(PF11) | \
1341  PIN_OSPEED_SPEED_VERYLOW(PF12) | \
1342  PIN_OSPEED_SPEED_VERYLOW(PF13) | \
1343  PIN_OSPEED_SPEED_VERYLOW(PF14) | \
1344  PIN_OSPEED_SPEED_VERYLOW(PF15))
1345 
1346 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
1347  PIN_PUPDR_PULLDOWN(PF01) | \
1348  PIN_PUPDR_PULLDOWN(PF02) | \
1349  PIN_PUPDR_PULLDOWN(PF03) | \
1350  PIN_PUPDR_PULLDOWN(PF04) | \
1351  PIN_PUPDR_PULLDOWN(PF05) | \
1352  PIN_PUPDR_PULLDOWN(PF06) | \
1353  PIN_PUPDR_PULLDOWN(PF07) | \
1354  PIN_PUPDR_PULLDOWN(PF08) | \
1355  PIN_PUPDR_PULLDOWN(PF09) | \
1356  PIN_PUPDR_PULLDOWN(PF10) | \
1357  PIN_PUPDR_PULLDOWN(PF11) | \
1358  PIN_PUPDR_PULLDOWN(PF12) | \
1359  PIN_PUPDR_PULLDOWN(PF13) | \
1360  PIN_PUPDR_PULLDOWN(PF14) | \
1361  PIN_PUPDR_PULLDOWN(PF15))
1362 
1363 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
1364  PIN_ODR_LEVEL_LOW(PF01) | \
1365  PIN_ODR_LEVEL_LOW(PF02) | \
1366  PIN_ODR_LEVEL_LOW(PF03) | \
1367  PIN_ODR_LEVEL_LOW(PF04) | \
1368  PIN_ODR_LEVEL_LOW(PF05) | \
1369  PIN_ODR_LEVEL_LOW(PF06) | \
1370  PIN_ODR_LEVEL_LOW(PF07) | \
1371  PIN_ODR_LEVEL_LOW(PF08) | \
1372  PIN_ODR_LEVEL_LOW(PF09) | \
1373  PIN_ODR_LEVEL_LOW(PF10) | \
1374  PIN_ODR_LEVEL_LOW(PF11) | \
1375  PIN_ODR_LEVEL_LOW(PF12) | \
1376  PIN_ODR_LEVEL_LOW(PF13) | \
1377  PIN_ODR_LEVEL_LOW(PF14) | \
1378  PIN_ODR_LEVEL_LOW(PF15))
1379 
1380 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
1381  PIN_AFIO_AF(PF01, 0) | \
1382  PIN_AFIO_AF(PF02, 0) | \
1383  PIN_AFIO_AF(PF03, 0) | \
1384  PIN_AFIO_AF(PF04, 0) | \
1385  PIN_AFIO_AF(PF05, 0) | \
1386  PIN_AFIO_AF(PF06, 0) | \
1387  PIN_AFIO_AF(PF07, 0))
1388 
1389 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
1390  PIN_AFIO_AF(PF09, 0) | \
1391  PIN_AFIO_AF(PF10, 0) | \
1392  PIN_AFIO_AF(PF11, 0) | \
1393  PIN_AFIO_AF(PF12, 0) | \
1394  PIN_AFIO_AF(PF13, 0) | \
1395  PIN_AFIO_AF(PF14, 0) | \
1396  PIN_AFIO_AF(PF15, 0))
1397 
1398 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
1399  PIN_MODE_INPUT(PG01) | \
1400  PIN_MODE_INPUT(PG02) | \
1401  PIN_MODE_INPUT(PG03) | \
1402  PIN_MODE_INPUT(PG04) | \
1403  PIN_MODE_INPUT(PG05) | \
1404  PIN_MODE_INPUT(PG06) | \
1405  PIN_MODE_INPUT(PG07) | \
1406  PIN_MODE_INPUT(PG08) | \
1407  PIN_MODE_INPUT(PG09) | \
1408  PIN_MODE_INPUT(PG10) | \
1409  PIN_MODE_INPUT(PG11) | \
1410  PIN_MODE_INPUT(PG12) | \
1411  PIN_MODE_INPUT(PG13) | \
1412  PIN_MODE_INPUT(PG14) | \
1413  PIN_MODE_INPUT(PG15))
1414 
1415 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
1416  PIN_OTYPE_PUSHPULL(PG01) | \
1417  PIN_OTYPE_PUSHPULL(PG02) | \
1418  PIN_OTYPE_PUSHPULL(PG03) | \
1419  PIN_OTYPE_PUSHPULL(PG04) | \
1420  PIN_OTYPE_PUSHPULL(PG05) | \
1421  PIN_OTYPE_PUSHPULL(PG06) | \
1422  PIN_OTYPE_PUSHPULL(PG07) | \
1423  PIN_OTYPE_PUSHPULL(PG08) | \
1424  PIN_OTYPE_PUSHPULL(PG09) | \
1425  PIN_OTYPE_PUSHPULL(PG10) | \
1426  PIN_OTYPE_PUSHPULL(PG11) | \
1427  PIN_OTYPE_PUSHPULL(PG12) | \
1428  PIN_OTYPE_PUSHPULL(PG13) | \
1429  PIN_OTYPE_PUSHPULL(PG14) | \
1430  PIN_OTYPE_PUSHPULL(PG15))
1431 
1432 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
1433  PIN_OSPEED_SPEED_VERYLOW(PG01) | \
1434  PIN_OSPEED_SPEED_VERYLOW(PG02) | \
1435  PIN_OSPEED_SPEED_VERYLOW(PG03) | \
1436  PIN_OSPEED_SPEED_VERYLOW(PG04) | \
1437  PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1438  PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1439  PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1440  PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1441  PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1442  PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1443  PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1444  PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1445  PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1446  PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1447  PIN_OSPEED_SPEED_VERYLOW(PG15))
1448 
1449 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1450  PIN_PUPDR_PULLDOWN(PG01) | \
1451  PIN_PUPDR_PULLDOWN(PG02) | \
1452  PIN_PUPDR_PULLDOWN(PG03) | \
1453  PIN_PUPDR_PULLDOWN(PG04) | \
1454  PIN_PUPDR_PULLDOWN(PG05) | \
1455  PIN_PUPDR_PULLDOWN(PG06) | \
1456  PIN_PUPDR_PULLDOWN(PG07) | \
1457  PIN_PUPDR_PULLDOWN(PG08) | \
1458  PIN_PUPDR_PULLDOWN(PG09) | \
1459  PIN_PUPDR_PULLDOWN(PG10) | \
1460  PIN_PUPDR_PULLDOWN(PG11) | \
1461  PIN_PUPDR_PULLDOWN(PG12) | \
1462  PIN_PUPDR_PULLDOWN(PG13) | \
1463  PIN_PUPDR_PULLDOWN(PG14) | \
1464  PIN_PUPDR_PULLDOWN(PG15))
1465 
1466 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1467  PIN_ODR_LEVEL_LOW(PG01) | \
1468  PIN_ODR_LEVEL_LOW(PG02) | \
1469  PIN_ODR_LEVEL_LOW(PG03) | \
1470  PIN_ODR_LEVEL_LOW(PG04) | \
1471  PIN_ODR_LEVEL_LOW(PG05) | \
1472  PIN_ODR_LEVEL_LOW(PG06) | \
1473  PIN_ODR_LEVEL_LOW(PG07) | \
1474  PIN_ODR_LEVEL_LOW(PG08) | \
1475  PIN_ODR_LEVEL_LOW(PG09) | \
1476  PIN_ODR_LEVEL_LOW(PG10) | \
1477  PIN_ODR_LEVEL_LOW(PG11) | \
1478  PIN_ODR_LEVEL_LOW(PG12) | \
1479  PIN_ODR_LEVEL_LOW(PG13) | \
1480  PIN_ODR_LEVEL_LOW(PG14) | \
1481  PIN_ODR_LEVEL_LOW(PG15))
1482 
1483 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1484  PIN_AFIO_AF(PG01, 0) | \
1485  PIN_AFIO_AF(PG02, 0) | \
1486  PIN_AFIO_AF(PG03, 0) | \
1487  PIN_AFIO_AF(PG04, 0) | \
1488  PIN_AFIO_AF(PG05, 0) | \
1489  PIN_AFIO_AF(PG06, 0) | \
1490  PIN_AFIO_AF(PG07, 0))
1491 
1492 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1493  PIN_AFIO_AF(PG09, 0) | \
1494  PIN_AFIO_AF(PG10, 0) | \
1495  PIN_AFIO_AF(PG11, 0) | \
1496  PIN_AFIO_AF(PG12, 0) | \
1497  PIN_AFIO_AF(PG13, 0) | \
1498  PIN_AFIO_AF(PG14, 0) | \
1499  PIN_AFIO_AF(PG15, 0))
1500 
1501 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1502  PIN_MODE_ALTERNATE(OSC_OUT) | \
1503  PIN_MODE_INPUT(PH02) | \
1504  PIN_MODE_INPUT(PH03) | \
1505  PIN_MODE_INPUT(PH04) | \
1506  PIN_MODE_INPUT(PH05) | \
1507  PIN_MODE_INPUT(PH06) | \
1508  PIN_MODE_INPUT(PH07) | \
1509  PIN_MODE_INPUT(PH08) | \
1510  PIN_MODE_INPUT(PH09) | \
1511  PIN_MODE_INPUT(PH10) | \
1512  PIN_MODE_INPUT(PH11) | \
1513  PIN_MODE_INPUT(PH12) | \
1514  PIN_MODE_INPUT(PH13) | \
1515  PIN_MODE_INPUT(PH14) | \
1516  PIN_MODE_INPUT(PH15))
1517 
1518 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1519  PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1520  PIN_OTYPE_PUSHPULL(PH02) | \
1521  PIN_OTYPE_PUSHPULL(PH03) | \
1522  PIN_OTYPE_PUSHPULL(PH04) | \
1523  PIN_OTYPE_PUSHPULL(PH05) | \
1524  PIN_OTYPE_PUSHPULL(PH06) | \
1525  PIN_OTYPE_PUSHPULL(PH07) | \
1526  PIN_OTYPE_PUSHPULL(PH08) | \
1527  PIN_OTYPE_PUSHPULL(PH09) | \
1528  PIN_OTYPE_PUSHPULL(PH10) | \
1529  PIN_OTYPE_PUSHPULL(PH11) | \
1530  PIN_OTYPE_PUSHPULL(PH12) | \
1531  PIN_OTYPE_PUSHPULL(PH13) | \
1532  PIN_OTYPE_PUSHPULL(PH14) | \
1533  PIN_OTYPE_PUSHPULL(PH15))
1534 
1535 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1536  PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1537  PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1538  PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1539  PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1540  PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1541  PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1542  PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1543  PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1544  PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1545  PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1546  PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1547  PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1548  PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1549  PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1550  PIN_OSPEED_SPEED_VERYLOW(PH15))
1551 
1552 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1553  PIN_PUPDR_FLOATING(OSC_OUT) | \
1554  PIN_PUPDR_PULLDOWN(PH02) | \
1555  PIN_PUPDR_PULLDOWN(PH03) | \
1556  PIN_PUPDR_PULLDOWN(PH04) | \
1557  PIN_PUPDR_PULLDOWN(PH05) | \
1558  PIN_PUPDR_PULLDOWN(PH06) | \
1559  PIN_PUPDR_PULLDOWN(PH07) | \
1560  PIN_PUPDR_PULLDOWN(PH08) | \
1561  PIN_PUPDR_PULLDOWN(PH09) | \
1562  PIN_PUPDR_PULLDOWN(PH10) | \
1563  PIN_PUPDR_PULLDOWN(PH11) | \
1564  PIN_PUPDR_PULLDOWN(PH12) | \
1565  PIN_PUPDR_PULLDOWN(PH13) | \
1566  PIN_PUPDR_PULLDOWN(PH14) | \
1567  PIN_PUPDR_PULLDOWN(PH15))
1568 
1569 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1570  PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1571  PIN_ODR_LEVEL_LOW(PH02) | \
1572  PIN_ODR_LEVEL_LOW(PH03) | \
1573  PIN_ODR_LEVEL_LOW(PH04) | \
1574  PIN_ODR_LEVEL_LOW(PH05) | \
1575  PIN_ODR_LEVEL_LOW(PH06) | \
1576  PIN_ODR_LEVEL_LOW(PH07) | \
1577  PIN_ODR_LEVEL_LOW(PH08) | \
1578  PIN_ODR_LEVEL_LOW(PH09) | \
1579  PIN_ODR_LEVEL_LOW(PH10) | \
1580  PIN_ODR_LEVEL_LOW(PH11) | \
1581  PIN_ODR_LEVEL_LOW(PH12) | \
1582  PIN_ODR_LEVEL_LOW(PH13) | \
1583  PIN_ODR_LEVEL_LOW(PH14) | \
1584  PIN_ODR_LEVEL_LOW(PH15))
1585 
1586 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1587  PIN_AFIO_AF(OSC_OUT, 0) | \
1588  PIN_AFIO_AF(PH02, 0) | \
1589  PIN_AFIO_AF(PH03, 0) | \
1590  PIN_AFIO_AF(PH04, 0) | \
1591  PIN_AFIO_AF(PH05, 0) | \
1592  PIN_AFIO_AF(PH06, 0) | \
1593  PIN_AFIO_AF(PH07, 0))
1594 
1595 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1596  PIN_AFIO_AF(PH09, 0) | \
1597  PIN_AFIO_AF(PH10, 0) | \
1598  PIN_AFIO_AF(PH11, 0) | \
1599  PIN_AFIO_AF(PH12, 0) | \
1600  PIN_AFIO_AF(PH13, 0) | \
1601  PIN_AFIO_AF(PH14, 0) | \
1602  PIN_AFIO_AF(PH15, 0))
1603 
1604 #define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1605  PIN_MODE_INPUT(PI01) | \
1606  PIN_MODE_INPUT(PI02) | \
1607  PIN_MODE_INPUT(PI03) | \
1608  PIN_MODE_INPUT(PI04) | \
1609  PIN_MODE_INPUT(PI05) | \
1610  PIN_MODE_INPUT(PI06) | \
1611  PIN_MODE_INPUT(PI07) | \
1612  PIN_MODE_INPUT(PI08) | \
1613  PIN_MODE_INPUT(PI09) | \
1614  PIN_MODE_INPUT(PI10) | \
1615  PIN_MODE_INPUT(PI11) | \
1616  PIN_MODE_INPUT(PI12) | \
1617  PIN_MODE_INPUT(PI13) | \
1618  PIN_MODE_INPUT(PI14) | \
1619  PIN_MODE_INPUT(PI15))
1620 
1621 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1622  PIN_OTYPE_PUSHPULL(PI01) | \
1623  PIN_OTYPE_PUSHPULL(PI02) | \
1624  PIN_OTYPE_PUSHPULL(PI03) | \
1625  PIN_OTYPE_PUSHPULL(PI04) | \
1626  PIN_OTYPE_PUSHPULL(PI05) | \
1627  PIN_OTYPE_PUSHPULL(PI06) | \
1628  PIN_OTYPE_PUSHPULL(PI07) | \
1629  PIN_OTYPE_PUSHPULL(PI08) | \
1630  PIN_OTYPE_PUSHPULL(PI09) | \
1631  PIN_OTYPE_PUSHPULL(PI10) | \
1632  PIN_OTYPE_PUSHPULL(PI11) | \
1633  PIN_OTYPE_PUSHPULL(PI12) | \
1634  PIN_OTYPE_PUSHPULL(PI13) | \
1635  PIN_OTYPE_PUSHPULL(PI14) | \
1636  PIN_OTYPE_PUSHPULL(PI15))
1637 
1638 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1639  PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1640  PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1641  PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1642  PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1643  PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1644  PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1645  PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1646  PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1647  PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1648  PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1649  PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1650  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1651  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1652  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1653  PIN_OSPEED_SPEED_VERYLOW(PI15))
1654 
1655 #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1656  PIN_PUPDR_PULLDOWN(PI01) | \
1657  PIN_PUPDR_PULLDOWN(PI02) | \
1658  PIN_PUPDR_PULLDOWN(PI03) | \
1659  PIN_PUPDR_PULLDOWN(PI04) | \
1660  PIN_PUPDR_PULLDOWN(PI05) | \
1661  PIN_PUPDR_PULLDOWN(PI06) | \
1662  PIN_PUPDR_PULLDOWN(PI07) | \
1663  PIN_PUPDR_PULLDOWN(PI08) | \
1664  PIN_PUPDR_PULLDOWN(PI09) | \
1665  PIN_PUPDR_PULLDOWN(PI10) | \
1666  PIN_PUPDR_PULLDOWN(PI11) | \
1667  PIN_PUPDR_PULLDOWN(PI12) | \
1668  PIN_PUPDR_PULLDOWN(PI13) | \
1669  PIN_PUPDR_PULLDOWN(PI14) | \
1670  PIN_PUPDR_PULLDOWN(PI15))
1671 
1672 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1673  PIN_ODR_LEVEL_LOW(PI01) | \
1674  PIN_ODR_LEVEL_LOW(PI02) | \
1675  PIN_ODR_LEVEL_LOW(PI03) | \
1676  PIN_ODR_LEVEL_LOW(PI04) | \
1677  PIN_ODR_LEVEL_LOW(PI05) | \
1678  PIN_ODR_LEVEL_LOW(PI06) | \
1679  PIN_ODR_LEVEL_LOW(PI07) | \
1680  PIN_ODR_LEVEL_LOW(PI08) | \
1681  PIN_ODR_LEVEL_LOW(PI09) | \
1682  PIN_ODR_LEVEL_LOW(PI10) | \
1683  PIN_ODR_LEVEL_LOW(PI11) | \
1684  PIN_ODR_LEVEL_LOW(PI12) | \
1685  PIN_ODR_LEVEL_LOW(PI13) | \
1686  PIN_ODR_LEVEL_LOW(PI14) | \
1687  PIN_ODR_LEVEL_LOW(PI15))
1688 
1689 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1690  PIN_AFIO_AF(PI01, 0) | \
1691  PIN_AFIO_AF(PI02, 0) | \
1692  PIN_AFIO_AF(PI03, 0) | \
1693  PIN_AFIO_AF(PI04, 0) | \
1694  PIN_AFIO_AF(PI05, 0) | \
1695  PIN_AFIO_AF(PI06, 0) | \
1696  PIN_AFIO_AF(PI07, 0))
1697 
1698 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1699  PIN_AFIO_AF(PI09, 0) | \
1700  PIN_AFIO_AF(PI10, 0) | \
1701  PIN_AFIO_AF(PI11, 0) | \
1702  PIN_AFIO_AF(PI12, 0) | \
1703  PIN_AFIO_AF(PI13, 0) | \
1704  PIN_AFIO_AF(PI14, 0) | \
1705  PIN_AFIO_AF(PI15, 0))
1706 
1707 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1708  PIN_MODE_INPUT(PJ01) | \
1709  PIN_MODE_INPUT(PJ02) | \
1710  PIN_MODE_INPUT(PJ03) | \
1711  PIN_MODE_INPUT(PJ04) | \
1712  PIN_MODE_INPUT(PJ05) | \
1713  PIN_MODE_INPUT(PJ06) | \
1714  PIN_MODE_INPUT(PJ07) | \
1715  PIN_MODE_INPUT(PJ08) | \
1716  PIN_MODE_INPUT(PJ09) | \
1717  PIN_MODE_INPUT(PJ10) | \
1718  PIN_MODE_INPUT(PJ11) | \
1719  PIN_MODE_INPUT(PJ12) | \
1720  PIN_MODE_INPUT(PJ13) | \
1721  PIN_MODE_INPUT(PJ14) | \
1722  PIN_MODE_INPUT(PJ15))
1723 
1724 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1725  PIN_OTYPE_PUSHPULL(PJ01) | \
1726  PIN_OTYPE_PUSHPULL(PJ02) | \
1727  PIN_OTYPE_PUSHPULL(PJ03) | \
1728  PIN_OTYPE_PUSHPULL(PJ04) | \
1729  PIN_OTYPE_PUSHPULL(PJ05) | \
1730  PIN_OTYPE_PUSHPULL(PJ06) | \
1731  PIN_OTYPE_PUSHPULL(PJ07) | \
1732  PIN_OTYPE_PUSHPULL(PJ08) | \
1733  PIN_OTYPE_PUSHPULL(PJ09) | \
1734  PIN_OTYPE_PUSHPULL(PJ10) | \
1735  PIN_OTYPE_PUSHPULL(PJ11) | \
1736  PIN_OTYPE_PUSHPULL(PJ12) | \
1737  PIN_OTYPE_PUSHPULL(PJ13) | \
1738  PIN_OTYPE_PUSHPULL(PJ14) | \
1739  PIN_OTYPE_PUSHPULL(PJ15))
1740 
1741 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1742  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1743  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1744  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1745  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1746  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1747  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1748  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1749  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1750  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1751  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1752  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1753  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1754  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1755  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1756  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1757 
1758 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1759  PIN_PUPDR_PULLDOWN(PJ01) | \
1760  PIN_PUPDR_PULLDOWN(PJ02) | \
1761  PIN_PUPDR_PULLDOWN(PJ03) | \
1762  PIN_PUPDR_PULLDOWN(PJ04) | \
1763  PIN_PUPDR_PULLDOWN(PJ05) | \
1764  PIN_PUPDR_PULLDOWN(PJ06) | \
1765  PIN_PUPDR_PULLDOWN(PJ07) | \
1766  PIN_PUPDR_PULLDOWN(PJ08) | \
1767  PIN_PUPDR_PULLDOWN(PJ09) | \
1768  PIN_PUPDR_PULLDOWN(PJ10) | \
1769  PIN_PUPDR_PULLDOWN(PJ11) | \
1770  PIN_PUPDR_PULLDOWN(PJ12) | \
1771  PIN_PUPDR_PULLDOWN(PJ13) | \
1772  PIN_PUPDR_PULLDOWN(PJ14) | \
1773  PIN_PUPDR_PULLDOWN(PJ15))
1774 
1775 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1776  PIN_ODR_LEVEL_LOW(PJ01) | \
1777  PIN_ODR_LEVEL_LOW(PJ02) | \
1778  PIN_ODR_LEVEL_LOW(PJ03) | \
1779  PIN_ODR_LEVEL_LOW(PJ04) | \
1780  PIN_ODR_LEVEL_LOW(PJ05) | \
1781  PIN_ODR_LEVEL_LOW(PJ06) | \
1782  PIN_ODR_LEVEL_LOW(PJ07) | \
1783  PIN_ODR_LEVEL_LOW(PJ08) | \
1784  PIN_ODR_LEVEL_LOW(PJ09) | \
1785  PIN_ODR_LEVEL_LOW(PJ10) | \
1786  PIN_ODR_LEVEL_LOW(PJ11) | \
1787  PIN_ODR_LEVEL_LOW(PJ12) | \
1788  PIN_ODR_LEVEL_LOW(PJ13) | \
1789  PIN_ODR_LEVEL_LOW(PJ14) | \
1790  PIN_ODR_LEVEL_LOW(PJ15))
1791 
1792 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1793  PIN_AFIO_AF(PJ01, 0) | \
1794  PIN_AFIO_AF(PJ02, 0) | \
1795  PIN_AFIO_AF(PJ03, 0) | \
1796  PIN_AFIO_AF(PJ04, 0) | \
1797  PIN_AFIO_AF(PJ05, 0) | \
1798  PIN_AFIO_AF(PJ06, 0) | \
1799  PIN_AFIO_AF(PJ07, 0))
1800 
1801 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1802  PIN_AFIO_AF(PJ09, 0) | \
1803  PIN_AFIO_AF(PJ10, 0) | \
1804  PIN_AFIO_AF(PJ11, 0) | \
1805  PIN_AFIO_AF(PJ12, 0) | \
1806  PIN_AFIO_AF(PJ13, 0) | \
1807  PIN_AFIO_AF(PJ14, 0) | \
1808  PIN_AFIO_AF(PJ15, 0))
1809 
1810 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1811  PIN_MODE_INPUT(PK01) | \
1812  PIN_MODE_INPUT(PK02) | \
1813  PIN_MODE_INPUT(PK03) | \
1814  PIN_MODE_INPUT(PK04) | \
1815  PIN_MODE_INPUT(PK05) | \
1816  PIN_MODE_INPUT(PK06) | \
1817  PIN_MODE_INPUT(PK07) | \
1818  PIN_MODE_INPUT(PK08) | \
1819  PIN_MODE_INPUT(PK09) | \
1820  PIN_MODE_INPUT(PK10) | \
1821  PIN_MODE_INPUT(PK11) | \
1822  PIN_MODE_INPUT(PK12) | \
1823  PIN_MODE_INPUT(PK13) | \
1824  PIN_MODE_INPUT(PK14) | \
1825  PIN_MODE_INPUT(PK15))
1826 
1827 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1828  PIN_OTYPE_PUSHPULL(PK01) | \
1829  PIN_OTYPE_PUSHPULL(PK02) | \
1830  PIN_OTYPE_PUSHPULL(PK03) | \
1831  PIN_OTYPE_PUSHPULL(PK04) | \
1832  PIN_OTYPE_PUSHPULL(PK05) | \
1833  PIN_OTYPE_PUSHPULL(PK06) | \
1834  PIN_OTYPE_PUSHPULL(PK07) | \
1835  PIN_OTYPE_PUSHPULL(PK08) | \
1836  PIN_OTYPE_PUSHPULL(PK09) | \
1837  PIN_OTYPE_PUSHPULL(PK10) | \
1838  PIN_OTYPE_PUSHPULL(PK11) | \
1839  PIN_OTYPE_PUSHPULL(PK12) | \
1840  PIN_OTYPE_PUSHPULL(PK13) | \
1841  PIN_OTYPE_PUSHPULL(PK14) | \
1842  PIN_OTYPE_PUSHPULL(PK15))
1843 
1844 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1845  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1846  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1847  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1848  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1849  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1850  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1851  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1852  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1853  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1854  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1855  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1856  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1857  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1858  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1859  PIN_OSPEED_SPEED_VERYLOW(PK15))
1860 
1861 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1862  PIN_PUPDR_PULLDOWN(PK01) | \
1863  PIN_PUPDR_PULLDOWN(PK02) | \
1864  PIN_PUPDR_PULLDOWN(PK03) | \
1865  PIN_PUPDR_PULLDOWN(PK04) | \
1866  PIN_PUPDR_PULLDOWN(PK05) | \
1867  PIN_PUPDR_PULLDOWN(PK06) | \
1868  PIN_PUPDR_PULLDOWN(PK07) | \
1869  PIN_PUPDR_PULLDOWN(PK08) | \
1870  PIN_PUPDR_PULLDOWN(PK09) | \
1871  PIN_PUPDR_PULLDOWN(PK10) | \
1872  PIN_PUPDR_PULLDOWN(PK11) | \
1873  PIN_PUPDR_PULLDOWN(PK12) | \
1874  PIN_PUPDR_PULLDOWN(PK13) | \
1875  PIN_PUPDR_PULLDOWN(PK14) | \
1876  PIN_PUPDR_PULLDOWN(PK15))
1877 
1878 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1879  PIN_ODR_LEVEL_LOW(PK01) | \
1880  PIN_ODR_LEVEL_LOW(PK02) | \
1881  PIN_ODR_LEVEL_LOW(PK03) | \
1882  PIN_ODR_LEVEL_LOW(PK04) | \
1883  PIN_ODR_LEVEL_LOW(PK05) | \
1884  PIN_ODR_LEVEL_LOW(PK06) | \
1885  PIN_ODR_LEVEL_LOW(PK07) | \
1886  PIN_ODR_LEVEL_LOW(PK08) | \
1887  PIN_ODR_LEVEL_LOW(PK09) | \
1888  PIN_ODR_LEVEL_LOW(PK10) | \
1889  PIN_ODR_LEVEL_LOW(PK11) | \
1890  PIN_ODR_LEVEL_LOW(PK12) | \
1891  PIN_ODR_LEVEL_LOW(PK13) | \
1892  PIN_ODR_LEVEL_LOW(PK14) | \
1893  PIN_ODR_LEVEL_LOW(PK15))
1894 
1895 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1896  PIN_AFIO_AF(PK01, 0) | \
1897  PIN_AFIO_AF(PK02, 0) | \
1898  PIN_AFIO_AF(PK03, 0) | \
1899  PIN_AFIO_AF(PK04, 0) | \
1900  PIN_AFIO_AF(PK05, 0) | \
1901  PIN_AFIO_AF(PK06, 0) | \
1902  PIN_AFIO_AF(PK07, 0))
1903 
1904 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1905  PIN_AFIO_AF(PK09, 0) | \
1906  PIN_AFIO_AF(PK10, 0) | \
1907  PIN_AFIO_AF(PK11, 0) | \
1908  PIN_AFIO_AF(PK12, 0) | \
1909  PIN_AFIO_AF(PK13, 0) | \
1910  PIN_AFIO_AF(PK14, 0) | \
1911  PIN_AFIO_AF(PK15, 0))
1912 
1913 #define AF_UART4_TX 8U
1914 #define AF_LINE_UART4_TX 8U
1915 #define AF_UART4_RX 8U
1916 #define AF_LINE_UART4_RX 8U
1917 #define AF_UART2_RX 7U
1918 #define AF_LINE_UART2_RX 7U
1919 #define AF_SPI1_SCK 5U
1920 #define AF_LINE_SPI1_SCK 5U
1921 #define AF_SPI1_MISO 5U
1922 #define AF_LINE_SPI1_MISO 5U
1923 #define AF_SPI1_MOSI 5U
1924 #define AF_LINE_SPI1_MOSI 5U
1925 #define AF_CU1_CH1 1U
1926 #define AF_LINE_CU1_CH1 1U
1927 #define AF_USART1_RX 7U
1928 #define AF_LINE_USART1_RX 7U
1929 #define AF_OTG_FS_DM 10U
1930 #define AF_LINE_OTG_FS_DM 10U
1931 #define AF_OTG_FS_DP 10U
1932 #define AF_LINE_OTG_FS_DP 10U
1933 #define AF_SWDIO 0U
1934 #define AF_LINE_SWDIO 0U
1935 #define AF_SWCLK 0U
1936 #define AF_LINE_SWCLK 0U
1937 #define AF_USART1_TX 7U
1938 #define AF_LINE_USART1_TX 7U
1939 #define AF_I2C1_SDA 4U
1940 #define AF_LINE_I2C1_SDA 4U
1941 #define AF_I2C1_SCL 4U
1942 #define AF_LINE_I2C1_SCL 4U
1943 #define AF_I2C2_SCL 4U
1944 #define AF_LINE_I2C2_SCL 4U
1945 #define AF_I2C2_SDA 4U
1946 #define AF_LINE_I2C2_SDA 4U
1947 #define AF_USART6_TX 8U
1948 #define AF_LINE_USART6_TX 8U
1949 #define AF_USART6_RX 8U
1950 #define AF_LINE_USART6_RX 8U
1951 #define AF_SDIO_D0 12U
1952 #define AF_LINE_SDIO_D0 12U
1953 #define AF_SDIO_D1 12U
1954 #define AF_LINE_SDIO_D1 12U
1955 #define AF_SDIO_D2 12U
1956 #define AF_LINE_SDIO_D2 12U
1957 #define AF_SDIO_D3 12U
1958 #define AF_LINE_SDIO_D3 12U
1959 #define AF_SDIO_CK 12U
1960 #define AF_LINE_SDIO_CK 12U
1961 #define AF_OSC32_IN 0U
1962 #define AF_LINE_OSC32_IN 0U
1963 #define AF_OSC32_OUT 0U
1964 #define AF_LINE_OSC32_OUT 0U
1965 #define AF_SDIO_CMD 12U
1966 #define AF_LINE_SDIO_CMD 12U
1967 #define AF_OSC_IN 0U
1968 #define AF_LINE_OSC_IN 0U
1969 #define AF_OSC_OUT 0U
1970 #define AF_LINE_OSC_OUT 0U
1971 
1972 
1973 #if !defined(_FROM_ASM_)
1974 #ifdef __cplusplus
1975 extern "C" {
1976 #endif
1977  void boardInit(void);
1978 #ifdef __cplusplus
1979 }
1980 #endif
1981 #endif /* _FROM_ASM_ */
1982 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:261