Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
board.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2016 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 /*
18  * This file has been automatically generated using ChibiStudio board
19  * generator plugin. Do not edit manually.
20  */
21 
22 #ifndef BOARD_H
23 #define BOARD_H
24 
25 /*
26  * Setup for STMicroelectronics STM32373C-vortex board.
27  */
28 
29 /*
30  * Board identifier.
31  */
32 #define BOARD_ST_STM32373C_XVERT
33 #define BOARD_NAME "STMicroelectronics STM32373C-xvert"
34 
35 /*
36  * Board oscillators-related settings.
37  */
38 #if !defined(STM32_LSECLK)
39 #define STM32_LSECLK 32768U
40 #endif
41 
42 #define STM32_LSEDRV (3U << 3U)
43 
44 #if !defined(STM32_HSECLK)
45 #define STM32_HSECLK 16000000U
46 #endif
47 
48 /*
49  * MCU type as defined in the ST header.
50  */
51 #define STM32F373xC
52 
53 /*
54  * IO pins assignments.
55  */
56 #define GPIOA_PIN0 0U
57 #define GPIOA_ADC_VDD 1U
58 #define GPIOA_UART2TX 2U
59 #define GPIOA_UART2RX 3U
60 #define GPIOA_PIN4 4U
61 #define GPIOA_ADC1 5U
62 #define GPIOA_ADC2 6U
63 #define GPIOA_PIN7 7U
64 #define GPIOA_LED_RED 8U
65 #define GPIOA_UART1TX 9U
66 #define GPIOA_UART1RX 10U
67 #define GPIOA_PWM_PIN11 11U
68 #define GPIOA_PWM_PIN12 12U
69 #define GPIOA_SWD 13U
70 #define GPIOA_SWCLK 14U
71 #define GPIOA_PIN15 15U
72 
73 #define GPIOB_MIC_IN 0U
74 #define GPIOB_ADC_POT_IN 1U
75 #define GPIOB_PIN2 2U
76 #define GPIOB_SWO 3U
77 #define GPIOB_JTRST 4U
78 #define GPIOB_PIN5 5U
79 #define GPIOB_I2C1_SCL 6U
80 #define GPIOB_I2C1_SDA 7U
81 #define GPIOB_PIN8 8U
82 #define GPIOB_PIN9 9U
83 #define GPIOB_PIN10 10U
84 #define GPIOB_PIN11 11U
85 #define GPIOB_PIN12 12U
86 #define GPIOB_PIN13 13U
87 #define GPIOB_PIN14 14U
88 #define GPIOB_PIN15 15U
89 
90 #define GPIOC_LED1 0U
91 #define GPIOC_LED2 1U
92 #define GPIOC_LED3 2U
93 #define GPIOC_LED4 3U
94 #define GPIOC_PIN4 4U
95 #define GPIOC_USB_DISCONNECT 5U
96 #define GPIOC_PIN6 6U
97 #define GPIOC_PIN7 7U
98 #define GPIOC_PIN8 8U
99 #define GPIOC_PIN9 9U
100 #define GPIOC_PIN10 10U
101 #define GPIOC_PIN11 11U
102 #define GPIOC_PIN12 12U
103 #define GPIOC_PIN13 13U
104 #define GPIOC_OSC32_IN 14U
105 #define GPIOC_OSC32_OUT 15U
106 
107 #define GPIOD_CAN_RX 0U
108 #define GPIOD_CAN_TX 1U
109 #define GPIOD_LCD_CS 2U
110 #define GPIOD_USART2_CTS 3U
111 #define GPIOD_USART2_RST 4U
112 #define GPIOD_USART2_TX 5U
113 #define GPIOD_USART2_RX 6U
114 #define GPIOD_PIN7 7U
115 #define GPIOD_LED_GREEN 8U
116 #define GPIOD_PIN9 9U
117 #define GPIOD_PIN10 10U
118 #define GPIOD_AUDIO_RST 11U
119 #define GPIOD_PIN12 12U
120 #define GPIOD_PIN13 13U
121 #define GPIOD_PIN14 14U
122 #define GPIOD_PIN15 15U
123 
124 #define GPIOE_PIN0 0U
125 #define GPIOE_PIN1 1U
126 #define GPIOE_SD_CS 2U
127 #define GPIOE_SD_DETECT 3U
128 #define GPIOE_PIN4 4U
129 #define GPIOE_PIN5 5U
130 #define GPIOE_JOY_SEL 6U
131 #define GPIOE_RTD_IN 7U
132 #define GPIOE_PRESSUREP 8U
133 #define GPIOE_PRESSUREN 9U
134 #define GPIOE_PIN10 10U
135 #define GPIOE_PIN11 11U
136 #define GPIOE_PIN12 12U
137 #define GPIOE_PIN13 13U
138 #define GPIOE_PRESSURE_TEPM 14U
139 #define GPIOE_PIN15 15U
140 
141 #define GPIOF_OSC_IN 0U
142 #define GPIOF_OSC_OUT 1U
143 #define GPIOF_JOY_DOWN 2U
144 #define GPIOF_PIN3 3U
145 #define GPIOF_JOY_LEFT 4U
146 #define GPIOF_PIN5 5U
147 #define GPIOF_I2C2_SCL 6U
148 #define GPIOF_I2C2_SDA 7U
149 #define GPIOF_PIN8 8U
150 #define GPIOF_JOY_RIGHT 9U
151 #define GPIOF_JOY_UP 10U
152 #define GPIOF_PIN11 11U
153 #define GPIOF_PIN12 12U
154 #define GPIOF_PIN13 13U
155 #define GPIOF_PIN14 14U
156 #define GPIOF_PIN15 15U
157 
158 #define GPIOG_PIN0 0U
159 #define GPIOG_PIN1 1U
160 #define GPIOG_PIN2 2U
161 #define GPIOG_PIN3 3U
162 #define GPIOG_PIN4 4U
163 #define GPIOG_PIN5 5U
164 #define GPIOG_PIN6 6U
165 #define GPIOG_PIN7 7U
166 #define GPIOG_PIN8 8U
167 #define GPIOG_PIN9 9U
168 #define GPIOG_PIN10 10U
169 #define GPIOG_PIN11 11U
170 #define GPIOG_PIN12 12U
171 #define GPIOG_PIN13 13U
172 #define GPIOG_PIN14 14U
173 #define GPIOG_PIN15 15U
174 
175 #define GPIOH_PIN0 0U
176 #define GPIOH_PIN1 1U
177 #define GPIOH_PIN2 2U
178 #define GPIOH_PIN3 3U
179 #define GPIOH_PIN4 4U
180 #define GPIOH_PIN5 5U
181 #define GPIOH_PIN6 6U
182 #define GPIOH_PIN7 7U
183 #define GPIOH_PIN8 8U
184 #define GPIOH_PIN9 9U
185 #define GPIOH_PIN10 10U
186 #define GPIOH_PIN11 11U
187 #define GPIOH_PIN12 12U
188 #define GPIOH_PIN13 13U
189 #define GPIOH_PIN14 14U
190 #define GPIOH_PIN15 15U
191 
192 /*
193  * IO lines assignments.
194  */
195 //#define LINE_WKUP_BUTTON PAL_LINE(GPIOA, 0U)
196 //#define LINE_LDR_OUT PAL_LINE(GPIOA, 1U)
197 //#define LINE_KEY_BUTTON PAL_LINE(GPIOA, 2U)
198 //#define LINE_COMP2_OUT PAL_LINE(GPIOA, 7U)
199 //#define LINE_I2C2_SMB PAL_LINE(GPIOA, 8U)
200 //#define LINE_I2C2_SCL PAL_LINE(GPIOA, 9U)
201 //#define LINE_I2C2_SDA PAL_LINE(GPIOA, 10U)
202 //#define LINE_USB_DM PAL_LINE(GPIOA, 11U)
203 //#define LINE_USB_DP PAL_LINE(GPIOA, 12U)
204 //#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
205 //#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
206 //#define LINE_JTDI PAL_LINE(GPIOA, 15U)
207 
208 //#define LINE_MIC_IN PAL_LINE(GPIOB, 0U)
209 //#define LINE_ADC_POT_IN PAL_LINE(GPIOB, 1U)
210 //#define LINE_SWO PAL_LINE(GPIOB, 3U)
211 //#define LINE_JTRST PAL_LINE(GPIOB, 4U)
212 //#define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
213 //#define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
214 
215 //#define LINE_LED1 PAL_LINE(GPIOC, 0U)
216 //#define LINE_LED2 PAL_LINE(GPIOC, 1U)
217 //#define LINE_LED3 PAL_LINE(GPIOC, 2U)
218 //#define LINE_LED4 PAL_LINE(GPIOC, 3U)
219 //#define LINE_USB_DISCONNECT PAL_LINE(GPIOC, 5U)
220 //#define LINE_SPI3_SCK PAL_LINE(GPIOC, 10U)
221 //#define LINE_SPI3_MISO PAL_LINE(GPIOC, 11U)
222 //#define LINE_SPI3_MOSI PAL_LINE(GPIOC, 12U)
223 //#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
224 //#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
225 
226 //#define LINE_CAN_RX PAL_LINE(GPIOD, 0U)
227 //#define LINE_CAN_TX PAL_LINE(GPIOD, 1U)
228 //#define LINE_LCD_CS PAL_LINE(GPIOD, 2U)
229 //#define LINE_USART2_CTS PAL_LINE(GPIOD, 3U)
230 //#define LINE_USART2_RST PAL_LINE(GPIOD, 4U)
231 //#define LINE_USART2_TX PAL_LINE(GPIOD, 5U)
232 //#define LINE_USART2_RX PAL_LINE(GPIOD, 6U)
233 //#define LINE_AUDIO_RST PAL_LINE(GPIOD, 11U)
234 
235 //#define LINE_SD_CS PAL_LINE(GPIOE, 2U)
236 //#define LINE_SD_DETECT PAL_LINE(GPIOE, 3U)
237 //#define LINE_JOY_SEL PAL_LINE(GPIOE, 6U)
238 //#define LINE_RTD_IN PAL_LINE(GPIOE, 7U)
239 //#define LINE_PRESSUREP PAL_LINE(GPIOE, 8U)
240 //#define LINE_PRESSUREN PAL_LINE(GPIOE, 9U)
241 //#define LINE_PRESSURE_TEPM PAL_LINE(GPIOE, 14U)
242 
243 //#define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
244 //#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
245 //#define LINE_JOY_DOWN PAL_LINE(GPIOF, 2U)
246 //#define LINE_JOY_LEFT PAL_LINE(GPIOF, 4U)
247 //#define LINE_JOY_RIGHT PAL_LINE(GPIOF, 9U)
248 //#define LINE_JOY_UP PAL_LINE(GPIOF, 10U)
249 
250 /*
251  * I/O ports initial setup, this configuration is established soon after reset
252  * in the initialization code.
253  * Please refer to the STM32 Reference Manual for details.
254  */
255 #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
256 #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
257 #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
258 #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
259 #define PIN_ODR_LOW(n) (0U << (n))
260 #define PIN_ODR_HIGH(n) (1U << (n))
261 #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
262 #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
263 #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
264 #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
265 #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
266 #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
267 #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
268 #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
269 #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
270 #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
271 
272 
273 #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \
274  PIN_MODE_ANALOG(GPIOA_ADC_VDD) | \
275  PIN_MODE_ALTERNATE(GPIOA_UART2TX) | \
276  PIN_MODE_ALTERNATE(GPIOA_UART2RX) | \
277  PIN_MODE_INPUT(GPIOA_PIN4) | \
278  PIN_MODE_ANALOG(GPIOA_ADC1) | \
279  PIN_MODE_ANALOG(GPIOA_ADC2) | \
280  PIN_MODE_OUTPUT(GPIOA_PIN7) | \
281  PIN_MODE_OUTPUT(GPIOA_LED_RED) | \
282  PIN_MODE_ALTERNATE(GPIOA_UART1TX) | \
283  PIN_MODE_ALTERNATE(GPIOA_UART1RX) | \
284  PIN_MODE_INPUT(GPIOA_PWM_PIN11) | \
285  PIN_MODE_INPUT(GPIOA_PWM_PIN12) | \
286  PIN_MODE_ALTERNATE(GPIOA_SWD) | \
287  PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
288  PIN_MODE_INPUT(GPIOA_PIN15))
289 
290 #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
291  PIN_OTYPE_PUSHPULL(GPIOA_ADC_VDD) | \
292  PIN_OTYPE_PUSHPULL(GPIOA_UART2TX) | \
293  PIN_OTYPE_PUSHPULL(GPIOA_UART2RX) | \
294  PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
295  PIN_OTYPE_PUSHPULL(GPIOA_ADC1) | \
296  PIN_OTYPE_PUSHPULL(GPIOA_ADC2) | \
297  PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
298  PIN_OTYPE_PUSHPULL(GPIOA_LED_RED) | \
299  PIN_OTYPE_PUSHPULL(GPIOA_UART1TX) | \
300  PIN_OTYPE_PUSHPULL(GPIOA_UART1RX) | \
301  PIN_OTYPE_OPENDRAIN(GPIOA_PWM_PIN11) | \
302  PIN_OTYPE_OPENDRAIN(GPIOA_PWM_PIN12) | \
303  PIN_OTYPE_PUSHPULL(GPIOA_SWD) | \
304  PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
305  PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
306 
307 #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) |\
308  PIN_OSPEED_VERYLOW(GPIOA_ADC_VDD) | \
309  PIN_OSPEED_HIGH(GPIOA_UART2TX) | \
310  PIN_OSPEED_HIGH(GPIOA_UART2RX) | \
311  PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
312  PIN_OSPEED_VERYLOW(GPIOA_ADC1) | \
313  PIN_OSPEED_VERYLOW(GPIOA_ADC2) | \
314  PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
315  PIN_OSPEED_VERYLOW(GPIOA_LED_RED) | \
316  PIN_OSPEED_HIGH(GPIOA_UART1TX) | \
317  PIN_OSPEED_HIGH(GPIOA_UART1RX) | \
318  PIN_OSPEED_VERYLOW(GPIOA_PWM_PIN11) | \
319  PIN_OSPEED_VERYLOW(GPIOA_PWM_PIN12) | \
320  PIN_OSPEED_HIGH(GPIOA_SWD) | \
321  PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
322  PIN_OSPEED_VERYLOW(GPIOA_PIN15))
323 
324 #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) |\
325  PIN_PUPDR_FLOATING(GPIOA_ADC_VDD) | \
326  PIN_PUPDR_FLOATING(GPIOA_UART2TX) | \
327  PIN_PUPDR_FLOATING(GPIOA_UART2RX) | \
328  PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
329  PIN_PUPDR_FLOATING(GPIOA_ADC1) | \
330  PIN_PUPDR_FLOATING(GPIOA_ADC2) | \
331  PIN_PUPDR_FLOATING(GPIOA_PIN7) | \
332  PIN_PUPDR_FLOATING(GPIOA_LED_RED) | \
333  PIN_PUPDR_FLOATING(GPIOA_UART1TX) | \
334  PIN_PUPDR_FLOATING(GPIOA_UART1RX) | \
335  PIN_PUPDR_PULLDOWN(GPIOA_PWM_PIN11) | \
336  PIN_PUPDR_PULLDOWN(GPIOA_PWM_PIN12) | \
337  PIN_PUPDR_PULLUP(GPIOA_SWD) | \
338  PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
339  PIN_PUPDR_FLOATING(GPIOA_PIN15))
340 #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
341  PIN_ODR_HIGH(GPIOA_ADC_VDD) | \
342  PIN_ODR_HIGH(GPIOA_UART2TX) | \
343  PIN_ODR_HIGH(GPIOA_UART2RX) | \
344  PIN_ODR_HIGH(GPIOA_PIN4) | \
345  PIN_ODR_HIGH(GPIOA_ADC1) | \
346  PIN_ODR_HIGH(GPIOA_ADC2) | \
347  PIN_ODR_LOW(GPIOA_PIN7) | \
348  PIN_ODR_HIGH(GPIOA_LED_RED) | \
349  PIN_ODR_HIGH(GPIOA_UART1TX) | \
350  PIN_ODR_HIGH(GPIOA_UART1RX) | \
351  PIN_ODR_HIGH(GPIOA_PWM_PIN11) | \
352  PIN_ODR_HIGH(GPIOA_PWM_PIN12) | \
353  PIN_ODR_HIGH(GPIOA_SWD) | \
354  PIN_ODR_HIGH(GPIOA_SWCLK) | \
355  PIN_ODR_HIGH(GPIOA_PIN15))
356 #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \
357  PIN_AFIO_AF(GPIOA_ADC_VDD, 0U) | \
358  PIN_AFIO_AF(GPIOA_UART2TX, 7U) | \
359  PIN_AFIO_AF(GPIOA_UART2RX, 7U) | \
360  PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
361  PIN_AFIO_AF(GPIOA_ADC1, 0U) | \
362  PIN_AFIO_AF(GPIOA_ADC2, 0U) | \
363  PIN_AFIO_AF(GPIOA_PIN7, 0U))
364 #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_LED_RED, 0U) | \
365  PIN_AFIO_AF(GPIOA_UART1TX, 7U) | \
366  PIN_AFIO_AF(GPIOA_UART1RX, 7U) | \
367  PIN_AFIO_AF(GPIOA_PWM_PIN11, 2U) | \
368  PIN_AFIO_AF(GPIOA_PWM_PIN12, 2U) | \
369  PIN_AFIO_AF(GPIOA_SWD, 0U) | \
370  PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
371  PIN_AFIO_AF(GPIOA_PIN15, 0U))
372 
373 /*
374  * GPIOB setup:
375  *
376  * PB0 - MIC_IN (analog).
377  * PB1 - ADC_POT_IN (analog).
378  * PB2 - PIN2 (input pullup).
379  * PB3 - SWO (alternate 0).
380  * PB4 - JTRST (input floating).
381  * PB5 - PIN5 (input pullup).
382  * PB6 - I2C1_SCL (alternate 4).
383  * PB7 - I2C1_SDA (alternate 4).
384  * PB8 - PIN8 (input pullup).
385  * PB9 - PIN9 (input pullup).
386  * PB10 - PIN10 (input pullup).
387  * PB11 - PIN11 (input pullup).
388  * PB12 - PIN12 (input pullup).
389  * PB13 - PIN13 (input pullup).
390  * PB14 - PIN14 (input pullup).
391  * PB15 - PIN15 (input pullup).
392  */
393 #define VAL_GPIOB_MODER (PIN_MODE_ANALOG(GPIOB_MIC_IN) | \
394  PIN_MODE_ANALOG(GPIOB_ADC_POT_IN) | \
395  PIN_MODE_INPUT(GPIOB_PIN2) | \
396  PIN_MODE_ALTERNATE(GPIOB_SWO) | \
397  PIN_MODE_INPUT(GPIOB_JTRST) | \
398  PIN_MODE_INPUT(GPIOB_PIN5) | \
399  PIN_MODE_ALTERNATE(GPIOB_I2C1_SCL) | \
400  PIN_MODE_ALTERNATE(GPIOB_I2C1_SDA) | \
401  PIN_MODE_INPUT(GPIOB_PIN8) | \
402  PIN_MODE_INPUT(GPIOB_PIN9) | \
403  PIN_MODE_INPUT(GPIOB_PIN10) | \
404  PIN_MODE_INPUT(GPIOB_PIN11) | \
405  PIN_MODE_INPUT(GPIOB_PIN12) | \
406  PIN_MODE_INPUT(GPIOB_PIN13) | \
407  PIN_MODE_INPUT(GPIOB_PIN14) | \
408  PIN_MODE_INPUT(GPIOB_PIN15))
409 #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_MIC_IN) | \
410  PIN_OTYPE_PUSHPULL(GPIOB_ADC_POT_IN) | \
411  PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
412  PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
413  PIN_OTYPE_PUSHPULL(GPIOB_JTRST) | \
414  PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
415  PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SCL) | \
416  PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SDA) | \
417  PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
418  PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
419  PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
420  PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
421  PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
422  PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
423  PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
424  PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
425 #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_MIC_IN) | \
426  PIN_OSPEED_VERYLOW(GPIOB_ADC_POT_IN) | \
427  PIN_OSPEED_VERYLOW(GPIOB_PIN2) | \
428  PIN_OSPEED_HIGH(GPIOB_SWO) | \
429  PIN_OSPEED_HIGH(GPIOB_JTRST) | \
430  PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
431  PIN_OSPEED_HIGH(GPIOB_I2C1_SCL) | \
432  PIN_OSPEED_HIGH(GPIOB_I2C1_SDA) | \
433  PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \
434  PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \
435  PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \
436  PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \
437  PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \
438  PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \
439  PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \
440  PIN_OSPEED_VERYLOW(GPIOB_PIN15))
441 #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_MIC_IN) | \
442  PIN_PUPDR_FLOATING(GPIOB_ADC_POT_IN) | \
443  PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
444  PIN_PUPDR_FLOATING(GPIOB_SWO) | \
445  PIN_PUPDR_FLOATING(GPIOB_JTRST) | \
446  PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
447  PIN_PUPDR_FLOATING(GPIOB_I2C1_SCL) | \
448  PIN_PUPDR_FLOATING(GPIOB_I2C1_SDA) | \
449  PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
450  PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
451  PIN_PUPDR_PULLUP(GPIOB_PIN10) | \
452  PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
453  PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
454  PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
455  PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
456  PIN_PUPDR_PULLUP(GPIOB_PIN15))
457 #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_MIC_IN) | \
458  PIN_ODR_HIGH(GPIOB_ADC_POT_IN) | \
459  PIN_ODR_HIGH(GPIOB_PIN2) | \
460  PIN_ODR_HIGH(GPIOB_SWO) | \
461  PIN_ODR_HIGH(GPIOB_JTRST) | \
462  PIN_ODR_HIGH(GPIOB_PIN5) | \
463  PIN_ODR_HIGH(GPIOB_I2C1_SCL) | \
464  PIN_ODR_HIGH(GPIOB_I2C1_SDA) | \
465  PIN_ODR_HIGH(GPIOB_PIN8) | \
466  PIN_ODR_HIGH(GPIOB_PIN9) | \
467  PIN_ODR_HIGH(GPIOB_PIN10) | \
468  PIN_ODR_HIGH(GPIOB_PIN11) | \
469  PIN_ODR_HIGH(GPIOB_PIN12) | \
470  PIN_ODR_HIGH(GPIOB_PIN13) | \
471  PIN_ODR_HIGH(GPIOB_PIN14) | \
472  PIN_ODR_HIGH(GPIOB_PIN15))
473 #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_MIC_IN, 0U) | \
474  PIN_AFIO_AF(GPIOB_ADC_POT_IN, 0U) | \
475  PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
476  PIN_AFIO_AF(GPIOB_SWO, 0U) | \
477  PIN_AFIO_AF(GPIOB_JTRST, 0U) | \
478  PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
479  PIN_AFIO_AF(GPIOB_I2C1_SCL, 4U) | \
480  PIN_AFIO_AF(GPIOB_I2C1_SDA, 4U))
481 #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
482  PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
483  PIN_AFIO_AF(GPIOB_PIN10, 0U) | \
484  PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
485  PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
486  PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
487  PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
488  PIN_AFIO_AF(GPIOB_PIN15, 0U))
489 
490 /*
491  * GPIOC setup:
492  *
493  * PC0 - LED1 (output opendrain maximum).
494  * PC1 - LED2 (output opendrain maximum).
495  * PC2 - LED3 (output opendrain maximum).
496  * PC3 - LED4 (output opendrain maximum).
497  * PC4 - PIN4 (input pullup).
498  * PC5 - USB_DISCONNECT (output pushpull maximum).
499  * PC6 - PIN6 (input pullup).
500  * PC7 - PIN7 (input pullup).
501  * PC8 - PIN8 (input pullup).
502  * PC9 - PIN9 (input pullup).
503  * PC10 - SPI3_SCK (alternate 6).
504  * PC11 - SPI3_MISO (alternate 6).
505  * PC12 - SPI3_MOSI (alternate 6).
506  * PC13 - PIN13 (input pullup).
507  * PC14 - OSC32_IN (input floating).
508  * PC15 - OSC32_OUT (input floating).
509  */
510 #define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(GPIOC_LED1) | \
511  PIN_MODE_OUTPUT(GPIOC_LED2) | \
512  PIN_MODE_OUTPUT(GPIOC_LED3) | \
513  PIN_MODE_OUTPUT(GPIOC_LED4) | \
514  PIN_MODE_INPUT(GPIOC_PIN4) | \
515  PIN_MODE_OUTPUT(GPIOC_USB_DISCONNECT) |\
516  PIN_MODE_INPUT(GPIOC_PIN6) | \
517  PIN_MODE_INPUT(GPIOC_PIN7) | \
518  PIN_MODE_INPUT(GPIOC_PIN8) | \
519  PIN_MODE_INPUT(GPIOC_PIN9) | \
520  PIN_MODE_INPUT(GPIOC_PIN10) | \
521  PIN_MODE_INPUT(GPIOC_PIN11) | \
522  PIN_MODE_INPUT(GPIOC_PIN12) | \
523  PIN_MODE_INPUT(GPIOC_PIN13) | \
524  PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
525  PIN_MODE_INPUT(GPIOC_OSC32_OUT))
526 #define VAL_GPIOC_OTYPER (PIN_OTYPE_OPENDRAIN(GPIOC_LED1) | \
527  PIN_OTYPE_OPENDRAIN(GPIOC_LED2) | \
528  PIN_OTYPE_OPENDRAIN(GPIOC_LED3) | \
529  PIN_OTYPE_OPENDRAIN(GPIOC_LED4) | \
530  PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
531  PIN_OTYPE_PUSHPULL(GPIOC_USB_DISCONNECT) |\
532  PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
533  PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
534  PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
535  PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
536  PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
537  PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
538  PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
539  PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
540  PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
541  PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
542 #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_LED1) | \
543  PIN_OSPEED_HIGH(GPIOC_LED2) | \
544  PIN_OSPEED_HIGH(GPIOC_LED3) | \
545  PIN_OSPEED_HIGH(GPIOC_LED4) | \
546  PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \
547  PIN_OSPEED_HIGH(GPIOC_USB_DISCONNECT) |\
548  PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \
549  PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \
550  PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
551  PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \
552  PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \
553  PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
554  PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
555  PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \
556  PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
557  PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
558 #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_LED1) | \
559  PIN_PUPDR_FLOATING(GPIOC_LED2) | \
560  PIN_PUPDR_FLOATING(GPIOC_LED3) | \
561  PIN_PUPDR_FLOATING(GPIOC_LED4) | \
562  PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
563  PIN_PUPDR_FLOATING(GPIOC_USB_DISCONNECT) |\
564  PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
565  PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
566  PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
567  PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
568  PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
569  PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
570  PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
571  PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
572  PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
573  PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
574 #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_LED1) | \
575  PIN_ODR_HIGH(GPIOC_LED2) | \
576  PIN_ODR_HIGH(GPIOC_LED3) | \
577  PIN_ODR_HIGH(GPIOC_LED4) | \
578  PIN_ODR_HIGH(GPIOC_PIN4) | \
579  PIN_ODR_HIGH(GPIOC_USB_DISCONNECT) | \
580  PIN_ODR_HIGH(GPIOC_PIN6) | \
581  PIN_ODR_HIGH(GPIOC_PIN7) | \
582  PIN_ODR_HIGH(GPIOC_PIN8) | \
583  PIN_ODR_HIGH(GPIOC_PIN9) | \
584  PIN_ODR_HIGH(GPIOC_PIN10) | \
585  PIN_ODR_HIGH(GPIOC_PIN11) | \
586  PIN_ODR_HIGH(GPIOC_PIN12) | \
587  PIN_ODR_HIGH(GPIOC_PIN13) | \
588  PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
589  PIN_ODR_HIGH(GPIOC_OSC32_OUT))
590 #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_LED1, 0U) | \
591  PIN_AFIO_AF(GPIOC_LED2, 0U) | \
592  PIN_AFIO_AF(GPIOC_LED3, 0U) | \
593  PIN_AFIO_AF(GPIOC_LED4, 0U) | \
594  PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
595  PIN_AFIO_AF(GPIOC_USB_DISCONNECT, 0U) |\
596  PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
597  PIN_AFIO_AF(GPIOC_PIN7, 0U))
598 #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
599  PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
600  PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
601  PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
602  PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
603  PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
604  PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
605  PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
606 
607 /*
608  * GPIOD setup:
609  *
610  * PD0 - CAN_RX (alternate 7).
611  * PD1 - CAN_TX (alternate 7).
612  * PD2 - LCD_CS (output pushpull maximum).
613  * PD3 - USART2_CTS (alternate 7).
614  * PD4 - USART2_RST (alternate 7).
615  * PD5 - USART2_TX (alternate 7).
616  * PD6 - USART2_RX (alternate 7).
617  * PD7 - PIN7 (input pullup).
618  * PD8 - PIN8 (input pullup).
619  * PD9 - PIN9 (input pullup).
620  * PD10 - PIN10 (input pullup).
621  * PD11 - AUDIO_RST (output pushpull maximum).
622  * PD12 - PIN12 (input pullup).
623  * PD13 - PIN13 (input pullup).
624  * PD14 - PIN14 (input pullup).
625  * PD15 - PIN15 (input pullup).
626  */
627 #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(GPIOD_CAN_RX) | \
628  PIN_MODE_ALTERNATE(GPIOD_CAN_TX) | \
629  PIN_MODE_OUTPUT(GPIOD_LCD_CS) | \
630  PIN_MODE_ALTERNATE(GPIOD_USART2_CTS) | \
631  PIN_MODE_ALTERNATE(GPIOD_USART2_RST) | \
632  PIN_MODE_ALTERNATE(GPIOD_USART2_TX) | \
633  PIN_MODE_ALTERNATE(GPIOD_USART2_RX) | \
634  PIN_MODE_INPUT(GPIOD_PIN7) | \
635  PIN_MODE_OUTPUT(GPIOD_LED_GREEN) | \
636  PIN_MODE_INPUT(GPIOD_PIN9) | \
637  PIN_MODE_INPUT(GPIOD_PIN10) | \
638  PIN_MODE_OUTPUT(GPIOD_AUDIO_RST) | \
639  PIN_MODE_INPUT(GPIOD_PIN12) | \
640  PIN_MODE_INPUT(GPIOD_PIN13) | \
641  PIN_MODE_INPUT(GPIOD_PIN14) | \
642  PIN_MODE_INPUT(GPIOD_PIN15))
643 #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_CAN_RX) | \
644  PIN_OTYPE_PUSHPULL(GPIOD_CAN_TX) | \
645  PIN_OTYPE_PUSHPULL(GPIOD_LCD_CS) | \
646  PIN_OTYPE_PUSHPULL(GPIOD_USART2_CTS) | \
647  PIN_OTYPE_PUSHPULL(GPIOD_USART2_RST) | \
648  PIN_OTYPE_PUSHPULL(GPIOD_USART2_TX) | \
649  PIN_OTYPE_PUSHPULL(GPIOD_USART2_RX) | \
650  PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
651  PIN_OTYPE_PUSHPULL(GPIOD_LED_GREEN) | \
652  PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
653  PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
654  PIN_OTYPE_PUSHPULL(GPIOD_AUDIO_RST) | \
655  PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
656  PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
657  PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
658  PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
659 #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_CAN_RX) | \
660  PIN_OSPEED_HIGH(GPIOD_CAN_TX) | \
661  PIN_OSPEED_HIGH(GPIOD_LCD_CS) | \
662  PIN_OSPEED_HIGH(GPIOD_USART2_CTS) | \
663  PIN_OSPEED_HIGH(GPIOD_USART2_RST) | \
664  PIN_OSPEED_HIGH(GPIOD_USART2_TX) | \
665  PIN_OSPEED_HIGH(GPIOD_USART2_RX) | \
666  PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
667  PIN_OSPEED_VERYLOW(GPIOD_LED_GREEN) | \
668  PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
669  PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
670  PIN_OSPEED_HIGH(GPIOD_AUDIO_RST) | \
671  PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
672  PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \
673  PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
674  PIN_OSPEED_VERYLOW(GPIOD_PIN15))
675 #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_CAN_RX) | \
676  PIN_PUPDR_FLOATING(GPIOD_CAN_TX) | \
677  PIN_PUPDR_FLOATING(GPIOD_LCD_CS) | \
678  PIN_PUPDR_FLOATING(GPIOD_USART2_CTS) | \
679  PIN_PUPDR_FLOATING(GPIOD_USART2_RST) | \
680  PIN_PUPDR_FLOATING(GPIOD_USART2_TX) | \
681  PIN_PUPDR_FLOATING(GPIOD_USART2_RX) | \
682  PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
683  PIN_PUPDR_PULLUP(GPIOD_LED_GREEN) | \
684  PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
685  PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
686  PIN_PUPDR_FLOATING(GPIOD_AUDIO_RST) | \
687  PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
688  PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
689  PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
690  PIN_PUPDR_PULLUP(GPIOD_PIN15))
691 #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_CAN_RX) | \
692  PIN_ODR_HIGH(GPIOD_CAN_TX) | \
693  PIN_ODR_HIGH(GPIOD_LCD_CS) | \
694  PIN_ODR_HIGH(GPIOD_USART2_CTS) | \
695  PIN_ODR_HIGH(GPIOD_USART2_RST) | \
696  PIN_ODR_HIGH(GPIOD_USART2_TX) | \
697  PIN_ODR_HIGH(GPIOD_USART2_RX) | \
698  PIN_ODR_HIGH(GPIOD_PIN7) | \
699  PIN_ODR_HIGH(GPIOD_LED_GREEN) | \
700  PIN_ODR_HIGH(GPIOD_PIN9) | \
701  PIN_ODR_HIGH(GPIOD_PIN10) | \
702  PIN_ODR_LOW(GPIOD_AUDIO_RST) | \
703  PIN_ODR_HIGH(GPIOD_PIN12) | \
704  PIN_ODR_HIGH(GPIOD_PIN13) | \
705  PIN_ODR_HIGH(GPIOD_PIN14) | \
706  PIN_ODR_HIGH(GPIOD_PIN15))
707 #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_CAN_RX, 7U) | \
708  PIN_AFIO_AF(GPIOD_CAN_TX, 7U) | \
709  PIN_AFIO_AF(GPIOD_LCD_CS, 0U) | \
710  PIN_AFIO_AF(GPIOD_USART2_CTS, 7U) | \
711  PIN_AFIO_AF(GPIOD_USART2_RST, 7U) | \
712  PIN_AFIO_AF(GPIOD_USART2_TX, 7U) | \
713  PIN_AFIO_AF(GPIOD_USART2_RX, 7U) | \
714  PIN_AFIO_AF(GPIOD_PIN7, 0U))
715 #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_LED_GREEN, 0U) | \
716  PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
717  PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
718  PIN_AFIO_AF(GPIOD_AUDIO_RST, 0U) | \
719  PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
720  PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
721  PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
722  PIN_AFIO_AF(GPIOD_PIN15, 0U))
723 
724 /*
725  * GPIOE setup:
726  *
727  * PE0 - PIN0 (input pullup).
728  * PE1 - PIN1 (input pullup).
729  * PE2 - SD_CS (output opendrain maximum).
730  * PE3 - SD_DETECT (input pullup).
731  * PE4 - PIN4 (input pullup).
732  * PE5 - PIN5 (input pullup).
733  * PE6 - JOY_SEL (input pulldown).
734  * PE7 - RTD_IN (analog).
735  * PE8 - PRESSUREP (analog).
736  * PE9 - PRESSUREN (analog).
737  * PE10 - PIN10 (input pullup).
738  * PE11 - PIN11 (input pullup).
739  * PE12 - PIN12 (input pullup).
740  * PE13 - PIN13 (input pullup).
741  * PE14 - PRESSURE_TEPM (input floating).
742  * PE15 - PIN15 (input pullup).
743  */
744 #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
745  PIN_MODE_INPUT(GPIOE_PIN1) | \
746  PIN_MODE_OUTPUT(GPIOE_SD_CS) | \
747  PIN_MODE_INPUT(GPIOE_SD_DETECT) | \
748  PIN_MODE_INPUT(GPIOE_PIN4) | \
749  PIN_MODE_INPUT(GPIOE_PIN5) | \
750  PIN_MODE_INPUT(GPIOE_JOY_SEL) | \
751  PIN_MODE_ANALOG(GPIOE_RTD_IN) | \
752  PIN_MODE_ANALOG(GPIOE_PRESSUREP) | \
753  PIN_MODE_ANALOG(GPIOE_PRESSUREN) | \
754  PIN_MODE_INPUT(GPIOE_PIN10) | \
755  PIN_MODE_INPUT(GPIOE_PIN11) | \
756  PIN_MODE_INPUT(GPIOE_PIN12) | \
757  PIN_MODE_INPUT(GPIOE_PIN13) | \
758  PIN_MODE_INPUT(GPIOE_PRESSURE_TEPM) | \
759  PIN_MODE_INPUT(GPIOE_PIN15))
760 #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
761  PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
762  PIN_OTYPE_OPENDRAIN(GPIOE_SD_CS) | \
763  PIN_OTYPE_PUSHPULL(GPIOE_SD_DETECT) | \
764  PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
765  PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
766  PIN_OTYPE_PUSHPULL(GPIOE_JOY_SEL) | \
767  PIN_OTYPE_PUSHPULL(GPIOE_RTD_IN) | \
768  PIN_OTYPE_PUSHPULL(GPIOE_PRESSUREP) | \
769  PIN_OTYPE_PUSHPULL(GPIOE_PRESSUREN) | \
770  PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
771  PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
772  PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
773  PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
774  PIN_OTYPE_PUSHPULL(GPIOE_PRESSURE_TEPM) |\
775  PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
776 #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \
777  PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \
778  PIN_OSPEED_HIGH(GPIOE_SD_CS) | \
779  PIN_OSPEED_HIGH(GPIOE_SD_DETECT) | \
780  PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \
781  PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \
782  PIN_OSPEED_HIGH(GPIOE_JOY_SEL) | \
783  PIN_OSPEED_VERYLOW(GPIOE_RTD_IN) | \
784  PIN_OSPEED_HIGH(GPIOE_PRESSUREP) | \
785  PIN_OSPEED_HIGH(GPIOE_PRESSUREN) | \
786  PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \
787  PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \
788  PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \
789  PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \
790  PIN_OSPEED_VERYLOW(GPIOE_PRESSURE_TEPM) |\
791  PIN_OSPEED_VERYLOW(GPIOE_PIN15))
792 #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
793  PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
794  PIN_PUPDR_FLOATING(GPIOE_SD_CS) | \
795  PIN_PUPDR_PULLUP(GPIOE_SD_DETECT) | \
796  PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
797  PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
798  PIN_PUPDR_PULLDOWN(GPIOE_JOY_SEL) | \
799  PIN_PUPDR_FLOATING(GPIOE_RTD_IN) | \
800  PIN_PUPDR_FLOATING(GPIOE_PRESSUREP) | \
801  PIN_PUPDR_FLOATING(GPIOE_PRESSUREN) | \
802  PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
803  PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
804  PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
805  PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
806  PIN_PUPDR_FLOATING(GPIOE_PRESSURE_TEPM) |\
807  PIN_PUPDR_PULLUP(GPIOE_PIN15))
808 #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
809  PIN_ODR_HIGH(GPIOE_PIN1) | \
810  PIN_ODR_HIGH(GPIOE_SD_CS) | \
811  PIN_ODR_HIGH(GPIOE_SD_DETECT) | \
812  PIN_ODR_HIGH(GPIOE_PIN4) | \
813  PIN_ODR_HIGH(GPIOE_PIN5) | \
814  PIN_ODR_HIGH(GPIOE_JOY_SEL) | \
815  PIN_ODR_HIGH(GPIOE_RTD_IN) | \
816  PIN_ODR_HIGH(GPIOE_PRESSUREP) | \
817  PIN_ODR_HIGH(GPIOE_PRESSUREN) | \
818  PIN_ODR_HIGH(GPIOE_PIN10) | \
819  PIN_ODR_HIGH(GPIOE_PIN11) | \
820  PIN_ODR_HIGH(GPIOE_PIN12) | \
821  PIN_ODR_LOW(GPIOE_PIN13) | \
822  PIN_ODR_LOW(GPIOE_PRESSURE_TEPM) | \
823  PIN_ODR_LOW(GPIOE_PIN15))
824 #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
825  PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
826  PIN_AFIO_AF(GPIOE_SD_CS, 0U) | \
827  PIN_AFIO_AF(GPIOE_SD_DETECT, 0U) | \
828  PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
829  PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
830  PIN_AFIO_AF(GPIOE_JOY_SEL, 0U) | \
831  PIN_AFIO_AF(GPIOE_RTD_IN, 0U))
832 #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PRESSUREP, 0U) | \
833  PIN_AFIO_AF(GPIOE_PRESSUREN, 0U) | \
834  PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
835  PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
836  PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
837  PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
838  PIN_AFIO_AF(GPIOE_PRESSURE_TEPM, 0U) | \
839  PIN_AFIO_AF(GPIOE_PIN15, 0U))
840 
841 /*
842  * GPIOF setup:
843  *
844  * PF0 - OSC_IN (input floating).
845  * PF1 - OSC_OUT (input floating).
846  * PF2 - JOY_DOWN (input pulldown).
847  * PF3 - PIN3 (input pullup).
848  * PF4 - JOY_LEFT (input pulldown).
849  * PF5 - PIN5 (input pullup).
850  * PF6 - PIN6 (input pullup).
851  * PF7 - PIN7 (input pullup).
852  * PF8 - PIN8 (input pullup).
853  * PF9 - JOY_RIGHT (input pulldown).
854  * PF10 - JOY_UP (input pulldown).
855  * PF11 - PIN11 (input pullup).
856  * PF12 - PIN12 (input pullup).
857  * PF13 - PIN13 (input pullup).
858  * PF14 - PIN14 (input pullup).
859  * PF15 - PIN15 (input pullup).
860  */
861 #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | \
862  PIN_MODE_INPUT(GPIOF_OSC_OUT) | \
863  PIN_MODE_INPUT(GPIOF_JOY_DOWN) | \
864  PIN_MODE_INPUT(GPIOF_PIN3) | \
865  PIN_MODE_INPUT(GPIOF_JOY_LEFT) | \
866  PIN_MODE_INPUT(GPIOF_PIN5) | \
867  PIN_MODE_ALTERNATE(GPIOF_I2C2_SCL) | \
868  PIN_MODE_ALTERNATE(GPIOF_I2C2_SDA) | \
869  PIN_MODE_INPUT(GPIOF_PIN8) | \
870  PIN_MODE_INPUT(GPIOF_JOY_RIGHT) | \
871  PIN_MODE_INPUT(GPIOF_JOY_UP) | \
872  PIN_MODE_INPUT(GPIOF_PIN11) | \
873  PIN_MODE_INPUT(GPIOF_PIN12) | \
874  PIN_MODE_INPUT(GPIOF_PIN13) | \
875  PIN_MODE_INPUT(GPIOF_PIN14) | \
876  PIN_MODE_INPUT(GPIOF_PIN15))
877 #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | \
878  PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | \
879  PIN_OTYPE_PUSHPULL(GPIOF_JOY_DOWN) | \
880  PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
881  PIN_OTYPE_PUSHPULL(GPIOF_JOY_LEFT) | \
882  PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
883  PIN_OTYPE_OPENDRAIN(GPIOF_I2C2_SCL) | \
884  PIN_OTYPE_OPENDRAIN(GPIOF_I2C2_SDA) | \
885  PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
886  PIN_OTYPE_PUSHPULL(GPIOF_JOY_RIGHT) | \
887  PIN_OTYPE_PUSHPULL(GPIOF_JOY_UP) | \
888  PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
889  PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
890  PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
891  PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
892  PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
893 #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_OSC_IN) | \
894  PIN_OSPEED_HIGH(GPIOF_OSC_OUT) | \
895  PIN_OSPEED_HIGH(GPIOF_JOY_DOWN) | \
896  PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \
897  PIN_OSPEED_HIGH(GPIOF_JOY_LEFT) | \
898  PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \
899  PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | \
900  PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | \
901  PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \
902  PIN_OSPEED_HIGH(GPIOF_JOY_RIGHT) | \
903  PIN_OSPEED_HIGH(GPIOF_JOY_UP) | \
904  PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \
905  PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \
906  PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \
907  PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \
908  PIN_OSPEED_VERYLOW(GPIOF_PIN15))
909 #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | \
910  PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | \
911  PIN_PUPDR_PULLDOWN(GPIOF_JOY_DOWN) | \
912  PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
913  PIN_PUPDR_PULLDOWN(GPIOF_JOY_LEFT) | \
914  PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
915  PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | \
916  PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | \
917  PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
918  PIN_PUPDR_PULLDOWN(GPIOF_JOY_RIGHT) | \
919  PIN_PUPDR_PULLDOWN(GPIOF_JOY_UP) | \
920  PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
921  PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
922  PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
923  PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
924  PIN_PUPDR_PULLUP(GPIOF_PIN15))
925 #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | \
926  PIN_ODR_HIGH(GPIOF_OSC_OUT) | \
927  PIN_ODR_HIGH(GPIOF_JOY_DOWN) | \
928  PIN_ODR_HIGH(GPIOF_PIN3) | \
929  PIN_ODR_HIGH(GPIOF_JOY_LEFT) | \
930  PIN_ODR_HIGH(GPIOF_PIN5) | \
931  PIN_ODR_HIGH(GPIOF_I2C2_SCL) | \
932  PIN_ODR_HIGH(GPIOF_I2C2_SDA) | \
933  PIN_ODR_HIGH(GPIOF_PIN8) | \
934  PIN_ODR_HIGH(GPIOF_JOY_RIGHT) | \
935  PIN_ODR_HIGH(GPIOF_JOY_UP) | \
936  PIN_ODR_HIGH(GPIOF_PIN11) | \
937  PIN_ODR_HIGH(GPIOF_PIN12) | \
938  PIN_ODR_HIGH(GPIOF_PIN13) | \
939  PIN_ODR_HIGH(GPIOF_PIN14) | \
940  PIN_ODR_HIGH(GPIOF_PIN15))
941 #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | \
942  PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | \
943  PIN_AFIO_AF(GPIOF_JOY_DOWN, 0U) | \
944  PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
945  PIN_AFIO_AF(GPIOF_JOY_LEFT, 0U) | \
946  PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
947  PIN_AFIO_AF(GPIOF_I2C2_SCL, 4U) | \
948  PIN_AFIO_AF(GPIOF_I2C2_SDA, 4U))
949 #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
950  PIN_AFIO_AF(GPIOF_JOY_RIGHT, 0U) | \
951  PIN_AFIO_AF(GPIOF_JOY_UP, 0U) | \
952  PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
953  PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
954  PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
955  PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
956  PIN_AFIO_AF(GPIOF_PIN15, 0U))
957 
958 /*
959  * GPIOG setup:
960  *
961  * PG0 - PIN0 (input pullup).
962  * PG1 - PIN1 (input pullup).
963  * PG2 - PIN2 (input pullup).
964  * PG3 - PIN3 (input pullup).
965  * PG4 - PIN4 (input pullup).
966  * PG5 - PIN5 (input pullup).
967  * PG6 - PIN6 (input pullup).
968  * PG7 - PIN7 (input pullup).
969  * PG8 - PIN8 (input pullup).
970  * PG9 - PIN9 (input pullup).
971  * PG10 - PIN10 (input pullup).
972  * PG11 - PIN11 (input pullup).
973  * PG12 - PIN12 (input pullup).
974  * PG13 - PIN13 (input pullup).
975  * PG14 - PIN14 (input pullup).
976  * PG15 - PIN15 (input pullup).
977  */
978 #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \
979  PIN_MODE_INPUT(GPIOG_PIN1) | \
980  PIN_MODE_INPUT(GPIOG_PIN2) | \
981  PIN_MODE_INPUT(GPIOG_PIN3) | \
982  PIN_MODE_INPUT(GPIOG_PIN4) | \
983  PIN_MODE_INPUT(GPIOG_PIN5) | \
984  PIN_MODE_INPUT(GPIOG_PIN6) | \
985  PIN_MODE_INPUT(GPIOG_PIN7) | \
986  PIN_MODE_INPUT(GPIOG_PIN8) | \
987  PIN_MODE_INPUT(GPIOG_PIN9) | \
988  PIN_MODE_INPUT(GPIOG_PIN10) | \
989  PIN_MODE_INPUT(GPIOG_PIN11) | \
990  PIN_MODE_INPUT(GPIOG_PIN12) | \
991  PIN_MODE_INPUT(GPIOG_PIN13) | \
992  PIN_MODE_INPUT(GPIOG_PIN14) | \
993  PIN_MODE_INPUT(GPIOG_PIN15))
994 #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
995  PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
996  PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
997  PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
998  PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
999  PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
1000  PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
1001  PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
1002  PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
1003  PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
1004  PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
1005  PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
1006  PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
1007  PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
1008  PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
1009  PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1010 #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
1011  PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
1012  PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
1013  PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
1014  PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
1015  PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \
1016  PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \
1017  PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \
1018  PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \
1019  PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
1020  PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \
1021  PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \
1022  PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \
1023  PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \
1024  PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \
1025  PIN_OSPEED_VERYLOW(GPIOG_PIN15))
1026 #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \
1027  PIN_PUPDR_PULLUP(GPIOG_PIN1) | \
1028  PIN_PUPDR_PULLUP(GPIOG_PIN2) | \
1029  PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
1030  PIN_PUPDR_PULLUP(GPIOG_PIN4) | \
1031  PIN_PUPDR_PULLUP(GPIOG_PIN5) | \
1032  PIN_PUPDR_PULLUP(GPIOG_PIN6) | \
1033  PIN_PUPDR_PULLUP(GPIOG_PIN7) | \
1034  PIN_PUPDR_PULLUP(GPIOG_PIN8) | \
1035  PIN_PUPDR_PULLUP(GPIOG_PIN9) | \
1036  PIN_PUPDR_PULLUP(GPIOG_PIN10) | \
1037  PIN_PUPDR_PULLUP(GPIOG_PIN11) | \
1038  PIN_PUPDR_PULLUP(GPIOG_PIN12) | \
1039  PIN_PUPDR_PULLUP(GPIOG_PIN13) | \
1040  PIN_PUPDR_PULLUP(GPIOG_PIN14) | \
1041  PIN_PUPDR_PULLUP(GPIOG_PIN15))
1042 #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
1043  PIN_ODR_HIGH(GPIOG_PIN1) | \
1044  PIN_ODR_HIGH(GPIOG_PIN2) | \
1045  PIN_ODR_HIGH(GPIOG_PIN3) | \
1046  PIN_ODR_HIGH(GPIOG_PIN4) | \
1047  PIN_ODR_HIGH(GPIOG_PIN5) | \
1048  PIN_ODR_HIGH(GPIOG_PIN6) | \
1049  PIN_ODR_HIGH(GPIOG_PIN7) | \
1050  PIN_ODR_HIGH(GPIOG_PIN8) | \
1051  PIN_ODR_HIGH(GPIOG_PIN9) | \
1052  PIN_ODR_HIGH(GPIOG_PIN10) | \
1053  PIN_ODR_HIGH(GPIOG_PIN11) | \
1054  PIN_ODR_HIGH(GPIOG_PIN12) | \
1055  PIN_ODR_HIGH(GPIOG_PIN13) | \
1056  PIN_ODR_HIGH(GPIOG_PIN14) | \
1057  PIN_ODR_HIGH(GPIOG_PIN15))
1058 #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
1059  PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
1060  PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
1061  PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
1062  PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
1063  PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
1064  PIN_AFIO_AF(GPIOG_PIN6, 0U) | \
1065  PIN_AFIO_AF(GPIOG_PIN7, 0U))
1066 #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \
1067  PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
1068  PIN_AFIO_AF(GPIOG_PIN10, 0U) | \
1069  PIN_AFIO_AF(GPIOG_PIN11, 0U) | \
1070  PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
1071  PIN_AFIO_AF(GPIOG_PIN13, 0U) | \
1072  PIN_AFIO_AF(GPIOG_PIN14, 0U) | \
1073  PIN_AFIO_AF(GPIOG_PIN15, 0U))
1074 
1075 /*
1076  * GPIOH setup:
1077  *
1078  * PH0 - PIN0 (input pullup).
1079  * PH1 - PIN1 (input pullup).
1080  * PH2 - PIN2 (input pullup).
1081  * PH3 - PIN3 (input pullup).
1082  * PH4 - PIN4 (input pullup).
1083  * PH5 - PIN5 (input pullup).
1084  * PH6 - PIN6 (input pullup).
1085  * PH7 - PIN7 (input pullup).
1086  * PH8 - PIN8 (input pullup).
1087  * PH9 - PIN9 (input pullup).
1088  * PH10 - PIN10 (input pullup).
1089  * PH11 - PIN11 (input pullup).
1090  * PH12 - PIN12 (input pullup).
1091  * PH13 - PIN13 (input pullup).
1092  * PH14 - PIN14 (input pullup).
1093  * PH15 - PIN15 (input pullup).
1094  */
1095 #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \
1096  PIN_MODE_INPUT(GPIOH_PIN1) | \
1097  PIN_MODE_INPUT(GPIOH_PIN2) | \
1098  PIN_MODE_INPUT(GPIOH_PIN3) | \
1099  PIN_MODE_INPUT(GPIOH_PIN4) | \
1100  PIN_MODE_INPUT(GPIOH_PIN5) | \
1101  PIN_MODE_INPUT(GPIOH_PIN6) | \
1102  PIN_MODE_INPUT(GPIOH_PIN7) | \
1103  PIN_MODE_INPUT(GPIOH_PIN8) | \
1104  PIN_MODE_INPUT(GPIOH_PIN9) | \
1105  PIN_MODE_INPUT(GPIOH_PIN10) | \
1106  PIN_MODE_INPUT(GPIOH_PIN11) | \
1107  PIN_MODE_INPUT(GPIOH_PIN12) | \
1108  PIN_MODE_INPUT(GPIOH_PIN13) | \
1109  PIN_MODE_INPUT(GPIOH_PIN14) | \
1110  PIN_MODE_INPUT(GPIOH_PIN15))
1111 #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \
1112  PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \
1113  PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
1114  PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
1115  PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
1116  PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
1117  PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
1118  PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
1119  PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
1120  PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
1121  PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
1122  PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
1123  PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
1124  PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
1125  PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
1126  PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1127 #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \
1128  PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \
1129  PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
1130  PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
1131  PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
1132  PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
1133  PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
1134  PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
1135  PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
1136  PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
1137  PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
1138  PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
1139  PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
1140  PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
1141  PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
1142  PIN_OSPEED_VERYLOW(GPIOH_PIN15))
1143 #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \
1144  PIN_PUPDR_PULLUP(GPIOH_PIN1) | \
1145  PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
1146  PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
1147  PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
1148  PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
1149  PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
1150  PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
1151  PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
1152  PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
1153  PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
1154  PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
1155  PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
1156  PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
1157  PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
1158  PIN_PUPDR_PULLUP(GPIOH_PIN15))
1159 #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \
1160  PIN_ODR_HIGH(GPIOH_PIN1) | \
1161  PIN_ODR_HIGH(GPIOH_PIN2) | \
1162  PIN_ODR_HIGH(GPIOH_PIN3) | \
1163  PIN_ODR_HIGH(GPIOH_PIN4) | \
1164  PIN_ODR_HIGH(GPIOH_PIN5) | \
1165  PIN_ODR_HIGH(GPIOH_PIN6) | \
1166  PIN_ODR_HIGH(GPIOH_PIN7) | \
1167  PIN_ODR_HIGH(GPIOH_PIN8) | \
1168  PIN_ODR_HIGH(GPIOH_PIN9) | \
1169  PIN_ODR_HIGH(GPIOH_PIN10) | \
1170  PIN_ODR_HIGH(GPIOH_PIN11) | \
1171  PIN_ODR_HIGH(GPIOH_PIN12) | \
1172  PIN_ODR_HIGH(GPIOH_PIN13) | \
1173  PIN_ODR_HIGH(GPIOH_PIN14) | \
1174  PIN_ODR_HIGH(GPIOH_PIN15))
1175 #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0U) | \
1176  PIN_AFIO_AF(GPIOH_PIN1, 0U) | \
1177  PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
1178  PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
1179  PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
1180  PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
1181  PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
1182  PIN_AFIO_AF(GPIOH_PIN7, 0U))
1183 #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
1184  PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
1185  PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
1186  PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
1187  PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
1188  PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
1189  PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
1190  PIN_AFIO_AF(GPIOH_PIN15, 0U))
1191 
1192 //*****************************************************************************
1193 
1194 /*
1195  * AHB_CLK
1196  */
1197 #define AHB_CLK STM32_HCLK
1198 
1199 /*
1200  * LEDs
1201  */
1202 /* red */
1203 #ifndef USE_LED_1
1204 #define USE_LED_1 1
1205 #endif
1206 #define LED_1_GPIO GPIOA
1207 #define LED_1_GPIO_PIN GPIO8
1208 #define LED_1_GPIO_ON gpio_clear
1209 #define LED_1_GPIO_OFF gpio_set
1210 
1211 /* green */
1212 #ifndef USE_LED_2
1213 #define USE_LED_2 1
1214 #endif
1215 #define LED_2_GPIO GPIOD
1216 #define LED_2_GPIO_PIN GPIO8
1217 #define LED_2_GPIO_ON gpio_clear
1218 #define LED_2_GPIO_OFF gpio_set
1219 
1220 /*orange */
1221 #ifndef USE_LED_3
1222 #define USE_LED_3 0
1223 #endif
1224 #define LED_3_GPIO GPIOE
1225 #define LED_3_GPIO_PIN GPIO10
1226 #define LED_3_GPIO_ON gpio_clear
1227 #define LED_3_GPIO_OFF gpio_set
1228 
1229 /* green */
1230 #ifndef USE_LED_4
1231 #define USE_LED_4 0
1232 #endif
1233 #define LED_4_GPIO GPIOE
1234 #define LED_4_GPIO_PIN GPIO11
1235 #define LED_4_GPIO_ON gpio_clear
1236 #define LED_4_GPIO_OFF gpio_set
1237 
1238 /* blue*/
1239 #ifndef USE_LED_5
1240 #define USE_LED_5 0
1241 #endif
1242 #define LED_5_GPIO GPIOE
1243 #define LED_5_GPIO_PIN GPIO12
1244 #define LED_5_GPIO_ON gpio_set
1245 #define LED_5_GPIO_OFF gpio_clear
1246 
1247 /* red*/
1248 #ifndef USE_LED_6
1249 #define USE_LED_6 0
1250 #endif
1251 #define LED_6_GPIO GPIOE
1252 #define LED_6_GPIO_PIN GPIO13
1253 #define LED_6_GPIO_ON gpio_set
1254 #define LED_6_GPIO_OFF gpio_clear
1255 
1256 /* orange*/
1257 #ifndef USE_LED_7
1258 #define USE_LED_7 0
1259 #endif
1260 #define LED_7_GPIO GPIOE
1261 #define LED_7_GPIO_PIN GPIO13
1262 #define LED_7_GPIO_ON gpio_set
1263 #define LED_7_GPIO_OFF gpio_clear
1264 
1265 /* green*/
1266 #ifndef USE_LED_8
1267 #define USE_LED_8 0
1268 #endif
1269 #define LED_8_GPIO GPIOE
1270 #define LED_8_GPIO_PIN GPIO15
1271 #define LED_8_GPIO_ON gpio_set
1272 #define LED_8_GPIO_OFF gpio_clear
1273 
1274 
1275 /* Pint to set Uart2 RX polarity, on PB13, output high inverts, low doesn't */
1276 #define RC_POLARITY_GPIO_PORT GPIOB
1277 #define RC_POLARITY_GPIO_PIN GPIO13
1278 
1279 /*
1280  * ADCs
1281  */
1282 // AUX 1
1283 #ifndef USE_ADC_1
1284 #define USE_ADC_1 1
1285 #endif
1286 #if USE_ADC_1
1287 #define AD1_1_CHANNEL ADC_CHANNEL_IN1
1288 #define ADC_1 AD1_1
1289 #define ADC_1_GPIO_PORT GPIOA
1290 #define ADC_1_GPIO_PIN GPIO1
1291 #endif
1292 
1293 // AUX 2
1294 #if USE_ADC_2
1295 #define AD1_2_CHANNEL ADC_CHANNEL_IN15
1296 #define ADC_2 AD1_2
1297 #define ADC_2_GPIO_PORT GPIOA
1298 #define ADC_2_GPIO_PIN GPIO6
1299 #endif
1300 
1301 // AUX 3
1302 #if USE_ADC_3
1303 #define AD1_3_CHANNEL ADC_CHANNEL_IN14
1304 #define ADC_3 AD1_3
1305 #define ADC_3_GPIO_PORT GPIOC
1306 #define ADC_3_GPIO_PIN GPIO4
1307 #endif
1308 
1309 #if USE_ADC_4
1310 #define AD1_4_CHANNEL ADC_CHANNEL_IN4
1311 #define ADC_4 AD1_4
1312 #define ADC_4_GPIO_PORT GPIOA
1313 #define ADC_4_GPIO_PIN GPIO4
1314 #endif
1315 
1317 #ifndef ADC_CHANNEL_VSUPPLY
1318 #define ADC_CHANNEL_VSUPPLY ADC_1
1319 #endif
1320 
1321 #define DefaultVoltageOfAdc(adc) (0.003765*adc)
1322 
1323 #define ACTUATORS_PWM_NB 4
1324 //the first two motors are through the xvert escs
1325 //the second two are two standard pwm servos
1326 
1327 #define XVERT_ESC_0 0
1328 #define XVERT_ESC_1 1
1329 
1330 #ifndef USE_PWM2
1331 #define USE_PWM2 1
1332 #endif
1333 #if USE_PWM2
1334 #define PWM_SERVO_2 2
1335 #define PWM_SERVO_2_GPIO GPIOA
1336 #define PWM_SERVO_2_PIN GPIO11
1337 #define PWM_SERVO_2_AF GPIO_AF2 //alternate function of the pin, alsu used to select which timer (table 12 in datasheet)
1338 #define PWM_SERVO_2_DRIVER PWMD5 //timer ID. Which timer is being used by this pwm pin
1339 #define PWM_SERVO_2_CHANNEL 1 //channel *in* the timer Find it in table 12 (subtract by 1!)
1340 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1341 #else
1342 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
1343 #endif
1344 
1345 #ifndef USE_PWM3
1346 #define USE_PWM3 1
1347 #endif
1348 #if USE_PWM3
1349 #define PWM_SERVO_3 3
1350 #define PWM_SERVO_3_GPIO GPIOA
1351 #define PWM_SERVO_3_PIN GPIO12
1352 #define PWM_SERVO_3_AF GPIO_AF2
1353 #define PWM_SERVO_3_DRIVER PWMD5
1354 #define PWM_SERVO_3_CHANNEL 2
1355 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1356 #else
1357 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
1358 #endif
1359 
1360 #if !STM32_PWM_USE_TIM5
1361 #define PWM_CONF_TIM5 STM32_PWM_USE_TIM5
1362 #else
1363 #define PWM_CONF_TIM5 1
1364 #endif
1365 #define PWM_CONF5_DEF { \
1366  PWM_FREQUENCY, \
1367  PWM_FREQUENCY/TIM5_SERVO_HZ, \
1368  NULL, \
1369  { \
1370  { PWM_SERVO_3_ACTIVE, NULL }, \
1371  { PWM_SERVO_2_ACTIVE, NULL }, \
1372  { PWM_SERVO_3_ACTIVE, NULL }, \
1373  { PWM_SERVO_3_ACTIVE, NULL }, \
1374  }, \
1375  0, \
1376  0 \
1377  }
1378 
1379 
1383 #define RC_PPM_TICKS_PER_USEC 2
1384 #define PPM_TIMER_FREQUENCY 2000000
1385 #define PPM_CHANNEL ICU_CHANNEL_1
1386 #define PPM_TIMER ICUD1
1387 
1389 // * PWM input
1390 // */
1392 //#define PWM_INPUT1_ICU ICUD1
1393 //#define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
1395 //#define PWM_INPUT1_GPIO_PORT GPIOA
1396 //#define PWM_INPUT1_GPIO_PIN GPIO8
1397 //#define PWM_INPUT1_GPIO_AF GPIO_AF1
1398 
1400 //#if (USE_PWM1 && USE_PWM_INPUT2)
1401 //#error "PW1 and PWM_INPUT2 are not compatible"
1402 //#endif
1403 //#define PWM_INPUT2_ICU ICUD9
1404 //#define PWM_INPUT2_CHANNEL ICU_CHANNEL_1
1405 //#define PWM_INPUT2_GPIO_PORT GPIOA
1406 //#define PWM_INPUT2_GPIO_PIN GPIO2
1407 //#define PWM_INPUT2_GPIO_AF GPIO_AF3
1408 
1412 #define I2C1_CFG_DEF { \
1413  STM32_TIMINGR_PRESC(15U) | \
1414  STM32_TIMINGR_SCLDEL(4U) | \
1415  STM32_TIMINGR_SDADEL(2U) | \
1416  STM32_TIMINGR_SCLH(15U) | \
1417  STM32_TIMINGR_SCLL(21U), \
1418  0,0 }
1419 
1420 #define I2C2_CFG_DEF { \
1421  STM32_TIMINGR_PRESC(15U) | \
1422  STM32_TIMINGR_SCLDEL(4U) | \
1423  STM32_TIMINGR_SDADEL(2U) | \
1424  STM32_TIMINGR_SCLH(15U) | \
1425  STM32_TIMINGR_SCLL(21U), \
1426  0,0 }
1427 
1428 
1430 // * SPI Config
1431 // */
1432 //#define SPI1_GPIO_AF GPIO_AF5
1433 //#define SPI1_GPIO_PORT_MISO GPIOA
1434 //#define SPI1_GPIO_MISO GPIO6
1435 //#define SPI1_GPIO_PORT_MOSI GPIOA
1436 //#define SPI1_GPIO_MOSI GPIO7
1437 //#define SPI1_GPIO_PORT_SCK GPIOA
1438 //#define SPI1_GPIO_SCK GPIO5
1439 
1441 //#define SPI_SELECT_SLAVE0_PORT GPIOB
1442 //#define SPI_SELECT_SLAVE0_PIN GPIO9
1444 //#define SPI_SELECT_SLAVE1_PORT GPIOB
1445 //#define SPI_SELECT_SLAVE1_PIN GPIO1
1447 //#define SPI_SELECT_SLAVE2_PORT GPIOC
1448 //#define SPI_SELECT_SLAVE2_PIN GPIO5
1450 //#define SPI_SELECT_SLAVE3_PORT GPIOC
1451 //#define SPI_SELECT_SLAVE3_PIN GPIO4
1453 //#define SPI_SELECT_SLAVE4_PORT GPIOB
1454 //#define SPI_SELECT_SLAVE4_PIN GPIO15
1455 
1462 #ifndef USE_BARO_BOARD
1463 #define USE_BARO_BOARD 1
1464 #endif
1465 
1466 /*
1467  * Actuators for fixedwing
1468  */
1469 /* Default actuators driver */
1470 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
1471 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
1472 #define ActuatorsDefaultInit() ActuatorsPwmInit()
1473 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
1474 
1475 
1477 // * SDIO
1478 // */
1479 //#define SDIO_D0_PORT GPIOC
1480 //#define SDIO_D0_PIN GPIOC_SDIO_D0
1481 //#define SDIO_D1_PORT GPIOC
1482 //#define SDIO_D1_PIN GPIOC_SDIO_D1
1483 //#define SDIO_D2_PORT GPIOC
1484 //#define SDIO_D2_PIN GPIOC_SDIO_D2
1485 //#define SDIO_D3_PORT GPIOC
1486 //#define SDIO_D3_PIN GPIOC_SDIO_D3
1487 //#define SDIO_CK_PORT GPIOC
1488 //#define SDIO_CK_PIN GPIOC_SDIO_CK
1489 //#define SDIO_CMD_PORT GPIOD
1490 //#define SDIO_CMD_PIN GPIOD_SDIO_CMD
1491 //#define SDIO_AF 12
1493 //#define SDLOG_BAT_ADC ADCD1
1494 //#define SDLOG_BAT_CHAN AD1_4_CHANNEL
1496 //#define SDLOG_USB_LED 4
1497 //#define SDLOG_USB_VBUS_PORT GPIOA
1498 //#define SDLOG_USB_VBUS_PIN GPIO9
1499 
1500 
1501 //*****************************************************************************
1502 
1503 #if !defined(_FROM_ASM_)
1504 #ifdef __cplusplus
1505 extern "C" {
1506 #endif
1507 void boardInit(void);
1508 #ifdef __cplusplus
1509 }
1510 #endif
1511 #endif /* _FROM_ASM_ */
1512 
1513 #endif /* BOARD_H */
void boardInit(void)
Board-specific initialization code.
Definition: board.c:261