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