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