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