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