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_PX4FMU
23 #define BOARD_NAME "Pixhawk PX4 FMU v5.0"
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 16000000U
36 #endif
37 
38 /*
39  * Board voltages.
40  * Required for performance limits calculation.
41  */
42 #define STM32_VDD 330U
43 
44 /*
45  * MCU type as defined in the ST header.
46  */
47 #define STM32F767xx
48 
49 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
50 #ifndef ADC_CHANNEL_VSUPPLY
51 #define ADC_CHANNEL_VSUPPLY ADC_1
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/4096.0f) * 10.3208191126f * adc)
61 #define MilliAmpereOfAdc(adc) ((3.3f/4096.0f) * 24000.0f * adc)
62 
63 /* Battery monitoring for file closing */
64 #define SDLOG_BAT_ADC ADCD1
65 #define SDLOG_BAT_CHAN AD1_1_CHANNEL
66 #define SDLOG_USB_LED 3
67 
68 /*
69  * PWM TIM defines
70  * enable TIM 1, 4 and 12 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 #ifndef USE_PWM_TIM12
81 #define USE_PWM_TIM12 1
82 #endif
83 
84 /*
85  * IO pins assignments.
86  */
87 #define PA00_ADC1 0U
88 #define PA01_ADC2 1U
89 #define PA02_ADC3 2U
90 #define PA03_ADC4 3U
91 #define PA04_ADC5 4U
92 #define PA05_FMU_CAP1 5U
93 #define PA06_SPI1_MISO 6U
94 #define PA07_IMU_HEATER 7U
95 #define PA08_CAN3_RX 8U
96 #define PA09_USB_VBUS 9U
97 #define PA10_SERVO2 10U
98 #define PA11_USB_DM 11U
99 #define PA12_USB_DP 12U
100 #define PA13_SWDIO 13U
101 #define PA14_SWCLK 14U
102 #define PA15_CAN3_TX 15U
103 
104 #define PB00_RSSI_IN 0U
105 #define PB01_LED1 1U
106 #define PB02 2U
107 #define PB03_FMU_CAP2 3U
108 #define PB04_DRDY1_ICM20689 4U
109 #define PB05_SPI6_MOSI 5U
110 #define PB06_USART1_TX 6U
111 #define PB07_USART1_RX 7U
112 #define PB08_I2C1_SCL 8U
113 #define PB09_I2C1_SDA 9U
114 #define PB10_SPI5_RESET 10U
115 #define PB11_FMU_CAP3 11U
116 #define PB12_CAN2_RX 12U
117 #define PB13_CAN2_TX 13U
118 #define PB14_DRDY2_BMI055_GYRO 14U
119 #define PB15_DRDY2_BMI055_ACC 15U
120 
121 #define PC00_SCALED_V5 0U
122 #define PC01_SCALED_3V3_SENSORS 1U
123 #define PC02_HW_VER_SENSE 2U
124 #define PC03_HW_REV_SENSE 3U
125 #define PC04_ADC6 4U
126 #define PC05_DRDY4_ICM20602 5U
127 #define PC06_LED2 6U
128 #define PC07_LED3 7U
129 #define PC08_SDIO_D0 8U
130 #define PC09_SDIO_D1 9U
131 #define PC10_SDIO_D2 10U
132 #define PC11_SDIO_D3 11U
133 #define PC12_SDIO_CK 12U
134 #define PC13_DRDY5_BMI055_GYRO 13U
135 #define PC14_OSC32_IN 14U
136 #define PC15_OSC32_OUT 15U
137 
138 #define PD00_UART4_RX 0U
139 #define PD01_UART4_TX 1U
140 #define PD02_SDIO_CMD 2U
141 #define PD03_UART2_CTS 3U
142 #define PD04_UART2_RTS 4U
143 #define PD05_UART2_TX 5U
144 #define PD06_UART2_RX 6U
145 #define PD07_SPI1_MOSI 7U
146 #define PD08_UART3_TX 8U
147 #define PD09_UART3_RX 9U
148 #define PD10_DRDY6_BMI055_ACC 10U
149 #define PD11_UART3_CTS 11U
150 #define PD12_UART3_RTS 12U
151 #define PD13_SERVO5 13U
152 #define PD14_SERVO6 14U
153 #define PD15_DRDY7_EXTERNAL1 15U
154 
155 #define PE00_UART8_RX 0U
156 #define PE01_UART8_TX 1U
157 #define PE02_SPI4_SCK 2U
158 #define PE03_V3V3_SENSORS_EN 3U
159 #define PE04_V3V3_SPEKTRUM_EN 4U
160 #define PE05_BUZZER 5U
161 #define PE06_SPI4_MOSI 6U
162 #define PE07_DRDY8 7U
163 #define PE08_UART7_TX 8U
164 #define PE09_SERVO4 9U
165 #define PE10_SAFETY_SWITCH_IN 10U
166 #define PE11_SERVO3 11U
167 #define PE12_LED4 12U
168 #define PE13_SPI4_MISO 13U
169 #define PE14_SERVO1 14U
170 #define PE15_V5V_PERIPH_OC 15U
171 
172 #define PF00_I2C2_SDA 0U
173 #define PF01_I2C2_SCL 1U
174 #define PF02_SPI_SLAVE0 2U
175 #define PF03_SPI_SLAVE1 3U
176 #define PF04_SPI_SLAVE2 4U
177 #define PF05_SPI_SLAVE3 5U
178 #define PF06_UART7_RX 6U
179 #define PF07_SPI5_SCK 7U
180 #define PF08_SPI5_MISO 8U
181 #define PF09_SPI5_MOSI 9U
182 #define PF10_SPI_SLAVE4 10U
183 #define PF11_SPI_SLAVE5 11U
184 #define PF12_V5V_HIPOWER_EN 12U
185 #define PF13_V5V_HIPOWER_OC 13U
186 #define PF14_I2C4_SCL 14U
187 #define PF15_I2C4_SDA 15U
188 
189 #define PG00_HW_VER_DRIVE 0U
190 #define PG01_POWER_IN_A 1U
191 #define PG02_POWER_IN_B 2U
192 #define PG03_POWER_IN_C 3U
193 #define PG04_V5V_PERIPH_EN 4U
194 #define PG05_V5V_RC_EN 5U
195 #define PG06_V5V_WIFI_EN 6U
196 #define PG07_V3V3_SD_CARD_EN 7U
197 #define PG08_USART6_RTS 8U
198 #define PG09_USART6_RX 9U
199 #define PG10_SPI_SLAVE6 10U
200 #define PG11_SPI1_SCK 11U
201 #define PG12_SPI6_MISO 12U
202 #define PG13_SPI6_SCK 13U
203 #define PG14_USART6_TX 14U
204 #define PG15_USART6_CTS 15U
205 
206 #define PH00_OSC_IN 0U
207 #define PH01_OSC_OUT 1U
208 #define PH02_CAN1_SILENT_S0 2U
209 #define PH03_CAN2_SILENT_S1 3U
210 #define PH04_CAN3_SILENT_S2 4U
211 #define PH05_SPI_SLAVE7 5U
212 #define PH06_SERVO7 6U
213 #define PH07_I2C3_SCL 7U
214 #define PH08_I2C3_SDA 8U
215 #define PH09_SERVO8 9U
216 #define PH10_LED5 10U
217 #define PH11_LED6 11U
218 #define PH12_LED7 12U
219 #define PH13_CAN1_TX 13U
220 #define PH14_HW_REV_DRIVE 14U
221 #define PH15_SPI5_SYNC 15U
222 
223 #define PI00_ARMED 0U
224 #define PI01_SPI2_SCK 1U
225 #define PI02_SPI2_MISO 2U
226 #define PI03_SPI2_MOSI 3U
227 #define PI04_SPI_SLAVE8 4U
228 #define PI05_PWM_INPUT1 5U
229 #define PI06_SPI_SLAVE9 6U
230 #define PI07_SPI_SLAVE10 7U
231 #define PI08_SPI_SLAVE11 8U
232 #define PI09_CAN1_RX 9U
233 #define PI10_SPI_SLAVE12 10U
234 #define PI11_SPI_SLAVE13 11U
235 #define PI12 12U
236 #define PI13 13U
237 #define PI14 14U
238 #define PI15 15U
239 
240 #define PJ00 0U
241 #define PJ01 1U
242 #define PJ02 2U
243 #define PJ03 3U
244 #define PJ04 4U
245 #define PJ05 5U
246 #define PJ06 6U
247 #define PJ07 7U
248 #define PJ08 8U
249 #define PJ09 9U
250 #define PJ10 10U
251 #define PJ11 11U
252 #define PJ12 12U
253 #define PJ13 13U
254 #define PJ14 14U
255 #define PJ15 15U
256 
257 #define PK00 0U
258 #define PK01 1U
259 #define PK02 2U
260 #define PK03 3U
261 #define PK04 4U
262 #define PK05 5U
263 #define PK06 6U
264 #define PK07 7U
265 #define PK08 8U
266 #define PK09 9U
267 #define PK10 10U
268 #define PK11 11U
269 #define PK12 12U
270 #define PK13 13U
271 #define PK14 14U
272 #define PK15 15U
273 
274 /*
275  * IO lines assignments.
276  */
277 #define LINE_ADC1 PAL_LINE(GPIOA, 0U)
278 #define LINE_ADC2 PAL_LINE(GPIOA, 1U)
279 #define LINE_ADC3 PAL_LINE(GPIOA, 2U)
280 #define LINE_ADC4 PAL_LINE(GPIOA, 3U)
281 #define LINE_ADC5 PAL_LINE(GPIOA, 4U)
282 #define LINE_FMU_CAP1 PAL_LINE(GPIOA, 5U)
283 #define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
284 #define LINE_IMU_HEATER PAL_LINE(GPIOA, 7U)
285 #define LINE_CAN3_RX PAL_LINE(GPIOA, 8U)
286 #define LINE_USB_VBUS PAL_LINE(GPIOA, 9U)
287 #define LINE_SERVO2 PAL_LINE(GPIOA, 10U)
288 #define LINE_USB_DM PAL_LINE(GPIOA, 11U)
289 #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
290 #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
291 #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
292 #define LINE_CAN3_TX PAL_LINE(GPIOA, 15U)
293 
294 #define LINE_RSSI_IN PAL_LINE(GPIOB, 0U)
295 #define LINE_LED1 PAL_LINE(GPIOB, 1U)
296 #define LINE_FMU_CAP2 PAL_LINE(GPIOB, 3U)
297 #define LINE_DRDY1_ICM20689 PAL_LINE(GPIOB, 4U)
298 #define LINE_SPI6_MOSI PAL_LINE(GPIOB, 5U)
299 #define LINE_USART1_TX PAL_LINE(GPIOB, 6U)
300 #define LINE_USART1_RX PAL_LINE(GPIOB, 7U)
301 #define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
302 #define LINE_I2C1_SDA PAL_LINE(GPIOB, 9U)
303 #define LINE_SPI5_RESET PAL_LINE(GPIOB, 10U)
304 #define LINE_FMU_CAP3 PAL_LINE(GPIOB, 11U)
305 #define LINE_CAN2_RX PAL_LINE(GPIOB, 12U)
306 #define LINE_CAN2_TX PAL_LINE(GPIOB, 13U)
307 #define LINE_DRDY2_BMI055_GYRO PAL_LINE(GPIOB, 14U)
308 #define LINE_DRDY2_BMI055_ACC PAL_LINE(GPIOB, 15U)
309 
310 #define LINE_SCALED_V5 PAL_LINE(GPIOC, 0U)
311 #define LINE_SCALED_3V3_SENSORS PAL_LINE(GPIOC, 1U)
312 #define LINE_HW_VER_SENSE PAL_LINE(GPIOC, 2U)
313 #define LINE_HW_REV_SENSE PAL_LINE(GPIOC, 3U)
314 #define LINE_ADC6 PAL_LINE(GPIOC, 4U)
315 #define LINE_DRDY4_ICM20602 PAL_LINE(GPIOC, 5U)
316 #define LINE_LED2 PAL_LINE(GPIOC, 6U)
317 #define LINE_LED3 PAL_LINE(GPIOC, 7U)
318 #define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
319 #define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
320 #define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
321 #define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
322 #define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
323 #define LINE_DRDY5_BMI055_GYRO PAL_LINE(GPIOC, 13U)
324 #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
325 #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
326 
327 #define LINE_UART4_RX PAL_LINE(GPIOD, 0U)
328 #define LINE_UART4_TX PAL_LINE(GPIOD, 1U)
329 #define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
330 #define LINE_UART2_CTS PAL_LINE(GPIOD, 3U)
331 #define LINE_UART2_RTS PAL_LINE(GPIOD, 4U)
332 #define LINE_UART2_TX PAL_LINE(GPIOD, 5U)
333 #define LINE_UART2_RX PAL_LINE(GPIOD, 6U)
334 #define LINE_SPI1_MOSI PAL_LINE(GPIOD, 7U)
335 #define LINE_UART3_TX PAL_LINE(GPIOD, 8U)
336 #define LINE_UART3_RX PAL_LINE(GPIOD, 9U)
337 #define LINE_DRDY6_BMI055_ACC PAL_LINE(GPIOD, 10U)
338 #define LINE_UART3_CTS PAL_LINE(GPIOD, 11U)
339 #define LINE_UART3_RTS PAL_LINE(GPIOD, 12U)
340 #define LINE_SERVO5 PAL_LINE(GPIOD, 13U)
341 #define LINE_SERVO6 PAL_LINE(GPIOD, 14U)
342 #define LINE_DRDY7_EXTERNAL1 PAL_LINE(GPIOD, 15U)
343 
344 #define LINE_UART8_RX PAL_LINE(GPIOE, 0U)
345 #define LINE_UART8_TX PAL_LINE(GPIOE, 1U)
346 #define LINE_SPI4_SCK PAL_LINE(GPIOE, 2U)
347 #define LINE_V3V3_SENSORS_EN PAL_LINE(GPIOE, 3U)
348 #define LINE_V3V3_SPEKTRUM_EN PAL_LINE(GPIOE, 4U)
349 #define LINE_BUZZER PAL_LINE(GPIOE, 5U)
350 #define LINE_SPI4_MOSI PAL_LINE(GPIOE, 6U)
351 #define LINE_DRDY8 PAL_LINE(GPIOE, 7U)
352 #define LINE_UART7_TX PAL_LINE(GPIOE, 8U)
353 #define LINE_SERVO4 PAL_LINE(GPIOE, 9U)
354 #define LINE_SAFETY_SWITCH_IN PAL_LINE(GPIOE, 10U)
355 #define LINE_SERVO3 PAL_LINE(GPIOE, 11U)
356 #define LINE_LED4 PAL_LINE(GPIOE, 12U)
357 #define LINE_SPI4_MISO PAL_LINE(GPIOE, 13U)
358 #define LINE_SERVO1 PAL_LINE(GPIOE, 14U)
359 #define LINE_V5V_PERIPH_OC PAL_LINE(GPIOE, 15U)
360 
361 #define LINE_I2C2_SDA PAL_LINE(GPIOF, 0U)
362 #define LINE_I2C2_SCL PAL_LINE(GPIOF, 1U)
363 #define LINE_SPI_SLAVE0 PAL_LINE(GPIOF, 2U)
364 #define LINE_SPI_SLAVE1 PAL_LINE(GPIOF, 3U)
365 #define LINE_SPI_SLAVE2 PAL_LINE(GPIOF, 4U)
366 #define LINE_SPI_SLAVE3 PAL_LINE(GPIOF, 5U)
367 #define LINE_UART7_RX PAL_LINE(GPIOF, 6U)
368 #define LINE_SPI5_SCK PAL_LINE(GPIOF, 7U)
369 #define LINE_SPI5_MISO PAL_LINE(GPIOF, 8U)
370 #define LINE_SPI5_MOSI PAL_LINE(GPIOF, 9U)
371 #define LINE_SPI_SLAVE4 PAL_LINE(GPIOF, 10U)
372 #define LINE_SPI_SLAVE5 PAL_LINE(GPIOF, 11U)
373 #define LINE_V5V_HIPOWER_EN PAL_LINE(GPIOF, 12U)
374 #define LINE_V5V_HIPOWER_OC PAL_LINE(GPIOF, 13U)
375 #define LINE_I2C4_SCL PAL_LINE(GPIOF, 14U)
376 #define LINE_I2C4_SDA PAL_LINE(GPIOF, 15U)
377 
378 #define LINE_HW_VER_DRIVE PAL_LINE(GPIOG, 0U)
379 #define LINE_POWER_IN_A PAL_LINE(GPIOG, 1U)
380 #define LINE_POWER_IN_B PAL_LINE(GPIOG, 2U)
381 #define LINE_POWER_IN_C PAL_LINE(GPIOG, 3U)
382 #define LINE_V5V_PERIPH_EN PAL_LINE(GPIOG, 4U)
383 #define LINE_V5V_RC_EN PAL_LINE(GPIOG, 5U)
384 #define LINE_V5V_WIFI_EN PAL_LINE(GPIOG, 6U)
385 #define LINE_V3V3_SD_CARD_EN PAL_LINE(GPIOG, 7U)
386 #define LINE_USART6_RTS PAL_LINE(GPIOG, 8U)
387 #define LINE_USART6_RX PAL_LINE(GPIOG, 9U)
388 #define LINE_SPI_SLAVE6 PAL_LINE(GPIOG, 10U)
389 #define LINE_SPI1_SCK PAL_LINE(GPIOG, 11U)
390 #define LINE_SPI6_MISO PAL_LINE(GPIOG, 12U)
391 #define LINE_SPI6_SCK PAL_LINE(GPIOG, 13U)
392 #define LINE_USART6_TX PAL_LINE(GPIOG, 14U)
393 #define LINE_USART6_CTS PAL_LINE(GPIOG, 15U)
394 
395 #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
396 #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
397 #define LINE_CAN1_SILENT_S0 PAL_LINE(GPIOH, 2U)
398 #define LINE_CAN2_SILENT_S1 PAL_LINE(GPIOH, 3U)
399 #define LINE_CAN3_SILENT_S2 PAL_LINE(GPIOH, 4U)
400 #define LINE_SPI_SLAVE7 PAL_LINE(GPIOH, 5U)
401 #define LINE_SERVO7 PAL_LINE(GPIOH, 6U)
402 #define LINE_I2C3_SCL PAL_LINE(GPIOH, 7U)
403 #define LINE_I2C3_SDA PAL_LINE(GPIOH, 8U)
404 #define LINE_SERVO8 PAL_LINE(GPIOH, 9U)
405 #define LINE_LED5 PAL_LINE(GPIOH, 10U)
406 #define LINE_LED6 PAL_LINE(GPIOH, 11U)
407 #define LINE_LED7 PAL_LINE(GPIOH, 12U)
408 #define LINE_CAN1_TX PAL_LINE(GPIOH, 13U)
409 #define LINE_HW_REV_DRIVE PAL_LINE(GPIOH, 14U)
410 #define LINE_SPI5_SYNC PAL_LINE(GPIOH, 15U)
411 
412 #define LINE_ARMED PAL_LINE(GPIOI, 0U)
413 #define LINE_SPI2_SCK PAL_LINE(GPIOI, 1U)
414 #define LINE_SPI2_MISO PAL_LINE(GPIOI, 2U)
415 #define LINE_SPI2_MOSI PAL_LINE(GPIOI, 3U)
416 #define LINE_SPI_SLAVE8 PAL_LINE(GPIOI, 4U)
417 #define LINE_PWM_INPUT1 PAL_LINE(GPIOI, 5U)
418 #define LINE_SPI_SLAVE9 PAL_LINE(GPIOI, 6U)
419 #define LINE_SPI_SLAVE10 PAL_LINE(GPIOI, 7U)
420 #define LINE_SPI_SLAVE11 PAL_LINE(GPIOI, 8U)
421 #define LINE_CAN1_RX PAL_LINE(GPIOI, 9U)
422 #define LINE_SPI_SLAVE12 PAL_LINE(GPIOI, 10U)
423 #define LINE_SPI_SLAVE13 PAL_LINE(GPIOI, 11U)
424 
425 
426 /*
427  * I/O ports initial setup, this configuration is established soon after reset
428  * in the initialization code.
429  * Please refer to the STM32 Reference Manual for details.
430  */
431 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
432 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
433 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
434 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
435 #define PIN_ODR_LEVEL_LOW(n) (0U << (n))
436 #define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
437 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
438 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
439 #define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
440 #define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
441 #define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
442 #define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
443 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
444 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
445 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
446 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
447 
448 #define VAL_GPIOA_MODER (PIN_MODE_ANALOG(PA00_ADC1) | \
449  PIN_MODE_ANALOG(PA01_ADC2) | \
450  PIN_MODE_ANALOG(PA02_ADC3) | \
451  PIN_MODE_ANALOG(PA03_ADC4) | \
452  PIN_MODE_ANALOG(PA04_ADC5) | \
453  PIN_MODE_INPUT(PA05_FMU_CAP1) | \
454  PIN_MODE_ALTERNATE(PA06_SPI1_MISO) | \
455  PIN_MODE_OUTPUT(PA07_IMU_HEATER) | \
456  PIN_MODE_ALTERNATE(PA08_CAN3_RX) | \
457  PIN_MODE_INPUT(PA09_USB_VBUS) | \
458  PIN_MODE_ALTERNATE(PA10_SERVO2) | \
459  PIN_MODE_ALTERNATE(PA11_USB_DM) | \
460  PIN_MODE_ALTERNATE(PA12_USB_DP) | \
461  PIN_MODE_ALTERNATE(PA13_SWDIO) | \
462  PIN_MODE_ALTERNATE(PA14_SWCLK) | \
463  PIN_MODE_ALTERNATE(PA15_CAN3_TX))
464 
465 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(PA00_ADC1) | \
466  PIN_OTYPE_PUSHPULL(PA01_ADC2) | \
467  PIN_OTYPE_PUSHPULL(PA02_ADC3) | \
468  PIN_OTYPE_PUSHPULL(PA03_ADC4) | \
469  PIN_OTYPE_PUSHPULL(PA04_ADC5) | \
470  PIN_OTYPE_OPENDRAIN(PA05_FMU_CAP1) | \
471  PIN_OTYPE_PUSHPULL(PA06_SPI1_MISO) | \
472  PIN_OTYPE_PUSHPULL(PA07_IMU_HEATER) | \
473  PIN_OTYPE_PUSHPULL(PA08_CAN3_RX) | \
474  PIN_OTYPE_OPENDRAIN(PA09_USB_VBUS) | \
475  PIN_OTYPE_PUSHPULL(PA10_SERVO2) | \
476  PIN_OTYPE_PUSHPULL(PA11_USB_DM) | \
477  PIN_OTYPE_PUSHPULL(PA12_USB_DP) | \
478  PIN_OTYPE_PUSHPULL(PA13_SWDIO) | \
479  PIN_OTYPE_PUSHPULL(PA14_SWCLK) | \
480  PIN_OTYPE_PUSHPULL(PA15_CAN3_TX))
481 
482 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PA00_ADC1) | \
483  PIN_OSPEED_SPEED_VERYLOW(PA01_ADC2) | \
484  PIN_OSPEED_SPEED_VERYLOW(PA02_ADC3) | \
485  PIN_OSPEED_SPEED_VERYLOW(PA03_ADC4) | \
486  PIN_OSPEED_SPEED_VERYLOW(PA04_ADC5) | \
487  PIN_OSPEED_SPEED_VERYLOW(PA05_FMU_CAP1) | \
488  PIN_OSPEED_SPEED_HIGH(PA06_SPI1_MISO) | \
489  PIN_OSPEED_SPEED_HIGH(PA07_IMU_HEATER) | \
490  PIN_OSPEED_SPEED_HIGH(PA08_CAN3_RX) | \
491  PIN_OSPEED_SPEED_VERYLOW(PA09_USB_VBUS) | \
492  PIN_OSPEED_SPEED_HIGH(PA10_SERVO2) | \
493  PIN_OSPEED_SPEED_HIGH(PA11_USB_DM) | \
494  PIN_OSPEED_SPEED_HIGH(PA12_USB_DP) | \
495  PIN_OSPEED_SPEED_HIGH(PA13_SWDIO) | \
496  PIN_OSPEED_SPEED_HIGH(PA14_SWCLK) | \
497  PIN_OSPEED_SPEED_HIGH(PA15_CAN3_TX))
498 
499 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(PA00_ADC1) | \
500  PIN_PUPDR_FLOATING(PA01_ADC2) | \
501  PIN_PUPDR_FLOATING(PA02_ADC3) | \
502  PIN_PUPDR_FLOATING(PA03_ADC4) | \
503  PIN_PUPDR_FLOATING(PA04_ADC5) | \
504  PIN_PUPDR_PULLDOWN(PA05_FMU_CAP1) | \
505  PIN_PUPDR_FLOATING(PA06_SPI1_MISO) | \
506  PIN_PUPDR_FLOATING(PA07_IMU_HEATER) | \
507  PIN_PUPDR_FLOATING(PA08_CAN3_RX) | \
508  PIN_PUPDR_PULLDOWN(PA09_USB_VBUS) | \
509  PIN_PUPDR_FLOATING(PA10_SERVO2) | \
510  PIN_PUPDR_FLOATING(PA11_USB_DM) | \
511  PIN_PUPDR_FLOATING(PA12_USB_DP) | \
512  PIN_PUPDR_FLOATING(PA13_SWDIO) | \
513  PIN_PUPDR_FLOATING(PA14_SWCLK) | \
514  PIN_PUPDR_FLOATING(PA15_CAN3_TX))
515 
516 #define VAL_GPIOA_ODR (PIN_ODR_LEVEL_LOW(PA00_ADC1) | \
517  PIN_ODR_LEVEL_LOW(PA01_ADC2) | \
518  PIN_ODR_LEVEL_LOW(PA02_ADC3) | \
519  PIN_ODR_LEVEL_LOW(PA03_ADC4) | \
520  PIN_ODR_LEVEL_LOW(PA04_ADC5) | \
521  PIN_ODR_LEVEL_HIGH(PA05_FMU_CAP1) | \
522  PIN_ODR_LEVEL_HIGH(PA06_SPI1_MISO) | \
523  PIN_ODR_LEVEL_LOW(PA07_IMU_HEATER) | \
524  PIN_ODR_LEVEL_HIGH(PA08_CAN3_RX) | \
525  PIN_ODR_LEVEL_LOW(PA09_USB_VBUS) | \
526  PIN_ODR_LEVEL_LOW(PA10_SERVO2) | \
527  PIN_ODR_LEVEL_HIGH(PA11_USB_DM) | \
528  PIN_ODR_LEVEL_HIGH(PA12_USB_DP) | \
529  PIN_ODR_LEVEL_HIGH(PA13_SWDIO) | \
530  PIN_ODR_LEVEL_HIGH(PA14_SWCLK) | \
531  PIN_ODR_LEVEL_HIGH(PA15_CAN3_TX))
532 
533 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(PA00_ADC1, 0) | \
534  PIN_AFIO_AF(PA01_ADC2, 0) | \
535  PIN_AFIO_AF(PA02_ADC3, 0) | \
536  PIN_AFIO_AF(PA03_ADC4, 0) | \
537  PIN_AFIO_AF(PA04_ADC5, 0) | \
538  PIN_AFIO_AF(PA05_FMU_CAP1, 0) | \
539  PIN_AFIO_AF(PA06_SPI1_MISO, 5) | \
540  PIN_AFIO_AF(PA07_IMU_HEATER, 0))
541 
542 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(PA08_CAN3_RX, 11) | \
543  PIN_AFIO_AF(PA09_USB_VBUS, 0) | \
544  PIN_AFIO_AF(PA10_SERVO2, 1) | \
545  PIN_AFIO_AF(PA11_USB_DM, 10) | \
546  PIN_AFIO_AF(PA12_USB_DP, 10) | \
547  PIN_AFIO_AF(PA13_SWDIO, 0) | \
548  PIN_AFIO_AF(PA14_SWCLK, 0) | \
549  PIN_AFIO_AF(PA15_CAN3_TX, 11))
550 
551 #define VAL_GPIOB_MODER (PIN_MODE_ANALOG(PB00_RSSI_IN) | \
552  PIN_MODE_OUTPUT(PB01_LED1) | \
553  PIN_MODE_INPUT(PB02) | \
554  PIN_MODE_INPUT(PB03_FMU_CAP2) | \
555  PIN_MODE_INPUT(PB04_DRDY1_ICM20689) | \
556  PIN_MODE_ALTERNATE(PB05_SPI6_MOSI) | \
557  PIN_MODE_ALTERNATE(PB06_USART1_TX) | \
558  PIN_MODE_ALTERNATE(PB07_USART1_RX) | \
559  PIN_MODE_ALTERNATE(PB08_I2C1_SCL) | \
560  PIN_MODE_ALTERNATE(PB09_I2C1_SDA) | \
561  PIN_MODE_INPUT(PB10_SPI5_RESET) | \
562  PIN_MODE_INPUT(PB11_FMU_CAP3) | \
563  PIN_MODE_ALTERNATE(PB12_CAN2_RX) | \
564  PIN_MODE_ALTERNATE(PB13_CAN2_TX) | \
565  PIN_MODE_INPUT(PB14_DRDY2_BMI055_GYRO) | \
566  PIN_MODE_INPUT(PB15_DRDY2_BMI055_ACC))
567 
568 #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(PB00_RSSI_IN) | \
569  PIN_OTYPE_PUSHPULL(PB01_LED1) | \
570  PIN_OTYPE_PUSHPULL(PB02) | \
571  PIN_OTYPE_OPENDRAIN(PB03_FMU_CAP2) | \
572  PIN_OTYPE_OPENDRAIN(PB04_DRDY1_ICM20689) | \
573  PIN_OTYPE_PUSHPULL(PB05_SPI6_MOSI) | \
574  PIN_OTYPE_PUSHPULL(PB06_USART1_TX) | \
575  PIN_OTYPE_PUSHPULL(PB07_USART1_RX) | \
576  PIN_OTYPE_OPENDRAIN(PB08_I2C1_SCL) | \
577  PIN_OTYPE_OPENDRAIN(PB09_I2C1_SDA) | \
578  PIN_OTYPE_OPENDRAIN(PB10_SPI5_RESET) | \
579  PIN_OTYPE_OPENDRAIN(PB11_FMU_CAP3) | \
580  PIN_OTYPE_PUSHPULL(PB12_CAN2_RX) | \
581  PIN_OTYPE_PUSHPULL(PB13_CAN2_TX) | \
582  PIN_OTYPE_OPENDRAIN(PB14_DRDY2_BMI055_GYRO) | \
583  PIN_OTYPE_OPENDRAIN(PB15_DRDY2_BMI055_ACC))
584 
585 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PB00_RSSI_IN) | \
586  PIN_OSPEED_SPEED_VERYLOW(PB01_LED1) | \
587  PIN_OSPEED_SPEED_VERYLOW(PB02) | \
588  PIN_OSPEED_SPEED_VERYLOW(PB03_FMU_CAP2) | \
589  PIN_OSPEED_SPEED_VERYLOW(PB04_DRDY1_ICM20689) | \
590  PIN_OSPEED_SPEED_HIGH(PB05_SPI6_MOSI) | \
591  PIN_OSPEED_SPEED_HIGH(PB06_USART1_TX) | \
592  PIN_OSPEED_SPEED_HIGH(PB07_USART1_RX) | \
593  PIN_OSPEED_SPEED_HIGH(PB08_I2C1_SCL) | \
594  PIN_OSPEED_SPEED_HIGH(PB09_I2C1_SDA) | \
595  PIN_OSPEED_SPEED_VERYLOW(PB10_SPI5_RESET) | \
596  PIN_OSPEED_SPEED_VERYLOW(PB11_FMU_CAP3) | \
597  PIN_OSPEED_SPEED_HIGH(PB12_CAN2_RX) | \
598  PIN_OSPEED_SPEED_HIGH(PB13_CAN2_TX) | \
599  PIN_OSPEED_SPEED_VERYLOW(PB14_DRDY2_BMI055_GYRO) | \
600  PIN_OSPEED_SPEED_VERYLOW(PB15_DRDY2_BMI055_ACC))
601 
602 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(PB00_RSSI_IN) | \
603  PIN_PUPDR_FLOATING(PB01_LED1) | \
604  PIN_PUPDR_PULLDOWN(PB02) | \
605  PIN_PUPDR_PULLDOWN(PB03_FMU_CAP2) | \
606  PIN_PUPDR_PULLDOWN(PB04_DRDY1_ICM20689) | \
607  PIN_PUPDR_FLOATING(PB05_SPI6_MOSI) | \
608  PIN_PUPDR_FLOATING(PB06_USART1_TX) | \
609  PIN_PUPDR_FLOATING(PB07_USART1_RX) | \
610  PIN_PUPDR_PULLUP(PB08_I2C1_SCL) | \
611  PIN_PUPDR_PULLUP(PB09_I2C1_SDA) | \
612  PIN_PUPDR_PULLDOWN(PB10_SPI5_RESET) | \
613  PIN_PUPDR_PULLDOWN(PB11_FMU_CAP3) | \
614  PIN_PUPDR_FLOATING(PB12_CAN2_RX) | \
615  PIN_PUPDR_FLOATING(PB13_CAN2_TX) | \
616  PIN_PUPDR_PULLDOWN(PB14_DRDY2_BMI055_GYRO) | \
617  PIN_PUPDR_PULLDOWN(PB15_DRDY2_BMI055_ACC))
618 
619 #define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(PB00_RSSI_IN) | \
620  PIN_ODR_LEVEL_LOW(PB01_LED1) | \
621  PIN_ODR_LEVEL_LOW(PB02) | \
622  PIN_ODR_LEVEL_HIGH(PB03_FMU_CAP2) | \
623  PIN_ODR_LEVEL_HIGH(PB04_DRDY1_ICM20689) | \
624  PIN_ODR_LEVEL_HIGH(PB05_SPI6_MOSI) | \
625  PIN_ODR_LEVEL_HIGH(PB06_USART1_TX) | \
626  PIN_ODR_LEVEL_HIGH(PB07_USART1_RX) | \
627  PIN_ODR_LEVEL_HIGH(PB08_I2C1_SCL) | \
628  PIN_ODR_LEVEL_HIGH(PB09_I2C1_SDA) | \
629  PIN_ODR_LEVEL_HIGH(PB10_SPI5_RESET) | \
630  PIN_ODR_LEVEL_HIGH(PB11_FMU_CAP3) | \
631  PIN_ODR_LEVEL_HIGH(PB12_CAN2_RX) | \
632  PIN_ODR_LEVEL_HIGH(PB13_CAN2_TX) | \
633  PIN_ODR_LEVEL_HIGH(PB14_DRDY2_BMI055_GYRO) | \
634  PIN_ODR_LEVEL_HIGH(PB15_DRDY2_BMI055_ACC))
635 
636 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(PB00_RSSI_IN, 0) | \
637  PIN_AFIO_AF(PB01_LED1, 0) | \
638  PIN_AFIO_AF(PB02, 0) | \
639  PIN_AFIO_AF(PB03_FMU_CAP2, 0) | \
640  PIN_AFIO_AF(PB04_DRDY1_ICM20689, 0) | \
641  PIN_AFIO_AF(PB05_SPI6_MOSI, 8) | \
642  PIN_AFIO_AF(PB06_USART1_TX, 7) | \
643  PIN_AFIO_AF(PB07_USART1_RX, 7))
644 
645 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(PB08_I2C1_SCL, 4) | \
646  PIN_AFIO_AF(PB09_I2C1_SDA, 4) | \
647  PIN_AFIO_AF(PB10_SPI5_RESET, 0) | \
648  PIN_AFIO_AF(PB11_FMU_CAP3, 0) | \
649  PIN_AFIO_AF(PB12_CAN2_RX, 9) | \
650  PIN_AFIO_AF(PB13_CAN2_TX, 9) | \
651  PIN_AFIO_AF(PB14_DRDY2_BMI055_GYRO, 0) | \
652  PIN_AFIO_AF(PB15_DRDY2_BMI055_ACC, 0))
653 
654 #define VAL_GPIOC_MODER (PIN_MODE_ANALOG(PC00_SCALED_V5) | \
655  PIN_MODE_ANALOG(PC01_SCALED_3V3_SENSORS) | \
656  PIN_MODE_ANALOG(PC02_HW_VER_SENSE) | \
657  PIN_MODE_ANALOG(PC03_HW_REV_SENSE) | \
658  PIN_MODE_ANALOG(PC04_ADC6) | \
659  PIN_MODE_INPUT(PC05_DRDY4_ICM20602) | \
660  PIN_MODE_OUTPUT(PC06_LED2) | \
661  PIN_MODE_OUTPUT(PC07_LED3) | \
662  PIN_MODE_ALTERNATE(PC08_SDIO_D0) | \
663  PIN_MODE_ALTERNATE(PC09_SDIO_D1) | \
664  PIN_MODE_ALTERNATE(PC10_SDIO_D2) | \
665  PIN_MODE_ALTERNATE(PC11_SDIO_D3) | \
666  PIN_MODE_ALTERNATE(PC12_SDIO_CK) | \
667  PIN_MODE_INPUT(PC13_DRDY5_BMI055_GYRO) | \
668  PIN_MODE_ALTERNATE(PC14_OSC32_IN) | \
669  PIN_MODE_ALTERNATE(PC15_OSC32_OUT))
670 
671 #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(PC00_SCALED_V5) | \
672  PIN_OTYPE_PUSHPULL(PC01_SCALED_3V3_SENSORS) | \
673  PIN_OTYPE_PUSHPULL(PC02_HW_VER_SENSE) | \
674  PIN_OTYPE_PUSHPULL(PC03_HW_REV_SENSE) | \
675  PIN_OTYPE_PUSHPULL(PC04_ADC6) | \
676  PIN_OTYPE_OPENDRAIN(PC05_DRDY4_ICM20602) | \
677  PIN_OTYPE_PUSHPULL(PC06_LED2) | \
678  PIN_OTYPE_PUSHPULL(PC07_LED3) | \
679  PIN_OTYPE_PUSHPULL(PC08_SDIO_D0) | \
680  PIN_OTYPE_PUSHPULL(PC09_SDIO_D1) | \
681  PIN_OTYPE_PUSHPULL(PC10_SDIO_D2) | \
682  PIN_OTYPE_PUSHPULL(PC11_SDIO_D3) | \
683  PIN_OTYPE_PUSHPULL(PC12_SDIO_CK) | \
684  PIN_OTYPE_OPENDRAIN(PC13_DRDY5_BMI055_GYRO) | \
685  PIN_OTYPE_PUSHPULL(PC14_OSC32_IN) | \
686  PIN_OTYPE_PUSHPULL(PC15_OSC32_OUT))
687 
688 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PC00_SCALED_V5) | \
689  PIN_OSPEED_SPEED_VERYLOW(PC01_SCALED_3V3_SENSORS) | \
690  PIN_OSPEED_SPEED_VERYLOW(PC02_HW_VER_SENSE) | \
691  PIN_OSPEED_SPEED_VERYLOW(PC03_HW_REV_SENSE) | \
692  PIN_OSPEED_SPEED_VERYLOW(PC04_ADC6) | \
693  PIN_OSPEED_SPEED_VERYLOW(PC05_DRDY4_ICM20602) | \
694  PIN_OSPEED_SPEED_VERYLOW(PC06_LED2) | \
695  PIN_OSPEED_SPEED_VERYLOW(PC07_LED3) | \
696  PIN_OSPEED_SPEED_HIGH(PC08_SDIO_D0) | \
697  PIN_OSPEED_SPEED_HIGH(PC09_SDIO_D1) | \
698  PIN_OSPEED_SPEED_HIGH(PC10_SDIO_D2) | \
699  PIN_OSPEED_SPEED_HIGH(PC11_SDIO_D3) | \
700  PIN_OSPEED_SPEED_HIGH(PC12_SDIO_CK) | \
701  PIN_OSPEED_SPEED_VERYLOW(PC13_DRDY5_BMI055_GYRO) | \
702  PIN_OSPEED_SPEED_HIGH(PC14_OSC32_IN) | \
703  PIN_OSPEED_SPEED_HIGH(PC15_OSC32_OUT))
704 
705 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(PC00_SCALED_V5) | \
706  PIN_PUPDR_FLOATING(PC01_SCALED_3V3_SENSORS) | \
707  PIN_PUPDR_FLOATING(PC02_HW_VER_SENSE) | \
708  PIN_PUPDR_FLOATING(PC03_HW_REV_SENSE) | \
709  PIN_PUPDR_FLOATING(PC04_ADC6) | \
710  PIN_PUPDR_PULLDOWN(PC05_DRDY4_ICM20602) | \
711  PIN_PUPDR_FLOATING(PC06_LED2) | \
712  PIN_PUPDR_FLOATING(PC07_LED3) | \
713  PIN_PUPDR_PULLUP(PC08_SDIO_D0) | \
714  PIN_PUPDR_PULLUP(PC09_SDIO_D1) | \
715  PIN_PUPDR_PULLUP(PC10_SDIO_D2) | \
716  PIN_PUPDR_PULLUP(PC11_SDIO_D3) | \
717  PIN_PUPDR_PULLUP(PC12_SDIO_CK) | \
718  PIN_PUPDR_PULLDOWN(PC13_DRDY5_BMI055_GYRO) | \
719  PIN_PUPDR_FLOATING(PC14_OSC32_IN) | \
720  PIN_PUPDR_FLOATING(PC15_OSC32_OUT))
721 
722 #define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(PC00_SCALED_V5) | \
723  PIN_ODR_LEVEL_LOW(PC01_SCALED_3V3_SENSORS) | \
724  PIN_ODR_LEVEL_LOW(PC02_HW_VER_SENSE) | \
725  PIN_ODR_LEVEL_LOW(PC03_HW_REV_SENSE) | \
726  PIN_ODR_LEVEL_LOW(PC04_ADC6) | \
727  PIN_ODR_LEVEL_HIGH(PC05_DRDY4_ICM20602) | \
728  PIN_ODR_LEVEL_LOW(PC06_LED2) | \
729  PIN_ODR_LEVEL_LOW(PC07_LED3) | \
730  PIN_ODR_LEVEL_HIGH(PC08_SDIO_D0) | \
731  PIN_ODR_LEVEL_HIGH(PC09_SDIO_D1) | \
732  PIN_ODR_LEVEL_HIGH(PC10_SDIO_D2) | \
733  PIN_ODR_LEVEL_HIGH(PC11_SDIO_D3) | \
734  PIN_ODR_LEVEL_HIGH(PC12_SDIO_CK) | \
735  PIN_ODR_LEVEL_HIGH(PC13_DRDY5_BMI055_GYRO) | \
736  PIN_ODR_LEVEL_HIGH(PC14_OSC32_IN) | \
737  PIN_ODR_LEVEL_HIGH(PC15_OSC32_OUT))
738 
739 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(PC00_SCALED_V5, 0) | \
740  PIN_AFIO_AF(PC01_SCALED_3V3_SENSORS, 0) | \
741  PIN_AFIO_AF(PC02_HW_VER_SENSE, 0) | \
742  PIN_AFIO_AF(PC03_HW_REV_SENSE, 0) | \
743  PIN_AFIO_AF(PC04_ADC6, 0) | \
744  PIN_AFIO_AF(PC05_DRDY4_ICM20602, 0) | \
745  PIN_AFIO_AF(PC06_LED2, 0) | \
746  PIN_AFIO_AF(PC07_LED3, 0))
747 
748 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(PC08_SDIO_D0, 12) | \
749  PIN_AFIO_AF(PC09_SDIO_D1, 12) | \
750  PIN_AFIO_AF(PC10_SDIO_D2, 12) | \
751  PIN_AFIO_AF(PC11_SDIO_D3, 12) | \
752  PIN_AFIO_AF(PC12_SDIO_CK, 12) | \
753  PIN_AFIO_AF(PC13_DRDY5_BMI055_GYRO, 0) | \
754  PIN_AFIO_AF(PC14_OSC32_IN, 0) | \
755  PIN_AFIO_AF(PC15_OSC32_OUT, 0))
756 
757 #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(PD00_UART4_RX) | \
758  PIN_MODE_ALTERNATE(PD01_UART4_TX) | \
759  PIN_MODE_ALTERNATE(PD02_SDIO_CMD) | \
760  PIN_MODE_INPUT(PD03_UART2_CTS) | \
761  PIN_MODE_INPUT(PD04_UART2_RTS) | \
762  PIN_MODE_ALTERNATE(PD05_UART2_TX) | \
763  PIN_MODE_ALTERNATE(PD06_UART2_RX) | \
764  PIN_MODE_ALTERNATE(PD07_SPI1_MOSI) | \
765  PIN_MODE_ALTERNATE(PD08_UART3_TX) | \
766  PIN_MODE_ALTERNATE(PD09_UART3_RX) | \
767  PIN_MODE_INPUT(PD10_DRDY6_BMI055_ACC) | \
768  PIN_MODE_INPUT(PD11_UART3_CTS) | \
769  PIN_MODE_INPUT(PD12_UART3_RTS) | \
770  PIN_MODE_ALTERNATE(PD13_SERVO5) | \
771  PIN_MODE_ALTERNATE(PD14_SERVO6) | \
772  PIN_MODE_INPUT(PD15_DRDY7_EXTERNAL1))
773 
774 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00_UART4_RX) | \
775  PIN_OTYPE_PUSHPULL(PD01_UART4_TX) | \
776  PIN_OTYPE_PUSHPULL(PD02_SDIO_CMD) | \
777  PIN_OTYPE_OPENDRAIN(PD03_UART2_CTS) | \
778  PIN_OTYPE_OPENDRAIN(PD04_UART2_RTS) | \
779  PIN_OTYPE_PUSHPULL(PD05_UART2_TX) | \
780  PIN_OTYPE_PUSHPULL(PD06_UART2_RX) | \
781  PIN_OTYPE_PUSHPULL(PD07_SPI1_MOSI) | \
782  PIN_OTYPE_PUSHPULL(PD08_UART3_TX) | \
783  PIN_OTYPE_PUSHPULL(PD09_UART3_RX) | \
784  PIN_OTYPE_OPENDRAIN(PD10_DRDY6_BMI055_ACC) | \
785  PIN_OTYPE_OPENDRAIN(PD11_UART3_CTS) | \
786  PIN_OTYPE_OPENDRAIN(PD12_UART3_RTS) | \
787  PIN_OTYPE_PUSHPULL(PD13_SERVO5) | \
788  PIN_OTYPE_PUSHPULL(PD14_SERVO6) | \
789  PIN_OTYPE_OPENDRAIN(PD15_DRDY7_EXTERNAL1))
790 
791 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PD00_UART4_RX) | \
792  PIN_OSPEED_SPEED_HIGH(PD01_UART4_TX) | \
793  PIN_OSPEED_SPEED_HIGH(PD02_SDIO_CMD) | \
794  PIN_OSPEED_SPEED_VERYLOW(PD03_UART2_CTS) | \
795  PIN_OSPEED_SPEED_VERYLOW(PD04_UART2_RTS) | \
796  PIN_OSPEED_SPEED_HIGH(PD05_UART2_TX) | \
797  PIN_OSPEED_SPEED_HIGH(PD06_UART2_RX) | \
798  PIN_OSPEED_SPEED_HIGH(PD07_SPI1_MOSI) | \
799  PIN_OSPEED_SPEED_HIGH(PD08_UART3_TX) | \
800  PIN_OSPEED_SPEED_HIGH(PD09_UART3_RX) | \
801  PIN_OSPEED_SPEED_VERYLOW(PD10_DRDY6_BMI055_ACC) | \
802  PIN_OSPEED_SPEED_VERYLOW(PD11_UART3_CTS) | \
803  PIN_OSPEED_SPEED_VERYLOW(PD12_UART3_RTS) | \
804  PIN_OSPEED_SPEED_HIGH(PD13_SERVO5) | \
805  PIN_OSPEED_SPEED_HIGH(PD14_SERVO6) | \
806  PIN_OSPEED_SPEED_VERYLOW(PD15_DRDY7_EXTERNAL1))
807 
808 #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(PD00_UART4_RX) | \
809  PIN_PUPDR_FLOATING(PD01_UART4_TX) | \
810  PIN_PUPDR_PULLUP(PD02_SDIO_CMD) | \
811  PIN_PUPDR_PULLDOWN(PD03_UART2_CTS) | \
812  PIN_PUPDR_PULLDOWN(PD04_UART2_RTS) | \
813  PIN_PUPDR_FLOATING(PD05_UART2_TX) | \
814  PIN_PUPDR_FLOATING(PD06_UART2_RX) | \
815  PIN_PUPDR_FLOATING(PD07_SPI1_MOSI) | \
816  PIN_PUPDR_FLOATING(PD08_UART3_TX) | \
817  PIN_PUPDR_FLOATING(PD09_UART3_RX) | \
818  PIN_PUPDR_PULLDOWN(PD10_DRDY6_BMI055_ACC) | \
819  PIN_PUPDR_PULLDOWN(PD11_UART3_CTS) | \
820  PIN_PUPDR_PULLDOWN(PD12_UART3_RTS) | \
821  PIN_PUPDR_FLOATING(PD13_SERVO5) | \
822  PIN_PUPDR_FLOATING(PD14_SERVO6) | \
823  PIN_PUPDR_PULLDOWN(PD15_DRDY7_EXTERNAL1))
824 
825 #define VAL_GPIOD_ODR (PIN_ODR_LEVEL_HIGH(PD00_UART4_RX) | \
826  PIN_ODR_LEVEL_HIGH(PD01_UART4_TX) | \
827  PIN_ODR_LEVEL_HIGH(PD02_SDIO_CMD) | \
828  PIN_ODR_LEVEL_HIGH(PD03_UART2_CTS) | \
829  PIN_ODR_LEVEL_HIGH(PD04_UART2_RTS) | \
830  PIN_ODR_LEVEL_HIGH(PD05_UART2_TX) | \
831  PIN_ODR_LEVEL_HIGH(PD06_UART2_RX) | \
832  PIN_ODR_LEVEL_HIGH(PD07_SPI1_MOSI) | \
833  PIN_ODR_LEVEL_HIGH(PD08_UART3_TX) | \
834  PIN_ODR_LEVEL_HIGH(PD09_UART3_RX) | \
835  PIN_ODR_LEVEL_HIGH(PD10_DRDY6_BMI055_ACC) | \
836  PIN_ODR_LEVEL_HIGH(PD11_UART3_CTS) | \
837  PIN_ODR_LEVEL_HIGH(PD12_UART3_RTS) | \
838  PIN_ODR_LEVEL_LOW(PD13_SERVO5) | \
839  PIN_ODR_LEVEL_LOW(PD14_SERVO6) | \
840  PIN_ODR_LEVEL_HIGH(PD15_DRDY7_EXTERNAL1))
841 
842 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00_UART4_RX, 8) | \
843  PIN_AFIO_AF(PD01_UART4_TX, 8) | \
844  PIN_AFIO_AF(PD02_SDIO_CMD, 12) | \
845  PIN_AFIO_AF(PD03_UART2_CTS, 0) | \
846  PIN_AFIO_AF(PD04_UART2_RTS, 0) | \
847  PIN_AFIO_AF(PD05_UART2_TX, 7) | \
848  PIN_AFIO_AF(PD06_UART2_RX, 7) | \
849  PIN_AFIO_AF(PD07_SPI1_MOSI, 5))
850 
851 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08_UART3_TX, 7) | \
852  PIN_AFIO_AF(PD09_UART3_RX, 7) | \
853  PIN_AFIO_AF(PD10_DRDY6_BMI055_ACC, 0) | \
854  PIN_AFIO_AF(PD11_UART3_CTS, 0) | \
855  PIN_AFIO_AF(PD12_UART3_RTS, 0) | \
856  PIN_AFIO_AF(PD13_SERVO5, 2) | \
857  PIN_AFIO_AF(PD14_SERVO6, 2) | \
858  PIN_AFIO_AF(PD15_DRDY7_EXTERNAL1, 0))
859 
860 #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(PE00_UART8_RX) | \
861  PIN_MODE_ALTERNATE(PE01_UART8_TX) | \
862  PIN_MODE_ALTERNATE(PE02_SPI4_SCK) | \
863  PIN_MODE_OUTPUT(PE03_V3V3_SENSORS_EN) | \
864  PIN_MODE_OUTPUT(PE04_V3V3_SPEKTRUM_EN) | \
865  PIN_MODE_INPUT(PE05_BUZZER) | \
866  PIN_MODE_ALTERNATE(PE06_SPI4_MOSI) | \
867  PIN_MODE_INPUT(PE07_DRDY8) | \
868  PIN_MODE_ALTERNATE(PE08_UART7_TX) | \
869  PIN_MODE_ALTERNATE(PE09_SERVO4) | \
870  PIN_MODE_INPUT(PE10_SAFETY_SWITCH_IN) | \
871  PIN_MODE_ALTERNATE(PE11_SERVO3) | \
872  PIN_MODE_OUTPUT(PE12_LED4) | \
873  PIN_MODE_ALTERNATE(PE13_SPI4_MISO) | \
874  PIN_MODE_ALTERNATE(PE14_SERVO1) | \
875  PIN_MODE_INPUT(PE15_V5V_PERIPH_OC))
876 
877 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00_UART8_RX) | \
878  PIN_OTYPE_PUSHPULL(PE01_UART8_TX) | \
879  PIN_OTYPE_PUSHPULL(PE02_SPI4_SCK) | \
880  PIN_OTYPE_PUSHPULL(PE03_V3V3_SENSORS_EN) | \
881  PIN_OTYPE_PUSHPULL(PE04_V3V3_SPEKTRUM_EN) | \
882  PIN_OTYPE_OPENDRAIN(PE05_BUZZER) | \
883  PIN_OTYPE_PUSHPULL(PE06_SPI4_MOSI) | \
884  PIN_OTYPE_OPENDRAIN(PE07_DRDY8) | \
885  PIN_OTYPE_PUSHPULL(PE08_UART7_TX) | \
886  PIN_OTYPE_PUSHPULL(PE09_SERVO4) | \
887  PIN_OTYPE_OPENDRAIN(PE10_SAFETY_SWITCH_IN) | \
888  PIN_OTYPE_PUSHPULL(PE11_SERVO3) | \
889  PIN_OTYPE_PUSHPULL(PE12_LED4) | \
890  PIN_OTYPE_PUSHPULL(PE13_SPI4_MISO) | \
891  PIN_OTYPE_PUSHPULL(PE14_SERVO1) | \
892  PIN_OTYPE_OPENDRAIN(PE15_V5V_PERIPH_OC))
893 
894 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PE00_UART8_RX) | \
895  PIN_OSPEED_SPEED_HIGH(PE01_UART8_TX) | \
896  PIN_OSPEED_SPEED_HIGH(PE02_SPI4_SCK) | \
897  PIN_OSPEED_SPEED_VERYLOW(PE03_V3V3_SENSORS_EN) | \
898  PIN_OSPEED_SPEED_VERYLOW(PE04_V3V3_SPEKTRUM_EN) | \
899  PIN_OSPEED_SPEED_VERYLOW(PE05_BUZZER) | \
900  PIN_OSPEED_SPEED_HIGH(PE06_SPI4_MOSI) | \
901  PIN_OSPEED_SPEED_VERYLOW(PE07_DRDY8) | \
902  PIN_OSPEED_SPEED_HIGH(PE08_UART7_TX) | \
903  PIN_OSPEED_SPEED_HIGH(PE09_SERVO4) | \
904  PIN_OSPEED_SPEED_VERYLOW(PE10_SAFETY_SWITCH_IN) | \
905  PIN_OSPEED_SPEED_HIGH(PE11_SERVO3) | \
906  PIN_OSPEED_SPEED_VERYLOW(PE12_LED4) | \
907  PIN_OSPEED_SPEED_HIGH(PE13_SPI4_MISO) | \
908  PIN_OSPEED_SPEED_HIGH(PE14_SERVO1) | \
909  PIN_OSPEED_SPEED_VERYLOW(PE15_V5V_PERIPH_OC))
910 
911 #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(PE00_UART8_RX) | \
912  PIN_PUPDR_FLOATING(PE01_UART8_TX) | \
913  PIN_PUPDR_FLOATING(PE02_SPI4_SCK) | \
914  PIN_PUPDR_FLOATING(PE03_V3V3_SENSORS_EN) | \
915  PIN_PUPDR_FLOATING(PE04_V3V3_SPEKTRUM_EN) | \
916  PIN_PUPDR_PULLDOWN(PE05_BUZZER) | \
917  PIN_PUPDR_FLOATING(PE06_SPI4_MOSI) | \
918  PIN_PUPDR_PULLDOWN(PE07_DRDY8) | \
919  PIN_PUPDR_FLOATING(PE08_UART7_TX) | \
920  PIN_PUPDR_FLOATING(PE09_SERVO4) | \
921  PIN_PUPDR_PULLDOWN(PE10_SAFETY_SWITCH_IN) | \
922  PIN_PUPDR_FLOATING(PE11_SERVO3) | \
923  PIN_PUPDR_FLOATING(PE12_LED4) | \
924  PIN_PUPDR_FLOATING(PE13_SPI4_MISO) | \
925  PIN_PUPDR_FLOATING(PE14_SERVO1) | \
926  PIN_PUPDR_PULLDOWN(PE15_V5V_PERIPH_OC))
927 
928 #define VAL_GPIOE_ODR (PIN_ODR_LEVEL_HIGH(PE00_UART8_RX) | \
929  PIN_ODR_LEVEL_HIGH(PE01_UART8_TX) | \
930  PIN_ODR_LEVEL_HIGH(PE02_SPI4_SCK) | \
931  PIN_ODR_LEVEL_HIGH(PE03_V3V3_SENSORS_EN) | \
932  PIN_ODR_LEVEL_HIGH(PE04_V3V3_SPEKTRUM_EN) | \
933  PIN_ODR_LEVEL_HIGH(PE05_BUZZER) | \
934  PIN_ODR_LEVEL_HIGH(PE06_SPI4_MOSI) | \
935  PIN_ODR_LEVEL_HIGH(PE07_DRDY8) | \
936  PIN_ODR_LEVEL_HIGH(PE08_UART7_TX) | \
937  PIN_ODR_LEVEL_LOW(PE09_SERVO4) | \
938  PIN_ODR_LEVEL_LOW(PE10_SAFETY_SWITCH_IN) | \
939  PIN_ODR_LEVEL_LOW(PE11_SERVO3) | \
940  PIN_ODR_LEVEL_LOW(PE12_LED4) | \
941  PIN_ODR_LEVEL_HIGH(PE13_SPI4_MISO) | \
942  PIN_ODR_LEVEL_LOW(PE14_SERVO1) | \
943  PIN_ODR_LEVEL_HIGH(PE15_V5V_PERIPH_OC))
944 
945 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00_UART8_RX, 8) | \
946  PIN_AFIO_AF(PE01_UART8_TX, 8) | \
947  PIN_AFIO_AF(PE02_SPI4_SCK, 5) | \
948  PIN_AFIO_AF(PE03_V3V3_SENSORS_EN, 0) | \
949  PIN_AFIO_AF(PE04_V3V3_SPEKTRUM_EN, 0) | \
950  PIN_AFIO_AF(PE05_BUZZER, 0) | \
951  PIN_AFIO_AF(PE06_SPI4_MOSI, 5) | \
952  PIN_AFIO_AF(PE07_DRDY8, 0))
953 
954 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(PE08_UART7_TX, 8) | \
955  PIN_AFIO_AF(PE09_SERVO4, 1) | \
956  PIN_AFIO_AF(PE10_SAFETY_SWITCH_IN, 0) | \
957  PIN_AFIO_AF(PE11_SERVO3, 1) | \
958  PIN_AFIO_AF(PE12_LED4, 0) | \
959  PIN_AFIO_AF(PE13_SPI4_MISO, 5) | \
960  PIN_AFIO_AF(PE14_SERVO1, 1) | \
961  PIN_AFIO_AF(PE15_V5V_PERIPH_OC, 0))
962 
963 #define VAL_GPIOF_MODER (PIN_MODE_ALTERNATE(PF00_I2C2_SDA) | \
964  PIN_MODE_ALTERNATE(PF01_I2C2_SCL) | \
965  PIN_MODE_OUTPUT(PF02_SPI_SLAVE0) | \
966  PIN_MODE_OUTPUT(PF03_SPI_SLAVE1) | \
967  PIN_MODE_OUTPUT(PF04_SPI_SLAVE2) | \
968  PIN_MODE_OUTPUT(PF05_SPI_SLAVE3) | \
969  PIN_MODE_ALTERNATE(PF06_UART7_RX) | \
970  PIN_MODE_ALTERNATE(PF07_SPI5_SCK) | \
971  PIN_MODE_ALTERNATE(PF08_SPI5_MISO) | \
972  PIN_MODE_ALTERNATE(PF09_SPI5_MOSI) | \
973  PIN_MODE_OUTPUT(PF10_SPI_SLAVE4) | \
974  PIN_MODE_OUTPUT(PF11_SPI_SLAVE5) | \
975  PIN_MODE_OUTPUT(PF12_V5V_HIPOWER_EN) | \
976  PIN_MODE_INPUT(PF13_V5V_HIPOWER_OC) | \
977  PIN_MODE_ALTERNATE(PF14_I2C4_SCL) | \
978  PIN_MODE_ALTERNATE(PF15_I2C4_SDA))
979 
980 #define VAL_GPIOF_OTYPER (PIN_OTYPE_OPENDRAIN(PF00_I2C2_SDA) | \
981  PIN_OTYPE_OPENDRAIN(PF01_I2C2_SCL) | \
982  PIN_OTYPE_PUSHPULL(PF02_SPI_SLAVE0) | \
983  PIN_OTYPE_PUSHPULL(PF03_SPI_SLAVE1) | \
984  PIN_OTYPE_PUSHPULL(PF04_SPI_SLAVE2) | \
985  PIN_OTYPE_PUSHPULL(PF05_SPI_SLAVE3) | \
986  PIN_OTYPE_PUSHPULL(PF06_UART7_RX) | \
987  PIN_OTYPE_PUSHPULL(PF07_SPI5_SCK) | \
988  PIN_OTYPE_PUSHPULL(PF08_SPI5_MISO) | \
989  PIN_OTYPE_PUSHPULL(PF09_SPI5_MOSI) | \
990  PIN_OTYPE_PUSHPULL(PF10_SPI_SLAVE4) | \
991  PIN_OTYPE_PUSHPULL(PF11_SPI_SLAVE5) | \
992  PIN_OTYPE_PUSHPULL(PF12_V5V_HIPOWER_EN) | \
993  PIN_OTYPE_OPENDRAIN(PF13_V5V_HIPOWER_OC) | \
994  PIN_OTYPE_OPENDRAIN(PF14_I2C4_SCL) | \
995  PIN_OTYPE_OPENDRAIN(PF15_I2C4_SDA))
996 
997 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PF00_I2C2_SDA) | \
998  PIN_OSPEED_SPEED_HIGH(PF01_I2C2_SCL) | \
999  PIN_OSPEED_SPEED_HIGH(PF02_SPI_SLAVE0) | \
1000  PIN_OSPEED_SPEED_HIGH(PF03_SPI_SLAVE1) | \
1001  PIN_OSPEED_SPEED_HIGH(PF04_SPI_SLAVE2) | \
1002  PIN_OSPEED_SPEED_HIGH(PF05_SPI_SLAVE3) | \
1003  PIN_OSPEED_SPEED_HIGH(PF06_UART7_RX) | \
1004  PIN_OSPEED_SPEED_HIGH(PF07_SPI5_SCK) | \
1005  PIN_OSPEED_SPEED_HIGH(PF08_SPI5_MISO) | \
1006  PIN_OSPEED_SPEED_HIGH(PF09_SPI5_MOSI) | \
1007  PIN_OSPEED_SPEED_HIGH(PF10_SPI_SLAVE4) | \
1008  PIN_OSPEED_SPEED_HIGH(PF11_SPI_SLAVE5) | \
1009  PIN_OSPEED_SPEED_VERYLOW(PF12_V5V_HIPOWER_EN) | \
1010  PIN_OSPEED_SPEED_VERYLOW(PF13_V5V_HIPOWER_OC) | \
1011  PIN_OSPEED_SPEED_HIGH(PF14_I2C4_SCL) | \
1012  PIN_OSPEED_SPEED_HIGH(PF15_I2C4_SDA))
1013 
1014 #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(PF00_I2C2_SDA) | \
1015  PIN_PUPDR_PULLUP(PF01_I2C2_SCL) | \
1016  PIN_PUPDR_FLOATING(PF02_SPI_SLAVE0) | \
1017  PIN_PUPDR_FLOATING(PF03_SPI_SLAVE1) | \
1018  PIN_PUPDR_FLOATING(PF04_SPI_SLAVE2) | \
1019  PIN_PUPDR_FLOATING(PF05_SPI_SLAVE3) | \
1020  PIN_PUPDR_FLOATING(PF06_UART7_RX) | \
1021  PIN_PUPDR_FLOATING(PF07_SPI5_SCK) | \
1022  PIN_PUPDR_FLOATING(PF08_SPI5_MISO) | \
1023  PIN_PUPDR_FLOATING(PF09_SPI5_MOSI) | \
1024  PIN_PUPDR_FLOATING(PF10_SPI_SLAVE4) | \
1025  PIN_PUPDR_FLOATING(PF11_SPI_SLAVE5) | \
1026  PIN_PUPDR_FLOATING(PF12_V5V_HIPOWER_EN) | \
1027  PIN_PUPDR_PULLDOWN(PF13_V5V_HIPOWER_OC) | \
1028  PIN_PUPDR_PULLUP(PF14_I2C4_SCL) | \
1029  PIN_PUPDR_PULLUP(PF15_I2C4_SDA))
1030 
1031 #define VAL_GPIOF_ODR (PIN_ODR_LEVEL_HIGH(PF00_I2C2_SDA) | \
1032  PIN_ODR_LEVEL_HIGH(PF01_I2C2_SCL) | \
1033  PIN_ODR_LEVEL_HIGH(PF02_SPI_SLAVE0) | \
1034  PIN_ODR_LEVEL_HIGH(PF03_SPI_SLAVE1) | \
1035  PIN_ODR_LEVEL_HIGH(PF04_SPI_SLAVE2) | \
1036  PIN_ODR_LEVEL_HIGH(PF05_SPI_SLAVE3) | \
1037  PIN_ODR_LEVEL_HIGH(PF06_UART7_RX) | \
1038  PIN_ODR_LEVEL_HIGH(PF07_SPI5_SCK) | \
1039  PIN_ODR_LEVEL_HIGH(PF08_SPI5_MISO) | \
1040  PIN_ODR_LEVEL_HIGH(PF09_SPI5_MOSI) | \
1041  PIN_ODR_LEVEL_HIGH(PF10_SPI_SLAVE4) | \
1042  PIN_ODR_LEVEL_HIGH(PF11_SPI_SLAVE5) | \
1043  PIN_ODR_LEVEL_LOW(PF12_V5V_HIPOWER_EN) | \
1044  PIN_ODR_LEVEL_HIGH(PF13_V5V_HIPOWER_OC) | \
1045  PIN_ODR_LEVEL_HIGH(PF14_I2C4_SCL) | \
1046  PIN_ODR_LEVEL_HIGH(PF15_I2C4_SDA))
1047 
1048 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00_I2C2_SDA, 4) | \
1049  PIN_AFIO_AF(PF01_I2C2_SCL, 4) | \
1050  PIN_AFIO_AF(PF02_SPI_SLAVE0, 0) | \
1051  PIN_AFIO_AF(PF03_SPI_SLAVE1, 0) | \
1052  PIN_AFIO_AF(PF04_SPI_SLAVE2, 0) | \
1053  PIN_AFIO_AF(PF05_SPI_SLAVE3, 0) | \
1054  PIN_AFIO_AF(PF06_UART7_RX, 8) | \
1055  PIN_AFIO_AF(PF07_SPI5_SCK, 5))
1056 
1057 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08_SPI5_MISO, 5) | \
1058  PIN_AFIO_AF(PF09_SPI5_MOSI, 5) | \
1059  PIN_AFIO_AF(PF10_SPI_SLAVE4, 0) | \
1060  PIN_AFIO_AF(PF11_SPI_SLAVE5, 0) | \
1061  PIN_AFIO_AF(PF12_V5V_HIPOWER_EN, 0) | \
1062  PIN_AFIO_AF(PF13_V5V_HIPOWER_OC, 0) | \
1063  PIN_AFIO_AF(PF14_I2C4_SCL, 4) | \
1064  PIN_AFIO_AF(PF15_I2C4_SDA, 4))
1065 
1066 #define VAL_GPIOG_MODER (PIN_MODE_OUTPUT(PG00_HW_VER_DRIVE) | \
1067  PIN_MODE_INPUT(PG01_POWER_IN_A) | \
1068  PIN_MODE_INPUT(PG02_POWER_IN_B) | \
1069  PIN_MODE_INPUT(PG03_POWER_IN_C) | \
1070  PIN_MODE_OUTPUT(PG04_V5V_PERIPH_EN) | \
1071  PIN_MODE_OUTPUT(PG05_V5V_RC_EN) | \
1072  PIN_MODE_OUTPUT(PG06_V5V_WIFI_EN) | \
1073  PIN_MODE_OUTPUT(PG07_V3V3_SD_CARD_EN) | \
1074  PIN_MODE_INPUT(PG08_USART6_RTS) | \
1075  PIN_MODE_ALTERNATE(PG09_USART6_RX) | \
1076  PIN_MODE_OUTPUT(PG10_SPI_SLAVE6) | \
1077  PIN_MODE_ALTERNATE(PG11_SPI1_SCK) | \
1078  PIN_MODE_ALTERNATE(PG12_SPI6_MISO) | \
1079  PIN_MODE_ALTERNATE(PG13_SPI6_SCK) | \
1080  PIN_MODE_ALTERNATE(PG14_USART6_TX) | \
1081  PIN_MODE_INPUT(PG15_USART6_CTS))
1082 
1083 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00_HW_VER_DRIVE) | \
1084  PIN_OTYPE_OPENDRAIN(PG01_POWER_IN_A) | \
1085  PIN_OTYPE_OPENDRAIN(PG02_POWER_IN_B) | \
1086  PIN_OTYPE_OPENDRAIN(PG03_POWER_IN_C) | \
1087  PIN_OTYPE_PUSHPULL(PG04_V5V_PERIPH_EN) | \
1088  PIN_OTYPE_PUSHPULL(PG05_V5V_RC_EN) | \
1089  PIN_OTYPE_PUSHPULL(PG06_V5V_WIFI_EN) | \
1090  PIN_OTYPE_PUSHPULL(PG07_V3V3_SD_CARD_EN) | \
1091  PIN_OTYPE_OPENDRAIN(PG08_USART6_RTS) | \
1092  PIN_OTYPE_PUSHPULL(PG09_USART6_RX) | \
1093  PIN_OTYPE_PUSHPULL(PG10_SPI_SLAVE6) | \
1094  PIN_OTYPE_PUSHPULL(PG11_SPI1_SCK) | \
1095  PIN_OTYPE_PUSHPULL(PG12_SPI6_MISO) | \
1096  PIN_OTYPE_PUSHPULL(PG13_SPI6_SCK) | \
1097  PIN_OTYPE_PUSHPULL(PG14_USART6_TX) | \
1098  PIN_OTYPE_OPENDRAIN(PG15_USART6_CTS))
1099 
1100 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00_HW_VER_DRIVE) | \
1101  PIN_OSPEED_SPEED_VERYLOW(PG01_POWER_IN_A) | \
1102  PIN_OSPEED_SPEED_VERYLOW(PG02_POWER_IN_B) | \
1103  PIN_OSPEED_SPEED_VERYLOW(PG03_POWER_IN_C) | \
1104  PIN_OSPEED_SPEED_VERYLOW(PG04_V5V_PERIPH_EN) | \
1105  PIN_OSPEED_SPEED_VERYLOW(PG05_V5V_RC_EN) | \
1106  PIN_OSPEED_SPEED_VERYLOW(PG06_V5V_WIFI_EN) | \
1107  PIN_OSPEED_SPEED_VERYLOW(PG07_V3V3_SD_CARD_EN) | \
1108  PIN_OSPEED_SPEED_VERYLOW(PG08_USART6_RTS) | \
1109  PIN_OSPEED_SPEED_HIGH(PG09_USART6_RX) | \
1110  PIN_OSPEED_SPEED_HIGH(PG10_SPI_SLAVE6) | \
1111  PIN_OSPEED_SPEED_HIGH(PG11_SPI1_SCK) | \
1112  PIN_OSPEED_SPEED_HIGH(PG12_SPI6_MISO) | \
1113  PIN_OSPEED_SPEED_HIGH(PG13_SPI6_SCK) | \
1114  PIN_OSPEED_SPEED_HIGH(PG14_USART6_TX) | \
1115  PIN_OSPEED_SPEED_VERYLOW(PG15_USART6_CTS))
1116 
1117 #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(PG00_HW_VER_DRIVE) | \
1118  PIN_PUPDR_PULLDOWN(PG01_POWER_IN_A) | \
1119  PIN_PUPDR_PULLDOWN(PG02_POWER_IN_B) | \
1120  PIN_PUPDR_PULLDOWN(PG03_POWER_IN_C) | \
1121  PIN_PUPDR_FLOATING(PG04_V5V_PERIPH_EN) | \
1122  PIN_PUPDR_FLOATING(PG05_V5V_RC_EN) | \
1123  PIN_PUPDR_FLOATING(PG06_V5V_WIFI_EN) | \
1124  PIN_PUPDR_FLOATING(PG07_V3V3_SD_CARD_EN) | \
1125  PIN_PUPDR_PULLDOWN(PG08_USART6_RTS) | \
1126  PIN_PUPDR_FLOATING(PG09_USART6_RX) | \
1127  PIN_PUPDR_FLOATING(PG10_SPI_SLAVE6) | \
1128  PIN_PUPDR_FLOATING(PG11_SPI1_SCK) | \
1129  PIN_PUPDR_FLOATING(PG12_SPI6_MISO) | \
1130  PIN_PUPDR_FLOATING(PG13_SPI6_SCK) | \
1131  PIN_PUPDR_FLOATING(PG14_USART6_TX) | \
1132  PIN_PUPDR_PULLDOWN(PG15_USART6_CTS))
1133 
1134 #define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00_HW_VER_DRIVE) | \
1135  PIN_ODR_LEVEL_HIGH(PG01_POWER_IN_A) | \
1136  PIN_ODR_LEVEL_HIGH(PG02_POWER_IN_B) | \
1137  PIN_ODR_LEVEL_HIGH(PG03_POWER_IN_C) | \
1138  PIN_ODR_LEVEL_LOW(PG04_V5V_PERIPH_EN) | \
1139  PIN_ODR_LEVEL_HIGH(PG05_V5V_RC_EN) | \
1140  PIN_ODR_LEVEL_HIGH(PG06_V5V_WIFI_EN) | \
1141  PIN_ODR_LEVEL_HIGH(PG07_V3V3_SD_CARD_EN) | \
1142  PIN_ODR_LEVEL_HIGH(PG08_USART6_RTS) | \
1143  PIN_ODR_LEVEL_HIGH(PG09_USART6_RX) | \
1144  PIN_ODR_LEVEL_HIGH(PG10_SPI_SLAVE6) | \
1145  PIN_ODR_LEVEL_HIGH(PG11_SPI1_SCK) | \
1146  PIN_ODR_LEVEL_HIGH(PG12_SPI6_MISO) | \
1147  PIN_ODR_LEVEL_HIGH(PG13_SPI6_SCK) | \
1148  PIN_ODR_LEVEL_HIGH(PG14_USART6_TX) | \
1149  PIN_ODR_LEVEL_HIGH(PG15_USART6_CTS))
1150 
1151 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00_HW_VER_DRIVE, 0) | \
1152  PIN_AFIO_AF(PG01_POWER_IN_A, 0) | \
1153  PIN_AFIO_AF(PG02_POWER_IN_B, 0) | \
1154  PIN_AFIO_AF(PG03_POWER_IN_C, 0) | \
1155  PIN_AFIO_AF(PG04_V5V_PERIPH_EN, 0) | \
1156  PIN_AFIO_AF(PG05_V5V_RC_EN, 0) | \
1157  PIN_AFIO_AF(PG06_V5V_WIFI_EN, 0) | \
1158  PIN_AFIO_AF(PG07_V3V3_SD_CARD_EN, 0))
1159 
1160 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08_USART6_RTS, 0) | \
1161  PIN_AFIO_AF(PG09_USART6_RX, 8) | \
1162  PIN_AFIO_AF(PG10_SPI_SLAVE6, 0) | \
1163  PIN_AFIO_AF(PG11_SPI1_SCK, 5) | \
1164  PIN_AFIO_AF(PG12_SPI6_MISO, 5) | \
1165  PIN_AFIO_AF(PG13_SPI6_SCK, 5) | \
1166  PIN_AFIO_AF(PG14_USART6_TX, 8) | \
1167  PIN_AFIO_AF(PG15_USART6_CTS, 0))
1168 
1169 #define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(PH00_OSC_IN) | \
1170  PIN_MODE_ALTERNATE(PH01_OSC_OUT) | \
1171  PIN_MODE_OUTPUT(PH02_CAN1_SILENT_S0) | \
1172  PIN_MODE_OUTPUT(PH03_CAN2_SILENT_S1) | \
1173  PIN_MODE_OUTPUT(PH04_CAN3_SILENT_S2) | \
1174  PIN_MODE_OUTPUT(PH05_SPI_SLAVE7) | \
1175  PIN_MODE_ALTERNATE(PH06_SERVO7) | \
1176  PIN_MODE_ALTERNATE(PH07_I2C3_SCL) | \
1177  PIN_MODE_ALTERNATE(PH08_I2C3_SDA) | \
1178  PIN_MODE_ALTERNATE(PH09_SERVO8) | \
1179  PIN_MODE_OUTPUT(PH10_LED5) | \
1180  PIN_MODE_OUTPUT(PH11_LED6) | \
1181  PIN_MODE_OUTPUT(PH12_LED7) | \
1182  PIN_MODE_ALTERNATE(PH13_CAN1_TX) | \
1183  PIN_MODE_OUTPUT(PH14_HW_REV_DRIVE) | \
1184  PIN_MODE_INPUT(PH15_SPI5_SYNC))
1185 
1186 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(PH00_OSC_IN) | \
1187  PIN_OTYPE_PUSHPULL(PH01_OSC_OUT) | \
1188  PIN_OTYPE_PUSHPULL(PH02_CAN1_SILENT_S0) | \
1189  PIN_OTYPE_PUSHPULL(PH03_CAN2_SILENT_S1) | \
1190  PIN_OTYPE_PUSHPULL(PH04_CAN3_SILENT_S2) | \
1191  PIN_OTYPE_PUSHPULL(PH05_SPI_SLAVE7) | \
1192  PIN_OTYPE_PUSHPULL(PH06_SERVO7) | \
1193  PIN_OTYPE_OPENDRAIN(PH07_I2C3_SCL) | \
1194  PIN_OTYPE_OPENDRAIN(PH08_I2C3_SDA) | \
1195  PIN_OTYPE_PUSHPULL(PH09_SERVO8) | \
1196  PIN_OTYPE_PUSHPULL(PH10_LED5) | \
1197  PIN_OTYPE_PUSHPULL(PH11_LED6) | \
1198  PIN_OTYPE_PUSHPULL(PH12_LED7) | \
1199  PIN_OTYPE_PUSHPULL(PH13_CAN1_TX) | \
1200  PIN_OTYPE_PUSHPULL(PH14_HW_REV_DRIVE) | \
1201  PIN_OTYPE_OPENDRAIN(PH15_SPI5_SYNC))
1202 
1203 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(PH00_OSC_IN) | \
1204  PIN_OSPEED_SPEED_HIGH(PH01_OSC_OUT) | \
1205  PIN_OSPEED_SPEED_VERYLOW(PH02_CAN1_SILENT_S0) | \
1206  PIN_OSPEED_SPEED_VERYLOW(PH03_CAN2_SILENT_S1) | \
1207  PIN_OSPEED_SPEED_VERYLOW(PH04_CAN3_SILENT_S2) | \
1208  PIN_OSPEED_SPEED_HIGH(PH05_SPI_SLAVE7) | \
1209  PIN_OSPEED_SPEED_HIGH(PH06_SERVO7) | \
1210  PIN_OSPEED_SPEED_HIGH(PH07_I2C3_SCL) | \
1211  PIN_OSPEED_SPEED_HIGH(PH08_I2C3_SDA) | \
1212  PIN_OSPEED_SPEED_HIGH(PH09_SERVO8) | \
1213  PIN_OSPEED_SPEED_VERYLOW(PH10_LED5) | \
1214  PIN_OSPEED_SPEED_VERYLOW(PH11_LED6) | \
1215  PIN_OSPEED_SPEED_VERYLOW(PH12_LED7) | \
1216  PIN_OSPEED_SPEED_HIGH(PH13_CAN1_TX) | \
1217  PIN_OSPEED_SPEED_VERYLOW(PH14_HW_REV_DRIVE) | \
1218  PIN_OSPEED_SPEED_VERYLOW(PH15_SPI5_SYNC))
1219 
1220 #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(PH00_OSC_IN) | \
1221  PIN_PUPDR_FLOATING(PH01_OSC_OUT) | \
1222  PIN_PUPDR_FLOATING(PH02_CAN1_SILENT_S0) | \
1223  PIN_PUPDR_FLOATING(PH03_CAN2_SILENT_S1) | \
1224  PIN_PUPDR_FLOATING(PH04_CAN3_SILENT_S2) | \
1225  PIN_PUPDR_FLOATING(PH05_SPI_SLAVE7) | \
1226  PIN_PUPDR_FLOATING(PH06_SERVO7) | \
1227  PIN_PUPDR_PULLUP(PH07_I2C3_SCL) | \
1228  PIN_PUPDR_PULLUP(PH08_I2C3_SDA) | \
1229  PIN_PUPDR_FLOATING(PH09_SERVO8) | \
1230  PIN_PUPDR_FLOATING(PH10_LED5) | \
1231  PIN_PUPDR_FLOATING(PH11_LED6) | \
1232  PIN_PUPDR_FLOATING(PH12_LED7) | \
1233  PIN_PUPDR_FLOATING(PH13_CAN1_TX) | \
1234  PIN_PUPDR_FLOATING(PH14_HW_REV_DRIVE) | \
1235  PIN_PUPDR_PULLDOWN(PH15_SPI5_SYNC))
1236 
1237 #define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(PH00_OSC_IN) | \
1238  PIN_ODR_LEVEL_HIGH(PH01_OSC_OUT) | \
1239  PIN_ODR_LEVEL_LOW(PH02_CAN1_SILENT_S0) | \
1240  PIN_ODR_LEVEL_LOW(PH03_CAN2_SILENT_S1) | \
1241  PIN_ODR_LEVEL_LOW(PH04_CAN3_SILENT_S2) | \
1242  PIN_ODR_LEVEL_HIGH(PH05_SPI_SLAVE7) | \
1243  PIN_ODR_LEVEL_LOW(PH06_SERVO7) | \
1244  PIN_ODR_LEVEL_HIGH(PH07_I2C3_SCL) | \
1245  PIN_ODR_LEVEL_HIGH(PH08_I2C3_SDA) | \
1246  PIN_ODR_LEVEL_LOW(PH09_SERVO8) | \
1247  PIN_ODR_LEVEL_LOW(PH10_LED5) | \
1248  PIN_ODR_LEVEL_LOW(PH11_LED6) | \
1249  PIN_ODR_LEVEL_LOW(PH12_LED7) | \
1250  PIN_ODR_LEVEL_HIGH(PH13_CAN1_TX) | \
1251  PIN_ODR_LEVEL_LOW(PH14_HW_REV_DRIVE) | \
1252  PIN_ODR_LEVEL_HIGH(PH15_SPI5_SYNC))
1253 
1254 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(PH00_OSC_IN, 0) | \
1255  PIN_AFIO_AF(PH01_OSC_OUT, 0) | \
1256  PIN_AFIO_AF(PH02_CAN1_SILENT_S0, 0) | \
1257  PIN_AFIO_AF(PH03_CAN2_SILENT_S1, 0) | \
1258  PIN_AFIO_AF(PH04_CAN3_SILENT_S2, 0) | \
1259  PIN_AFIO_AF(PH05_SPI_SLAVE7, 0) | \
1260  PIN_AFIO_AF(PH06_SERVO7, 9) | \
1261  PIN_AFIO_AF(PH07_I2C3_SCL, 4))
1262 
1263 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08_I2C3_SDA, 4) | \
1264  PIN_AFIO_AF(PH09_SERVO8, 9) | \
1265  PIN_AFIO_AF(PH10_LED5, 0) | \
1266  PIN_AFIO_AF(PH11_LED6, 0) | \
1267  PIN_AFIO_AF(PH12_LED7, 0) | \
1268  PIN_AFIO_AF(PH13_CAN1_TX, 9) | \
1269  PIN_AFIO_AF(PH14_HW_REV_DRIVE, 0) | \
1270  PIN_AFIO_AF(PH15_SPI5_SYNC, 0))
1271 
1272 #define VAL_GPIOI_MODER (PIN_MODE_OUTPUT(PI00_ARMED) | \
1273  PIN_MODE_ALTERNATE(PI01_SPI2_SCK) | \
1274  PIN_MODE_ALTERNATE(PI02_SPI2_MISO) | \
1275  PIN_MODE_ALTERNATE(PI03_SPI2_MOSI) | \
1276  PIN_MODE_OUTPUT(PI04_SPI_SLAVE8) | \
1277  PIN_MODE_ALTERNATE(PI05_PWM_INPUT1) | \
1278  PIN_MODE_OUTPUT(PI06_SPI_SLAVE9) | \
1279  PIN_MODE_OUTPUT(PI07_SPI_SLAVE10) | \
1280  PIN_MODE_OUTPUT(PI08_SPI_SLAVE11) | \
1281  PIN_MODE_ALTERNATE(PI09_CAN1_RX) | \
1282  PIN_MODE_OUTPUT(PI10_SPI_SLAVE12) | \
1283  PIN_MODE_OUTPUT(PI11_SPI_SLAVE13) | \
1284  PIN_MODE_INPUT(PI12) | \
1285  PIN_MODE_INPUT(PI13) | \
1286  PIN_MODE_INPUT(PI14) | \
1287  PIN_MODE_INPUT(PI15))
1288 
1289 #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00_ARMED) | \
1290  PIN_OTYPE_PUSHPULL(PI01_SPI2_SCK) | \
1291  PIN_OTYPE_PUSHPULL(PI02_SPI2_MISO) | \
1292  PIN_OTYPE_PUSHPULL(PI03_SPI2_MOSI) | \
1293  PIN_OTYPE_PUSHPULL(PI04_SPI_SLAVE8) | \
1294  PIN_OTYPE_PUSHPULL(PI05_PWM_INPUT1) | \
1295  PIN_OTYPE_PUSHPULL(PI06_SPI_SLAVE9) | \
1296  PIN_OTYPE_PUSHPULL(PI07_SPI_SLAVE10) | \
1297  PIN_OTYPE_PUSHPULL(PI08_SPI_SLAVE11) | \
1298  PIN_OTYPE_PUSHPULL(PI09_CAN1_RX) | \
1299  PIN_OTYPE_PUSHPULL(PI10_SPI_SLAVE12) | \
1300  PIN_OTYPE_PUSHPULL(PI11_SPI_SLAVE13) | \
1301  PIN_OTYPE_PUSHPULL(PI12) | \
1302  PIN_OTYPE_PUSHPULL(PI13) | \
1303  PIN_OTYPE_PUSHPULL(PI14) | \
1304  PIN_OTYPE_PUSHPULL(PI15))
1305 
1306 #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00_ARMED) | \
1307  PIN_OSPEED_SPEED_HIGH(PI01_SPI2_SCK) | \
1308  PIN_OSPEED_SPEED_HIGH(PI02_SPI2_MISO) | \
1309  PIN_OSPEED_SPEED_HIGH(PI03_SPI2_MOSI) | \
1310  PIN_OSPEED_SPEED_HIGH(PI04_SPI_SLAVE8) | \
1311  PIN_OSPEED_SPEED_HIGH(PI05_PWM_INPUT1) | \
1312  PIN_OSPEED_SPEED_HIGH(PI06_SPI_SLAVE9) | \
1313  PIN_OSPEED_SPEED_HIGH(PI07_SPI_SLAVE10) | \
1314  PIN_OSPEED_SPEED_HIGH(PI08_SPI_SLAVE11) | \
1315  PIN_OSPEED_SPEED_HIGH(PI09_CAN1_RX) | \
1316  PIN_OSPEED_SPEED_HIGH(PI10_SPI_SLAVE12) | \
1317  PIN_OSPEED_SPEED_HIGH(PI11_SPI_SLAVE13) | \
1318  PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1319  PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1320  PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1321  PIN_OSPEED_SPEED_VERYLOW(PI15))
1322 
1323 #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(PI00_ARMED) | \
1324  PIN_PUPDR_FLOATING(PI01_SPI2_SCK) | \
1325  PIN_PUPDR_FLOATING(PI02_SPI2_MISO) | \
1326  PIN_PUPDR_FLOATING(PI03_SPI2_MOSI) | \
1327  PIN_PUPDR_FLOATING(PI04_SPI_SLAVE8) | \
1328  PIN_PUPDR_FLOATING(PI05_PWM_INPUT1) | \
1329  PIN_PUPDR_FLOATING(PI06_SPI_SLAVE9) | \
1330  PIN_PUPDR_FLOATING(PI07_SPI_SLAVE10) | \
1331  PIN_PUPDR_FLOATING(PI08_SPI_SLAVE11) | \
1332  PIN_PUPDR_FLOATING(PI09_CAN1_RX) | \
1333  PIN_PUPDR_FLOATING(PI10_SPI_SLAVE12) | \
1334  PIN_PUPDR_FLOATING(PI11_SPI_SLAVE13) | \
1335  PIN_PUPDR_PULLDOWN(PI12) | \
1336  PIN_PUPDR_PULLDOWN(PI13) | \
1337  PIN_PUPDR_PULLDOWN(PI14) | \
1338  PIN_PUPDR_PULLDOWN(PI15))
1339 
1340 #define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00_ARMED) | \
1341  PIN_ODR_LEVEL_HIGH(PI01_SPI2_SCK) | \
1342  PIN_ODR_LEVEL_HIGH(PI02_SPI2_MISO) | \
1343  PIN_ODR_LEVEL_HIGH(PI03_SPI2_MOSI) | \
1344  PIN_ODR_LEVEL_HIGH(PI04_SPI_SLAVE8) | \
1345  PIN_ODR_LEVEL_HIGH(PI05_PWM_INPUT1) | \
1346  PIN_ODR_LEVEL_HIGH(PI06_SPI_SLAVE9) | \
1347  PIN_ODR_LEVEL_HIGH(PI07_SPI_SLAVE10) | \
1348  PIN_ODR_LEVEL_HIGH(PI08_SPI_SLAVE11) | \
1349  PIN_ODR_LEVEL_HIGH(PI09_CAN1_RX) | \
1350  PIN_ODR_LEVEL_HIGH(PI10_SPI_SLAVE12) | \
1351  PIN_ODR_LEVEL_HIGH(PI11_SPI_SLAVE13) | \
1352  PIN_ODR_LEVEL_LOW(PI12) | \
1353  PIN_ODR_LEVEL_LOW(PI13) | \
1354  PIN_ODR_LEVEL_LOW(PI14) | \
1355  PIN_ODR_LEVEL_LOW(PI15))
1356 
1357 #define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00_ARMED, 0) | \
1358  PIN_AFIO_AF(PI01_SPI2_SCK, 5) | \
1359  PIN_AFIO_AF(PI02_SPI2_MISO, 5) | \
1360  PIN_AFIO_AF(PI03_SPI2_MOSI, 5) | \
1361  PIN_AFIO_AF(PI04_SPI_SLAVE8, 0) | \
1362  PIN_AFIO_AF(PI05_PWM_INPUT1, 3) | \
1363  PIN_AFIO_AF(PI06_SPI_SLAVE9, 0) | \
1364  PIN_AFIO_AF(PI07_SPI_SLAVE10, 0))
1365 
1366 #define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08_SPI_SLAVE11, 0) | \
1367  PIN_AFIO_AF(PI09_CAN1_RX, 9) | \
1368  PIN_AFIO_AF(PI10_SPI_SLAVE12, 0) | \
1369  PIN_AFIO_AF(PI11_SPI_SLAVE13, 0) | \
1370  PIN_AFIO_AF(PI12, 0) | \
1371  PIN_AFIO_AF(PI13, 0) | \
1372  PIN_AFIO_AF(PI14, 0) | \
1373  PIN_AFIO_AF(PI15, 0))
1374 
1375 #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1376  PIN_MODE_INPUT(PJ01) | \
1377  PIN_MODE_INPUT(PJ02) | \
1378  PIN_MODE_INPUT(PJ03) | \
1379  PIN_MODE_INPUT(PJ04) | \
1380  PIN_MODE_INPUT(PJ05) | \
1381  PIN_MODE_INPUT(PJ06) | \
1382  PIN_MODE_INPUT(PJ07) | \
1383  PIN_MODE_INPUT(PJ08) | \
1384  PIN_MODE_INPUT(PJ09) | \
1385  PIN_MODE_INPUT(PJ10) | \
1386  PIN_MODE_INPUT(PJ11) | \
1387  PIN_MODE_INPUT(PJ12) | \
1388  PIN_MODE_INPUT(PJ13) | \
1389  PIN_MODE_INPUT(PJ14) | \
1390  PIN_MODE_INPUT(PJ15))
1391 
1392 #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1393  PIN_OTYPE_PUSHPULL(PJ01) | \
1394  PIN_OTYPE_PUSHPULL(PJ02) | \
1395  PIN_OTYPE_PUSHPULL(PJ03) | \
1396  PIN_OTYPE_PUSHPULL(PJ04) | \
1397  PIN_OTYPE_PUSHPULL(PJ05) | \
1398  PIN_OTYPE_PUSHPULL(PJ06) | \
1399  PIN_OTYPE_PUSHPULL(PJ07) | \
1400  PIN_OTYPE_PUSHPULL(PJ08) | \
1401  PIN_OTYPE_PUSHPULL(PJ09) | \
1402  PIN_OTYPE_PUSHPULL(PJ10) | \
1403  PIN_OTYPE_PUSHPULL(PJ11) | \
1404  PIN_OTYPE_PUSHPULL(PJ12) | \
1405  PIN_OTYPE_PUSHPULL(PJ13) | \
1406  PIN_OTYPE_PUSHPULL(PJ14) | \
1407  PIN_OTYPE_PUSHPULL(PJ15))
1408 
1409 #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1410  PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1411  PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1412  PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1413  PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1414  PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1415  PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1416  PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1417  PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1418  PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1419  PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1420  PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1421  PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1422  PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1423  PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1424  PIN_OSPEED_SPEED_VERYLOW(PJ15))
1425 
1426 #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1427  PIN_PUPDR_PULLDOWN(PJ01) | \
1428  PIN_PUPDR_PULLDOWN(PJ02) | \
1429  PIN_PUPDR_PULLDOWN(PJ03) | \
1430  PIN_PUPDR_PULLDOWN(PJ04) | \
1431  PIN_PUPDR_PULLDOWN(PJ05) | \
1432  PIN_PUPDR_PULLDOWN(PJ06) | \
1433  PIN_PUPDR_PULLDOWN(PJ07) | \
1434  PIN_PUPDR_PULLDOWN(PJ08) | \
1435  PIN_PUPDR_PULLDOWN(PJ09) | \
1436  PIN_PUPDR_PULLDOWN(PJ10) | \
1437  PIN_PUPDR_PULLDOWN(PJ11) | \
1438  PIN_PUPDR_PULLDOWN(PJ12) | \
1439  PIN_PUPDR_PULLDOWN(PJ13) | \
1440  PIN_PUPDR_PULLDOWN(PJ14) | \
1441  PIN_PUPDR_PULLDOWN(PJ15))
1442 
1443 #define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1444  PIN_ODR_LEVEL_LOW(PJ01) | \
1445  PIN_ODR_LEVEL_LOW(PJ02) | \
1446  PIN_ODR_LEVEL_LOW(PJ03) | \
1447  PIN_ODR_LEVEL_LOW(PJ04) | \
1448  PIN_ODR_LEVEL_LOW(PJ05) | \
1449  PIN_ODR_LEVEL_LOW(PJ06) | \
1450  PIN_ODR_LEVEL_LOW(PJ07) | \
1451  PIN_ODR_LEVEL_LOW(PJ08) | \
1452  PIN_ODR_LEVEL_LOW(PJ09) | \
1453  PIN_ODR_LEVEL_LOW(PJ10) | \
1454  PIN_ODR_LEVEL_LOW(PJ11) | \
1455  PIN_ODR_LEVEL_LOW(PJ12) | \
1456  PIN_ODR_LEVEL_LOW(PJ13) | \
1457  PIN_ODR_LEVEL_LOW(PJ14) | \
1458  PIN_ODR_LEVEL_LOW(PJ15))
1459 
1460 #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1461  PIN_AFIO_AF(PJ01, 0) | \
1462  PIN_AFIO_AF(PJ02, 0) | \
1463  PIN_AFIO_AF(PJ03, 0) | \
1464  PIN_AFIO_AF(PJ04, 0) | \
1465  PIN_AFIO_AF(PJ05, 0) | \
1466  PIN_AFIO_AF(PJ06, 0) | \
1467  PIN_AFIO_AF(PJ07, 0))
1468 
1469 #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1470  PIN_AFIO_AF(PJ09, 0) | \
1471  PIN_AFIO_AF(PJ10, 0) | \
1472  PIN_AFIO_AF(PJ11, 0) | \
1473  PIN_AFIO_AF(PJ12, 0) | \
1474  PIN_AFIO_AF(PJ13, 0) | \
1475  PIN_AFIO_AF(PJ14, 0) | \
1476  PIN_AFIO_AF(PJ15, 0))
1477 
1478 #define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1479  PIN_MODE_INPUT(PK01) | \
1480  PIN_MODE_INPUT(PK02) | \
1481  PIN_MODE_INPUT(PK03) | \
1482  PIN_MODE_INPUT(PK04) | \
1483  PIN_MODE_INPUT(PK05) | \
1484  PIN_MODE_INPUT(PK06) | \
1485  PIN_MODE_INPUT(PK07) | \
1486  PIN_MODE_INPUT(PK08) | \
1487  PIN_MODE_INPUT(PK09) | \
1488  PIN_MODE_INPUT(PK10) | \
1489  PIN_MODE_INPUT(PK11) | \
1490  PIN_MODE_INPUT(PK12) | \
1491  PIN_MODE_INPUT(PK13) | \
1492  PIN_MODE_INPUT(PK14) | \
1493  PIN_MODE_INPUT(PK15))
1494 
1495 #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1496  PIN_OTYPE_PUSHPULL(PK01) | \
1497  PIN_OTYPE_PUSHPULL(PK02) | \
1498  PIN_OTYPE_PUSHPULL(PK03) | \
1499  PIN_OTYPE_PUSHPULL(PK04) | \
1500  PIN_OTYPE_PUSHPULL(PK05) | \
1501  PIN_OTYPE_PUSHPULL(PK06) | \
1502  PIN_OTYPE_PUSHPULL(PK07) | \
1503  PIN_OTYPE_PUSHPULL(PK08) | \
1504  PIN_OTYPE_PUSHPULL(PK09) | \
1505  PIN_OTYPE_PUSHPULL(PK10) | \
1506  PIN_OTYPE_PUSHPULL(PK11) | \
1507  PIN_OTYPE_PUSHPULL(PK12) | \
1508  PIN_OTYPE_PUSHPULL(PK13) | \
1509  PIN_OTYPE_PUSHPULL(PK14) | \
1510  PIN_OTYPE_PUSHPULL(PK15))
1511 
1512 #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1513  PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1514  PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1515  PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1516  PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1517  PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1518  PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1519  PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1520  PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1521  PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1522  PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1523  PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1524  PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1525  PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1526  PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1527  PIN_OSPEED_SPEED_VERYLOW(PK15))
1528 
1529 #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1530  PIN_PUPDR_PULLDOWN(PK01) | \
1531  PIN_PUPDR_PULLDOWN(PK02) | \
1532  PIN_PUPDR_PULLDOWN(PK03) | \
1533  PIN_PUPDR_PULLDOWN(PK04) | \
1534  PIN_PUPDR_PULLDOWN(PK05) | \
1535  PIN_PUPDR_PULLDOWN(PK06) | \
1536  PIN_PUPDR_PULLDOWN(PK07) | \
1537  PIN_PUPDR_PULLDOWN(PK08) | \
1538  PIN_PUPDR_PULLDOWN(PK09) | \
1539  PIN_PUPDR_PULLDOWN(PK10) | \
1540  PIN_PUPDR_PULLDOWN(PK11) | \
1541  PIN_PUPDR_PULLDOWN(PK12) | \
1542  PIN_PUPDR_PULLDOWN(PK13) | \
1543  PIN_PUPDR_PULLDOWN(PK14) | \
1544  PIN_PUPDR_PULLDOWN(PK15))
1545 
1546 #define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1547  PIN_ODR_LEVEL_LOW(PK01) | \
1548  PIN_ODR_LEVEL_LOW(PK02) | \
1549  PIN_ODR_LEVEL_LOW(PK03) | \
1550  PIN_ODR_LEVEL_LOW(PK04) | \
1551  PIN_ODR_LEVEL_LOW(PK05) | \
1552  PIN_ODR_LEVEL_LOW(PK06) | \
1553  PIN_ODR_LEVEL_LOW(PK07) | \
1554  PIN_ODR_LEVEL_LOW(PK08) | \
1555  PIN_ODR_LEVEL_LOW(PK09) | \
1556  PIN_ODR_LEVEL_LOW(PK10) | \
1557  PIN_ODR_LEVEL_LOW(PK11) | \
1558  PIN_ODR_LEVEL_LOW(PK12) | \
1559  PIN_ODR_LEVEL_LOW(PK13) | \
1560  PIN_ODR_LEVEL_LOW(PK14) | \
1561  PIN_ODR_LEVEL_LOW(PK15))
1562 
1563 #define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1564  PIN_AFIO_AF(PK01, 0) | \
1565  PIN_AFIO_AF(PK02, 0) | \
1566  PIN_AFIO_AF(PK03, 0) | \
1567  PIN_AFIO_AF(PK04, 0) | \
1568  PIN_AFIO_AF(PK05, 0) | \
1569  PIN_AFIO_AF(PK06, 0) | \
1570  PIN_AFIO_AF(PK07, 0))
1571 
1572 #define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1573  PIN_AFIO_AF(PK09, 0) | \
1574  PIN_AFIO_AF(PK10, 0) | \
1575  PIN_AFIO_AF(PK11, 0) | \
1576  PIN_AFIO_AF(PK12, 0) | \
1577  PIN_AFIO_AF(PK13, 0) | \
1578  PIN_AFIO_AF(PK14, 0) | \
1579  PIN_AFIO_AF(PK15, 0))
1580 
1581 #define AF_PA06_SPI1_MISO 5U
1582 #define AF_LINE_SPI1_MISO 5U
1583 #define AF_PA08_CAN3_RX 11U
1584 #define AF_LINE_CAN3_RX 11U
1585 #define AF_PA10_SERVO2 1U
1586 #define AF_LINE_SERVO2 1U
1587 #define AF_PA11_USB_DM 10U
1588 #define AF_LINE_USB_DM 10U
1589 #define AF_PA12_USB_DP 10U
1590 #define AF_LINE_USB_DP 10U
1591 #define AF_PA13_SWDIO 0U
1592 #define AF_LINE_SWDIO 0U
1593 #define AF_PA14_SWCLK 0U
1594 #define AF_LINE_SWCLK 0U
1595 #define AF_PA15_CAN3_TX 11U
1596 #define AF_LINE_CAN3_TX 11U
1597 #define AF_PB05_SPI6_MOSI 8U
1598 #define AF_LINE_SPI6_MOSI 8U
1599 #define AF_PB06_USART1_TX 7U
1600 #define AF_LINE_USART1_TX 7U
1601 #define AF_PB07_USART1_RX 7U
1602 #define AF_LINE_USART1_RX 7U
1603 #define AF_PB08_I2C1_SCL 4U
1604 #define AF_LINE_I2C1_SCL 4U
1605 #define AF_PB09_I2C1_SDA 4U
1606 #define AF_LINE_I2C1_SDA 4U
1607 #define AF_PB12_CAN2_RX 9U
1608 #define AF_LINE_CAN2_RX 9U
1609 #define AF_PB13_CAN2_TX 9U
1610 #define AF_LINE_CAN2_TX 9U
1611 #define AF_PC08_SDIO_D0 12U
1612 #define AF_LINE_SDIO_D0 12U
1613 #define AF_PC09_SDIO_D1 12U
1614 #define AF_LINE_SDIO_D1 12U
1615 #define AF_PC10_SDIO_D2 12U
1616 #define AF_LINE_SDIO_D2 12U
1617 #define AF_PC11_SDIO_D3 12U
1618 #define AF_LINE_SDIO_D3 12U
1619 #define AF_PC12_SDIO_CK 12U
1620 #define AF_LINE_SDIO_CK 12U
1621 #define AF_PC14_OSC32_IN 0U
1622 #define AF_LINE_OSC32_IN 0U
1623 #define AF_PC15_OSC32_OUT 0U
1624 #define AF_LINE_OSC32_OUT 0U
1625 #define AF_PD00_UART4_RX 8U
1626 #define AF_LINE_UART4_RX 8U
1627 #define AF_PD01_UART4_TX 8U
1628 #define AF_LINE_UART4_TX 8U
1629 #define AF_PD02_SDIO_CMD 12U
1630 #define AF_LINE_SDIO_CMD 12U
1631 #define AF_PD05_UART2_TX 7U
1632 #define AF_LINE_UART2_TX 7U
1633 #define AF_PD06_UART2_RX 7U
1634 #define AF_LINE_UART2_RX 7U
1635 #define AF_PD07_SPI1_MOSI 5U
1636 #define AF_LINE_SPI1_MOSI 5U
1637 #define AF_PD08_UART3_TX 7U
1638 #define AF_LINE_UART3_TX 7U
1639 #define AF_PD09_UART3_RX 7U
1640 #define AF_LINE_UART3_RX 7U
1641 #define AF_PD13_SERVO5 2U
1642 #define AF_LINE_SERVO5 2U
1643 #define AF_PD14_SERVO6 2U
1644 #define AF_LINE_SERVO6 2U
1645 #define AF_PE00_UART8_RX 8U
1646 #define AF_LINE_UART8_RX 8U
1647 #define AF_PE01_UART8_TX 8U
1648 #define AF_LINE_UART8_TX 8U
1649 #define AF_PE02_SPI4_SCK 5U
1650 #define AF_LINE_SPI4_SCK 5U
1651 #define AF_PE06_SPI4_MOSI 5U
1652 #define AF_LINE_SPI4_MOSI 5U
1653 #define AF_PE08_UART7_TX 8U
1654 #define AF_LINE_UART7_TX 8U
1655 #define AF_PE09_SERVO4 1U
1656 #define AF_LINE_SERVO4 1U
1657 #define AF_PE11_SERVO3 1U
1658 #define AF_LINE_SERVO3 1U
1659 #define AF_PE13_SPI4_MISO 5U
1660 #define AF_LINE_SPI4_MISO 5U
1661 #define AF_PE14_SERVO1 1U
1662 #define AF_LINE_SERVO1 1U
1663 #define AF_PF00_I2C2_SDA 4U
1664 #define AF_LINE_I2C2_SDA 4U
1665 #define AF_PF01_I2C2_SCL 4U
1666 #define AF_LINE_I2C2_SCL 4U
1667 #define AF_PF06_UART7_RX 8U
1668 #define AF_LINE_UART7_RX 8U
1669 #define AF_PF07_SPI5_SCK 5U
1670 #define AF_LINE_SPI5_SCK 5U
1671 #define AF_PF08_SPI5_MISO 5U
1672 #define AF_LINE_SPI5_MISO 5U
1673 #define AF_PF09_SPI5_MOSI 5U
1674 #define AF_LINE_SPI5_MOSI 5U
1675 #define AF_PF14_I2C4_SCL 4U
1676 #define AF_LINE_I2C4_SCL 4U
1677 #define AF_PF15_I2C4_SDA 4U
1678 #define AF_LINE_I2C4_SDA 4U
1679 #define AF_PG09_USART6_RX 8U
1680 #define AF_LINE_USART6_RX 8U
1681 #define AF_PG11_SPI1_SCK 5U
1682 #define AF_LINE_SPI1_SCK 5U
1683 #define AF_PG12_SPI6_MISO 5U
1684 #define AF_LINE_SPI6_MISO 5U
1685 #define AF_PG13_SPI6_SCK 5U
1686 #define AF_LINE_SPI6_SCK 5U
1687 #define AF_PG14_USART6_TX 8U
1688 #define AF_LINE_USART6_TX 8U
1689 #define AF_PH00_OSC_IN 0U
1690 #define AF_LINE_OSC_IN 0U
1691 #define AF_PH01_OSC_OUT 0U
1692 #define AF_LINE_OSC_OUT 0U
1693 #define AF_PH06_SERVO7 9U
1694 #define AF_LINE_SERVO7 9U
1695 #define AF_PH07_I2C3_SCL 4U
1696 #define AF_LINE_I2C3_SCL 4U
1697 #define AF_PH08_I2C3_SDA 4U
1698 #define AF_LINE_I2C3_SDA 4U
1699 #define AF_PH09_SERVO8 9U
1700 #define AF_LINE_SERVO8 9U
1701 #define AF_PH13_CAN1_TX 9U
1702 #define AF_LINE_CAN1_TX 9U
1703 #define AF_PI01_SPI2_SCK 5U
1704 #define AF_LINE_SPI2_SCK 5U
1705 #define AF_PI02_SPI2_MISO 5U
1706 #define AF_LINE_SPI2_MISO 5U
1707 #define AF_PI03_SPI2_MOSI 5U
1708 #define AF_LINE_SPI2_MOSI 5U
1709 #define AF_PI05_PWM_INPUT1 3U
1710 #define AF_LINE_PWM_INPUT1 3U
1711 #define AF_PI09_CAN1_RX 9U
1712 #define AF_LINE_CAN1_RX 9U
1713 
1714 
1715 #define ADC1_ADC 1
1716 #define ADC1_ADC_FN IN
1717 #define ADC1_ADC_IN 0
1718 #define ADC2_ADC 1
1719 #define ADC2_ADC_FN IN
1720 #define ADC2_ADC_IN 1
1721 #define ADC3_ADC 1
1722 #define ADC3_ADC_FN IN
1723 #define ADC3_ADC_IN 2
1724 #define ADC4_ADC 1
1725 #define ADC4_ADC_FN IN
1726 #define ADC4_ADC_IN 3
1727 #define ADC5_ADC 1
1728 #define ADC5_ADC_FN IN
1729 #define ADC5_ADC_IN 4
1730 #define SERVO2_TIM 1
1731 #define SERVO2_TIM_FN CH
1732 #define SERVO2_TIM_CH 3
1733 #define SERVO2_TIM_AF 1
1734 #define RSSI_IN_ADC 1
1735 #define RSSI_IN_ADC_FN IN
1736 #define RSSI_IN_ADC_IN 8
1737 #define SCALED_V5_ADC 1
1738 #define SCALED_V5_ADC_FN IN
1739 #define SCALED_V5_ADC_IN 10
1740 #define SCALED_3V3_SENSORS_ADC 1
1741 #define SCALED_3V3_SENSORS_ADC_FN IN
1742 #define SCALED_3V3_SENSORS_ADC_IN 11
1743 #define HW_VER_SENSE_ADC 1
1744 #define HW_VER_SENSE_ADC_FN IN
1745 #define HW_VER_SENSE_ADC_IN 12
1746 #define HW_REV_SENSE_ADC 1
1747 #define HW_REV_SENSE_ADC_FN IN
1748 #define HW_REV_SENSE_ADC_IN 13
1749 #define ADC6_ADC 1
1750 #define ADC6_ADC_FN IN
1751 #define ADC6_ADC_IN 14
1752 #define SERVO5_TIM 4
1753 #define SERVO5_TIM_FN CH
1754 #define SERVO5_TIM_CH 2
1755 #define SERVO5_TIM_AF 2
1756 #define SERVO6_TIM 4
1757 #define SERVO6_TIM_FN CH
1758 #define SERVO6_TIM_CH 3
1759 #define SERVO6_TIM_AF 2
1760 #define SERVO4_TIM 1
1761 #define SERVO4_TIM_FN CH
1762 #define SERVO4_TIM_CH 1
1763 #define SERVO4_TIM_AF 1
1764 #define SERVO3_TIM 1
1765 #define SERVO3_TIM_FN CH
1766 #define SERVO3_TIM_CH 2
1767 #define SERVO3_TIM_AF 1
1768 #define SERVO1_TIM 1
1769 #define SERVO1_TIM_FN CH
1770 #define SERVO1_TIM_CH 4
1771 #define SERVO1_TIM_AF 1
1772 #define SERVO7_TIM 12
1773 #define SERVO7_TIM_FN CH
1774 #define SERVO7_TIM_CH 1
1775 #define SERVO7_TIM_AF 9
1776 #define SERVO8_TIM 12
1777 #define SERVO8_TIM_FN CH
1778 #define SERVO8_TIM_CH 2
1779 #define SERVO8_TIM_AF 9
1780 #define PWM_INPUT1_TIM 8
1781 #define PWM_INPUT1_TIM_FN CH
1782 #define PWM_INPUT1_TIM_CH 1
1783 #define PWM_INPUT1_TIM_AF 3
1784 
1785 #define BOARD_GROUP_DECLFOREACH(line, group) \
1786  static const ioline_t group ## _ARRAY[] = {group}; \
1787  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1788 
1789 #define BOARD_GROUP_FOREACH(line, group) \
1790  for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
1791 
1792 
1793 #define BOARD_GROUP_DECLFOR(array, index, group) \
1794  static const ioline_t group ## _ARRAY[] = {group}; \
1795  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1796 
1797 #define BOARD_GROUP_FOR(array, index, group) \
1798  for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
1799 
1800 #define ENERGY_SAVE_INPUTS \
1801  LINE_SERVO2, \
1802  LINE_LED1, \
1803  LINE_LED2, \
1804  LINE_LED3, \
1805  LINE_SERVO5, \
1806  LINE_SERVO6, \
1807  LINE_SERVO4, \
1808  LINE_SERVO3, \
1809  LINE_LED4, \
1810  LINE_SERVO1, \
1811  LINE_SPI_SLAVE0, \
1812  LINE_SPI_SLAVE1, \
1813  LINE_SPI_SLAVE2, \
1814  LINE_SPI_SLAVE3, \
1815  LINE_SPI_SLAVE4, \
1816  LINE_SPI_SLAVE5, \
1817  LINE_SPI_SLAVE6, \
1818  LINE_SPI_SLAVE7, \
1819  LINE_SERVO7, \
1820  LINE_SERVO8, \
1821  LINE_LED5, \
1822  LINE_LED6, \
1823  LINE_LED7, \
1824  LINE_SPI_SLAVE8, \
1825  LINE_SPI_SLAVE9, \
1826  LINE_SPI_SLAVE10, \
1827  LINE_SPI_SLAVE11, \
1828  LINE_SPI_SLAVE12, \
1829  LINE_SPI_SLAVE13
1830 #define ENERGY_SAVE_INPUTS_SIZE 29
1831 
1832 #define ENERGY_SAVE_LOWS \
1833  LINE_V3V3_SENSORS_EN, \
1834  LINE_V3V3_SPEKTRUM_EN, \
1835  LINE_V5V_HIPOWER_EN, \
1836  LINE_V5V_PERIPH_EN, \
1837  LINE_V5V_RC_EN, \
1838  LINE_V5V_WIFI_EN
1839 #define ENERGY_SAVE_LOWS_SIZE 6
1840 
1841 #if !defined(_FROM_ASM_)
1842 #ifdef __cplusplus
1843 extern "C" {
1844 #endif
1845  void boardInit(void);
1846 #ifdef __cplusplus
1847 }
1848 #endif
1849 #endif /* _FROM_ASM_ */
1850 
void boardInit(void)
Board-specific initialization code.
Definition: board.c:317