Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / STM32F4Discovery / board.h @ 8d756b18

History | View | Annotate | Download (85.503 KB)

1 07ff44a7 Thomas Schöpping
/*
2
    ChibiOS - Copyright (C) 2006..2018 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
/* Driver constants.                                                         */
27
/*===========================================================================*/
28
29
/*
30
 * Setup for STMicroelectronics STM32F4-Discovery board.
31
 */
32
33
/*
34
 * Board identifier.
35
 */
36
#define BOARD_ST_STM32F4_DISCOVERY
37
#define BOARD_NAME                  "STMicroelectronics STM32F4-Discovery"
38
39
/*
40
 * Board oscillators-related settings.
41
 * NOTE: LSE not fitted.
42
 */
43
#if !defined(STM32_LSECLK)
44
#define STM32_LSECLK                0U
45
#endif
46
47
#if !defined(STM32_HSECLK)
48
#define STM32_HSECLK                8000000U
49
#endif
50
51
/*
52
 * Board voltages.
53
 * Required for performance limits calculation.
54
 */
55
#define STM32_VDD                   300U
56
57
/*
58
 * MCU type as defined in the ST header.
59
 */
60
#define STM32F407xx
61
62
/*
63
 * IO pins assignments.
64
 */
65
#define GPIOA_BUTTON                0U
66
#define GPIOA_PIN1                  1U
67
#define GPIOA_PIN2                  2U
68
#define GPIOA_PIN3                  3U
69
#define GPIOA_LRCK                  4U
70
#define GPIOA_SPC                   5U
71
#define GPIOA_SDO                   6U
72
#define GPIOA_SDI                   7U
73
#define GPIOA_PIN8                  8U
74
#define GPIOA_VBUS_FS               9U
75
#define GPIOA_OTG_FS_ID             10U
76
#define GPIOA_OTG_FS_DM             11U
77
#define GPIOA_OTG_FS_DP             12U
78
#define GPIOA_SWDIO                 13U
79
#define GPIOA_SWCLK                 14U
80
#define GPIOA_PIN15                 15U
81
82
#define GPIOB_PIN0                  0U
83
#define GPIOB_PIN1                  1U
84
#define GPIOB_PIN2                  2U
85
#define GPIOB_SWO                   3U
86
#define GPIOB_PIN4                  4U
87
#define GPIOB_PIN5                  5U
88
#define GPIOB_SCL                   6U
89
#define GPIOB_PIN7                  7U
90
#define GPIOB_PIN8                  8U
91
#define GPIOB_SDA                   9U
92
#define GPIOB_CLK_IN                10U
93
#define GPIOB_PIN11                 11U
94
#define GPIOB_PIN12                 12U
95
#define GPIOB_PIN13                 13U
96
#define GPIOB_PIN14                 14U
97
#define GPIOB_PIN15                 15U
98
99
#define GPIOC_OTG_FS_POWER_ON       0U
100
#define GPIOC_PIN1                  1U
101
#define GPIOC_PIN2                  2U
102
#define GPIOC_PDM_OUT               3U
103
#define GPIOC_PIN4                  4U
104
#define GPIOC_PIN5                  5U
105
#define GPIOC_PIN6                  6U
106
#define GPIOC_MCLK                  7U
107
#define GPIOC_PIN8                  8U
108
#define GPIOC_PIN9                  9U
109
#define GPIOC_SCLK                  10U
110
#define GPIOC_PIN11                 11U
111
#define GPIOC_SDIN                  12U
112
#define GPIOC_PIN13                 13U
113
#define GPIOC_PIN14                 14U
114
#define GPIOC_PIN15                 15U
115
116
#define GPIOD_PIN0                  0U
117
#define GPIOD_PIN1                  1U
118
#define GPIOD_PIN2                  2U
119
#define GPIOD_PIN3                  3U
120
#define GPIOD_RESET                 4U
121
#define GPIOD_OVER_CURRENT          5U
122
#define GPIOD_PIN6                  6U
123
#define GPIOD_PIN7                  7U
124
#define GPIOD_PIN8                  8U
125
#define GPIOD_PIN9                  9U
126
#define GPIOD_PIN10                 10U
127
#define GPIOD_PIN11                 11U
128
#define GPIOD_LED4                  12U
129
#define GPIOD_LED3                  13U
130
#define GPIOD_LED5                  14U
131
#define GPIOD_LED6                  15U
132
133
#define GPIOE_INT1                  0U
134
#define GPIOE_INT2                  1U
135
#define GPIOE_PIN2                  2U
136
#define GPIOE_CS_SPI                3U
137
#define GPIOE_PIN4                  4U
138
#define GPIOE_PIN5                  5U
139
#define GPIOE_PIN6                  6U
140
#define GPIOE_PIN7                  7U
141
#define GPIOE_PIN8                  8U
142
#define GPIOE_PIN9                  9U
143
#define GPIOE_PIN10                 10U
144
#define GPIOE_PIN11                 11U
145
#define GPIOE_PIN12                 12U
146
#define GPIOE_PIN13                 13U
147
#define GPIOE_PIN14                 14U
148
#define GPIOE_PIN15                 15U
149
150
#define GPIOF_PIN0                  0U
151
#define GPIOF_PIN1                  1U
152
#define GPIOF_PIN2                  2U
153
#define GPIOF_PIN3                  3U
154
#define GPIOF_PIN4                  4U
155
#define GPIOF_PIN5                  5U
156
#define GPIOF_PIN6                  6U
157
#define GPIOF_PIN7                  7U
158
#define GPIOF_PIN8                  8U
159
#define GPIOF_PIN9                  9U
160
#define GPIOF_PIN10                 10U
161
#define GPIOF_PIN11                 11U
162
#define GPIOF_PIN12                 12U
163
#define GPIOF_PIN13                 13U
164
#define GPIOF_PIN14                 14U
165
#define GPIOF_PIN15                 15U
166
167
#define GPIOG_PIN0                  0U
168
#define GPIOG_PIN1                  1U
169
#define GPIOG_PIN2                  2U
170
#define GPIOG_PIN3                  3U
171
#define GPIOG_PIN4                  4U
172
#define GPIOG_PIN5                  5U
173
#define GPIOG_PIN6                  6U
174
#define GPIOG_PIN7                  7U
175
#define GPIOG_PIN8                  8U
176
#define GPIOG_PIN9                  9U
177
#define GPIOG_PIN10                 10U
178
#define GPIOG_PIN11                 11U
179
#define GPIOG_PIN12                 12U
180
#define GPIOG_PIN13                 13U
181
#define GPIOG_PIN14                 14U
182
#define GPIOG_PIN15                 15U
183
184
#define GPIOH_OSC_IN                0U
185
#define GPIOH_OSC_OUT               1U
186
#define GPIOH_PIN2                  2U
187
#define GPIOH_PIN3                  3U
188
#define GPIOH_PIN4                  4U
189
#define GPIOH_PIN5                  5U
190
#define GPIOH_PIN6                  6U
191
#define GPIOH_PIN7                  7U
192
#define GPIOH_PIN8                  8U
193
#define GPIOH_PIN9                  9U
194
#define GPIOH_PIN10                 10U
195
#define GPIOH_PIN11                 11U
196
#define GPIOH_PIN12                 12U
197
#define GPIOH_PIN13                 13U
198
#define GPIOH_PIN14                 14U
199
#define GPIOH_PIN15                 15U
200
201
#define GPIOI_PIN0                  0U
202
#define GPIOI_PIN1                  1U
203
#define GPIOI_PIN2                  2U
204
#define GPIOI_PIN3                  3U
205
#define GPIOI_PIN4                  4U
206
#define GPIOI_PIN5                  5U
207
#define GPIOI_PIN6                  6U
208
#define GPIOI_PIN7                  7U
209
#define GPIOI_PIN8                  8U
210
#define GPIOI_PIN9                  9U
211
#define GPIOI_PIN10                 10U
212
#define GPIOI_PIN11                 11U
213
#define GPIOI_PIN12                 12U
214
#define GPIOI_PIN13                 13U
215
#define GPIOI_PIN14                 14U
216
#define GPIOI_PIN15                 15U
217
218
/*
219
 * IO lines assignments.
220
 */
221
#define LINE_BUTTON                 PAL_LINE(GPIOA, 0U)
222
#define LINE_LRCK                   PAL_LINE(GPIOA, 4U)
223
#define LINE_SPC                    PAL_LINE(GPIOA, 5U)
224
#define LINE_SDO                    PAL_LINE(GPIOA, 6U)
225
#define LINE_SDI                    PAL_LINE(GPIOA, 7U)
226
#define LINE_VBUS_FS                PAL_LINE(GPIOA, 9U)
227
#define LINE_OTG_FS_ID              PAL_LINE(GPIOA, 10U)
228
#define LINE_OTG_FS_DM              PAL_LINE(GPIOA, 11U)
229
#define LINE_OTG_FS_DP              PAL_LINE(GPIOA, 12U)
230
#define LINE_SWDIO                  PAL_LINE(GPIOA, 13U)
231
#define LINE_SWCLK                  PAL_LINE(GPIOA, 14U)
232
#define LINE_SWO                    PAL_LINE(GPIOB, 3U)
233
#define LINE_SCL                    PAL_LINE(GPIOB, 6U)
234
#define LINE_SDA                    PAL_LINE(GPIOB, 9U)
235
#define LINE_CLK_IN                 PAL_LINE(GPIOB, 10U)
236
#define LINE_OTG_FS_POWER_ON        PAL_LINE(GPIOC, 0U)
237
#define LINE_PDM_OUT                PAL_LINE(GPIOC, 3U)
238
#define LINE_MCLK                   PAL_LINE(GPIOC, 7U)
239
#define LINE_SCLK                   PAL_LINE(GPIOC, 10U)
240
#define LINE_SDIN                   PAL_LINE(GPIOC, 12U)
241
#define LINE_RESET                  PAL_LINE(GPIOD, 4U)
242
#define LINE_OVER_CURRENT           PAL_LINE(GPIOD, 5U)
243
#define LINE_LED4                   PAL_LINE(GPIOD, 12U)
244
#define LINE_LED3                   PAL_LINE(GPIOD, 13U)
245
#define LINE_LED5                   PAL_LINE(GPIOD, 14U)
246
#define LINE_LED6                   PAL_LINE(GPIOD, 15U)
247
#define LINE_INT1                   PAL_LINE(GPIOE, 0U)
248
#define LINE_INT2                   PAL_LINE(GPIOE, 1U)
249
#define LINE_CS_SPI                 PAL_LINE(GPIOE, 3U)
250
#define LINE_OSC_IN                 PAL_LINE(GPIOH, 0U)
251
#define LINE_OSC_OUT                PAL_LINE(GPIOH, 1U)
252
253
/*===========================================================================*/
254
/* Driver pre-compile time settings.                                         */
255
/*===========================================================================*/
256
257
/*===========================================================================*/
258
/* Derived constants and error checks.                                       */
259
/*===========================================================================*/
260
261
/*===========================================================================*/
262
/* Driver data structures and types.                                         */
263
/*===========================================================================*/
264
265
/*===========================================================================*/
266
/* Driver macros.                                                            */
267
/*===========================================================================*/
268
269
/*
270
 * I/O ports initial setup, this configuration is established soon after reset
271
 * in the initialization code.
272
 * Please refer to the STM32 Reference Manual for details.
273
 */
274
#define PIN_MODE_INPUT(n)           (0U << ((n) * 2U))
275
#define PIN_MODE_OUTPUT(n)          (1U << ((n) * 2U))
276
#define PIN_MODE_ALTERNATE(n)       (2U << ((n) * 2U))
277
#define PIN_MODE_ANALOG(n)          (3U << ((n) * 2U))
278
#define PIN_ODR_LOW(n)              (0U << (n))
279
#define PIN_ODR_HIGH(n)             (1U << (n))
280
#define PIN_OTYPE_PUSHPULL(n)       (0U << (n))
281
#define PIN_OTYPE_OPENDRAIN(n)      (1U << (n))
282
#define PIN_OSPEED_VERYLOW(n)       (0U << ((n) * 2U))
283
#define PIN_OSPEED_LOW(n)           (1U << ((n) * 2U))
284
#define PIN_OSPEED_MEDIUM(n)        (2U << ((n) * 2U))
285
#define PIN_OSPEED_HIGH(n)          (3U << ((n) * 2U))
286
#define PIN_PUPDR_FLOATING(n)       (0U << ((n) * 2U))
287
#define PIN_PUPDR_PULLUP(n)         (1U << ((n) * 2U))
288
#define PIN_PUPDR_PULLDOWN(n)       (2U << ((n) * 2U))
289
#define PIN_AFIO_AF(n, v)           ((v) << (((n) % 8U) * 4U))
290
291
/*
292
 * GPIOA setup:
293
 *
294
 * PA0  - BUTTON                    (input floating).
295
 * PA1  - PIN1                      (input pullup).
296
 * PA2  - PIN2                      (input pullup).
297
 * PA3  - PIN3                      (input pullup).
298
 * PA4  - LRCK                      (alternate 6).
299
 * PA5  - SPC                       (alternate 5).
300
 * PA6  - SDO                       (alternate 5).
301
 * PA7  - SDI                       (alternate 5).
302
 * PA8  - PIN8                      (input pullup).
303
 * PA9  - VBUS_FS                   (input floating).
304
 * PA10 - OTG_FS_ID                 (alternate 10).
305
 * PA11 - OTG_FS_DM                 (alternate 10).
306
 * PA12 - OTG_FS_DP                 (alternate 10).
307
 * PA13 - SWDIO                     (alternate 0).
308
 * PA14 - SWCLK                     (alternate 0).
309
 * PA15 - PIN15                     (input pullup).
310
 */
311
#define VAL_GPIOA_MODER             (PIN_MODE_INPUT(GPIOA_BUTTON) |         \
312
                                     PIN_MODE_INPUT(GPIOA_PIN1) |           \
313
                                     PIN_MODE_ALTERNATE(GPIOA_PIN2) |       \
314
                                     PIN_MODE_ALTERNATE(GPIOA_PIN3) |       \
315
                                     PIN_MODE_ALTERNATE(GPIOA_LRCK) |       \
316
                                     PIN_MODE_ALTERNATE(GPIOA_SPC) |        \
317
                                     PIN_MODE_ALTERNATE(GPIOA_SDO) |        \
318
                                     PIN_MODE_ALTERNATE(GPIOA_SDI) |        \
319
                                     PIN_MODE_INPUT(GPIOA_PIN8) |           \
320
                                     PIN_MODE_INPUT(GPIOA_VBUS_FS) |        \
321
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_ID) |  \
322
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) |  \
323
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) |  \
324
                                     PIN_MODE_ALTERNATE(GPIOA_SWDIO) |      \
325
                                     PIN_MODE_ALTERNATE(GPIOA_SWCLK) |      \
326
                                     PIN_MODE_INPUT(GPIOA_PIN15))
327
#define VAL_GPIOA_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) |     \
328
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN1) |       \
329
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN2) |       \
330
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN3) |       \
331
                                     PIN_OTYPE_PUSHPULL(GPIOA_LRCK) |       \
332
                                     PIN_OTYPE_PUSHPULL(GPIOA_SPC) |        \
333
                                     PIN_OTYPE_PUSHPULL(GPIOA_SDO) |        \
334
                                     PIN_OTYPE_PUSHPULL(GPIOA_SDI) |        \
335
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN8) |       \
336
                                     PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS) |    \
337
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_ID) |  \
338
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) |  \
339
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) |  \
340
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) |      \
341
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) |      \
342
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
343
#define VAL_GPIOA_OSPEEDR           (PIN_OSPEED_HIGH(GPIOA_BUTTON) |        \
344
                                     PIN_OSPEED_HIGH(GPIOA_PIN1) |          \
345
                                     PIN_OSPEED_HIGH(GPIOA_PIN2) |          \
346
                                     PIN_OSPEED_HIGH(GPIOA_PIN3) |          \
347
                                     PIN_OSPEED_HIGH(GPIOA_LRCK) |          \
348
                                     PIN_OSPEED_MEDIUM(GPIOA_SPC) |         \
349
                                     PIN_OSPEED_MEDIUM(GPIOA_SDO) |         \
350
                                     PIN_OSPEED_MEDIUM(GPIOA_SDI) |         \
351
                                     PIN_OSPEED_HIGH(GPIOA_PIN8) |          \
352
                                     PIN_OSPEED_HIGH(GPIOA_VBUS_FS) |       \
353
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_ID) |     \
354
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) |     \
355
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) |     \
356
                                     PIN_OSPEED_HIGH(GPIOA_SWDIO) |         \
357
                                     PIN_OSPEED_HIGH(GPIOA_SWCLK) |         \
358
                                     PIN_OSPEED_HIGH(GPIOA_PIN15))
359
#define VAL_GPIOA_PUPDR             (PIN_PUPDR_FLOATING(GPIOA_BUTTON) |     \
360
                                     PIN_PUPDR_PULLUP(GPIOA_PIN1) |         \
361
                                     PIN_PUPDR_PULLUP(GPIOA_PIN2) |         \
362
                                     PIN_PUPDR_PULLUP(GPIOA_PIN3) |         \
363
                                     PIN_PUPDR_FLOATING(GPIOA_LRCK) |       \
364
                                     PIN_PUPDR_FLOATING(GPIOA_SPC) |        \
365
                                     PIN_PUPDR_FLOATING(GPIOA_SDO) |        \
366
                                     PIN_PUPDR_FLOATING(GPIOA_SDI) |        \
367
                                     PIN_PUPDR_PULLUP(GPIOA_PIN8) |         \
368
                                     PIN_PUPDR_FLOATING(GPIOA_VBUS_FS) |    \
369
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_ID) |  \
370
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) |  \
371
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) |  \
372
                                     PIN_PUPDR_FLOATING(GPIOA_SWDIO) |      \
373
                                     PIN_PUPDR_FLOATING(GPIOA_SWCLK) |      \
374
                                     PIN_PUPDR_PULLUP(GPIOA_PIN15))
375
#define VAL_GPIOA_ODR               (PIN_ODR_HIGH(GPIOA_BUTTON) |           \
376
                                     PIN_ODR_HIGH(GPIOA_PIN1) |             \
377
                                     PIN_ODR_HIGH(GPIOA_PIN2) |             \
378
                                     PIN_ODR_HIGH(GPIOA_PIN3) |             \
379
                                     PIN_ODR_HIGH(GPIOA_LRCK) |             \
380
                                     PIN_ODR_HIGH(GPIOA_SPC) |              \
381
                                     PIN_ODR_HIGH(GPIOA_SDO) |              \
382
                                     PIN_ODR_HIGH(GPIOA_SDI) |              \
383
                                     PIN_ODR_HIGH(GPIOA_PIN8) |             \
384
                                     PIN_ODR_HIGH(GPIOA_VBUS_FS) |          \
385
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_ID) |        \
386
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_DM) |        \
387
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_DP) |        \
388
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |            \
389
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |            \
390
                                     PIN_ODR_HIGH(GPIOA_PIN15))
391
#define VAL_GPIOA_AFRL              (PIN_AFIO_AF(GPIOA_BUTTON, 0U) |        \
392
                                     PIN_AFIO_AF(GPIOA_PIN1, 0U) |          \
393
                                     PIN_AFIO_AF(GPIOA_PIN2, 7U) |          \
394
                                     PIN_AFIO_AF(GPIOA_PIN3, 7U) |          \
395
                                     PIN_AFIO_AF(GPIOA_LRCK, 6U) |          \
396
                                     PIN_AFIO_AF(GPIOA_SPC, 5U) |           \
397
                                     PIN_AFIO_AF(GPIOA_SDO, 5U) |           \
398
                                     PIN_AFIO_AF(GPIOA_SDI, 5U))
399
#define VAL_GPIOA_AFRH              (PIN_AFIO_AF(GPIOA_PIN8, 0U) |          \
400
                                     PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) |       \
401
                                     PIN_AFIO_AF(GPIOA_OTG_FS_ID, 10U) |    \
402
                                     PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) |    \
403
                                     PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) |    \
404
                                     PIN_AFIO_AF(GPIOA_SWDIO, 0U) |         \
405
                                     PIN_AFIO_AF(GPIOA_SWCLK, 0U) |         \
406
                                     PIN_AFIO_AF(GPIOA_PIN15, 0U))
407
408
/*
409
 * GPIOB setup:
410
 *
411
 * PB0  - PIN0                      (input pullup).
412
 * PB1  - PIN1                      (input pullup).
413
 * PB2  - PIN2                      (input pullup).
414
 * PB3  - SWO                       (alternate 0).
415
 * PB4  - PIN4                      (input pullup).
416
 * PB5  - PIN5                      (input pullup).
417
 * PB6  - SCL                       (alternate 4).
418
 * PB7  - PIN7                      (input pullup).
419
 * PB8  - PIN8                      (input pullup).
420
 * PB9  - SDA                       (alternate 4).
421
 * PB10 - CLK_IN                    (input pullup).
422
 * PB11 - PIN11                     (input pullup).
423
 * PB12 - PIN12                     (input pullup).
424
 * PB13 - PIN13                     (input pullup).
425
 * PB14 - PIN14                     (input pullup).
426
 * PB15 - PIN15                     (input pullup).
427
 */
428
#define VAL_GPIOB_MODER             (PIN_MODE_INPUT(GPIOB_PIN0) |           \
429
                                     PIN_MODE_INPUT(GPIOB_PIN1) |           \
430
                                     PIN_MODE_INPUT(GPIOB_PIN2) |           \
431
                                     PIN_MODE_ALTERNATE(GPIOB_SWO) |        \
432
                                     PIN_MODE_INPUT(GPIOB_PIN4) |           \
433
                                     PIN_MODE_INPUT(GPIOB_PIN5) |           \
434
                                     PIN_MODE_ALTERNATE(GPIOB_SCL) |        \
435
                                     PIN_MODE_INPUT(GPIOB_PIN7) |           \
436
                                     PIN_MODE_INPUT(GPIOB_PIN8) |           \
437
                                     PIN_MODE_ALTERNATE(GPIOB_SDA) |        \
438
                                     PIN_MODE_INPUT(GPIOB_CLK_IN) |         \
439
                                     PIN_MODE_INPUT(GPIOB_PIN11) |          \
440
                                     PIN_MODE_INPUT(GPIOB_PIN12) |          \
441
                                     PIN_MODE_INPUT(GPIOB_PIN13) |          \
442
                                     PIN_MODE_INPUT(GPIOB_PIN14) |          \
443
                                     PIN_MODE_INPUT(GPIOB_PIN15))
444
#define VAL_GPIOB_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) |       \
445
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN1) |       \
446
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN2) |       \
447
                                     PIN_OTYPE_PUSHPULL(GPIOB_SWO) |        \
448
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN4) |       \
449
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN5) |       \
450
                                     PIN_OTYPE_OPENDRAIN(GPIOB_SCL) |       \
451
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN7) |       \
452
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN8) |       \
453
                                     PIN_OTYPE_OPENDRAIN(GPIOB_SDA) |       \
454
                                     PIN_OTYPE_PUSHPULL(GPIOB_CLK_IN) |     \
455
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN11) |      \
456
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN12) |      \
457
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN13) |      \
458
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN14) |      \
459
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
460
#define VAL_GPIOB_OSPEEDR           (PIN_OSPEED_HIGH(GPIOB_PIN0) |          \
461
                                     PIN_OSPEED_HIGH(GPIOB_PIN1) |          \
462
                                     PIN_OSPEED_HIGH(GPIOB_PIN2) |          \
463
                                     PIN_OSPEED_HIGH(GPIOB_SWO) |           \
464
                                     PIN_OSPEED_HIGH(GPIOB_PIN4) |          \
465
                                     PIN_OSPEED_HIGH(GPIOB_PIN5) |          \
466
                                     PIN_OSPEED_HIGH(GPIOB_SCL) |           \
467
                                     PIN_OSPEED_HIGH(GPIOB_PIN7) |          \
468
                                     PIN_OSPEED_HIGH(GPIOB_PIN8) |          \
469
                                     PIN_OSPEED_HIGH(GPIOB_SDA) |           \
470
                                     PIN_OSPEED_HIGH(GPIOB_CLK_IN) |        \
471
                                     PIN_OSPEED_HIGH(GPIOB_PIN11) |         \
472
                                     PIN_OSPEED_HIGH(GPIOB_PIN12) |         \
473
                                     PIN_OSPEED_HIGH(GPIOB_PIN13) |         \
474
                                     PIN_OSPEED_HIGH(GPIOB_PIN14) |         \
475
                                     PIN_OSPEED_HIGH(GPIOB_PIN15))
476
#define VAL_GPIOB_PUPDR             (PIN_PUPDR_PULLUP(GPIOB_PIN0) |         \
477
                                     PIN_PUPDR_PULLUP(GPIOB_PIN1) |         \
478
                                     PIN_PUPDR_PULLUP(GPIOB_PIN2) |         \
479
                                     PIN_PUPDR_FLOATING(GPIOB_SWO) |        \
480
                                     PIN_PUPDR_PULLUP(GPIOB_PIN4) |         \
481
                                     PIN_PUPDR_PULLUP(GPIOB_PIN5) |         \
482
                                     PIN_PUPDR_FLOATING(GPIOB_SCL) |        \
483
                                     PIN_PUPDR_PULLUP(GPIOB_PIN7) |         \
484
                                     PIN_PUPDR_PULLUP(GPIOB_PIN8) |         \
485
                                     PIN_PUPDR_FLOATING(GPIOB_SDA) |        \
486
                                     PIN_PUPDR_PULLUP(GPIOB_CLK_IN) |       \
487
                                     PIN_PUPDR_PULLUP(GPIOB_PIN11) |        \
488
                                     PIN_PUPDR_PULLUP(GPIOB_PIN12) |        \
489
                                     PIN_PUPDR_PULLUP(GPIOB_PIN13) |        \
490
                                     PIN_PUPDR_PULLUP(GPIOB_PIN14) |        \
491
                                     PIN_PUPDR_PULLUP(GPIOB_PIN15))
492
#define VAL_GPIOB_ODR               (PIN_ODR_HIGH(GPIOB_PIN0) |             \
493
                                     PIN_ODR_HIGH(GPIOB_PIN1) |             \
494
                                     PIN_ODR_HIGH(GPIOB_PIN2) |             \
495
                                     PIN_ODR_HIGH(GPIOB_SWO) |              \
496
                                     PIN_ODR_HIGH(GPIOB_PIN4) |             \
497
                                     PIN_ODR_HIGH(GPIOB_PIN5) |             \
498
                                     PIN_ODR_HIGH(GPIOB_SCL) |              \
499
                                     PIN_ODR_HIGH(GPIOB_PIN7) |             \
500
                                     PIN_ODR_HIGH(GPIOB_PIN8) |             \
501
                                     PIN_ODR_HIGH(GPIOB_SDA) |              \
502
                                     PIN_ODR_HIGH(GPIOB_CLK_IN) |           \
503
                                     PIN_ODR_HIGH(GPIOB_PIN11) |            \
504
                                     PIN_ODR_HIGH(GPIOB_PIN12) |            \
505
                                     PIN_ODR_HIGH(GPIOB_PIN13) |            \
506
                                     PIN_ODR_HIGH(GPIOB_PIN14) |            \
507
                                     PIN_ODR_HIGH(GPIOB_PIN15))
508
#define VAL_GPIOB_AFRL              (PIN_AFIO_AF(GPIOB_PIN0, 0U) |          \
509
                                     PIN_AFIO_AF(GPIOB_PIN1, 0U) |          \
510
                                     PIN_AFIO_AF(GPIOB_PIN2, 0U) |          \
511
                                     PIN_AFIO_AF(GPIOB_SWO, 0U) |           \
512
                                     PIN_AFIO_AF(GPIOB_PIN4, 0U) |          \
513
                                     PIN_AFIO_AF(GPIOB_PIN5, 0U) |          \
514
                                     PIN_AFIO_AF(GPIOB_SCL, 4U) |           \
515
                                     PIN_AFIO_AF(GPIOB_PIN7, 0U))
516
#define VAL_GPIOB_AFRH              (PIN_AFIO_AF(GPIOB_PIN8, 0U) |          \
517
                                     PIN_AFIO_AF(GPIOB_SDA, 4U) |           \
518
                                     PIN_AFIO_AF(GPIOB_CLK_IN, 0U) |        \
519
                                     PIN_AFIO_AF(GPIOB_PIN11, 0U) |         \
520
                                     PIN_AFIO_AF(GPIOB_PIN12, 0U) |         \
521
                                     PIN_AFIO_AF(GPIOB_PIN13, 0U) |         \
522
                                     PIN_AFIO_AF(GPIOB_PIN14, 0U) |         \
523
                                     PIN_AFIO_AF(GPIOB_PIN15, 0U))
524
525
/*
526
 * GPIOC setup:
527
 *
528
 * PC0  - OTG_FS_POWER_ON           (output pushpull maximum).
529
 * PC1  - PIN1                      (input pullup).
530
 * PC2  - PIN2                      (input pullup).
531
 * PC3  - PDM_OUT                   (input pullup).
532
 * PC4  - PIN4                      (input pullup).
533
 * PC5  - PIN5                      (input pullup).
534
 * PC6  - PIN6                      (input pullup).
535
 * PC7  - MCLK                      (alternate 6).
536
 * PC8  - PIN8                      (input pullup).
537
 * PC9  - PIN9                      (input pullup).
538
 * PC10 - SCLK                      (alternate 6).
539
 * PC11 - PIN11                     (input pullup).
540
 * PC12 - SDIN                      (alternate 6).
541
 * PC13 - PIN13                     (input pullup).
542
 * PC14 - PIN14                     (input pullup).
543
 * PC15 - PIN15                     (input pullup).
544
 */
545
#define VAL_GPIOC_MODER             (PIN_MODE_OUTPUT(GPIOC_OTG_FS_POWER_ON) |\
546
                                     PIN_MODE_INPUT(GPIOC_PIN1) |           \
547
                                     PIN_MODE_INPUT(GPIOC_PIN2) |           \
548
                                     PIN_MODE_INPUT(GPIOC_PDM_OUT) |        \
549
                                     PIN_MODE_INPUT(GPIOC_PIN4) |           \
550
                                     PIN_MODE_INPUT(GPIOC_PIN5) |           \
551
                                     PIN_MODE_INPUT(GPIOC_PIN6) |           \
552
                                     PIN_MODE_ALTERNATE(GPIOC_MCLK) |       \
553
                                     PIN_MODE_INPUT(GPIOC_PIN8) |           \
554
                                     PIN_MODE_INPUT(GPIOC_PIN9) |           \
555
                                     PIN_MODE_ALTERNATE(GPIOC_SCLK) |       \
556
                                     PIN_MODE_INPUT(GPIOC_PIN11) |          \
557
                                     PIN_MODE_ALTERNATE(GPIOC_SDIN) |       \
558
                                     PIN_MODE_INPUT(GPIOC_PIN13) |          \
559
                                     PIN_MODE_INPUT(GPIOC_PIN14) |          \
560
                                     PIN_MODE_INPUT(GPIOC_PIN15))
561
#define VAL_GPIOC_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_POWER_ON) |\
562
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN1) |       \
563
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN2) |       \
564
                                     PIN_OTYPE_PUSHPULL(GPIOC_PDM_OUT) |    \
565
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN4) |       \
566
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN5) |       \
567
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN6) |       \
568
                                     PIN_OTYPE_PUSHPULL(GPIOC_MCLK) |       \
569
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN8) |       \
570
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN9) |       \
571
                                     PIN_OTYPE_PUSHPULL(GPIOC_SCLK) |       \
572
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN11) |      \
573
                                     PIN_OTYPE_PUSHPULL(GPIOC_SDIN) |       \
574
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN13) |      \
575
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN14) |      \
576
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
577
#define VAL_GPIOC_OSPEEDR           (PIN_OSPEED_HIGH(GPIOC_OTG_FS_POWER_ON) |\
578
                                     PIN_OSPEED_HIGH(GPIOC_PIN1) |          \
579
                                     PIN_OSPEED_HIGH(GPIOC_PIN2) |          \
580
                                     PIN_OSPEED_HIGH(GPIOC_PDM_OUT) |       \
581
                                     PIN_OSPEED_HIGH(GPIOC_PIN4) |          \
582
                                     PIN_OSPEED_HIGH(GPIOC_PIN5) |          \
583
                                     PIN_OSPEED_HIGH(GPIOC_PIN6) |          \
584
                                     PIN_OSPEED_HIGH(GPIOC_MCLK) |          \
585
                                     PIN_OSPEED_HIGH(GPIOC_PIN8) |          \
586
                                     PIN_OSPEED_HIGH(GPIOC_PIN9) |          \
587
                                     PIN_OSPEED_HIGH(GPIOC_SCLK) |          \
588
                                     PIN_OSPEED_HIGH(GPIOC_PIN11) |         \
589
                                     PIN_OSPEED_HIGH(GPIOC_SDIN) |          \
590
                                     PIN_OSPEED_HIGH(GPIOC_PIN13) |         \
591
                                     PIN_OSPEED_HIGH(GPIOC_PIN14) |         \
592
                                     PIN_OSPEED_HIGH(GPIOC_PIN15))
593
#define VAL_GPIOC_PUPDR             (PIN_PUPDR_FLOATING(GPIOC_OTG_FS_POWER_ON) |\
594
                                     PIN_PUPDR_PULLUP(GPIOC_PIN1) |         \
595
                                     PIN_PUPDR_PULLUP(GPIOC_PIN2) |         \
596
                                     PIN_PUPDR_PULLUP(GPIOC_PDM_OUT) |      \
597
                                     PIN_PUPDR_PULLUP(GPIOC_PIN4) |         \
598
                                     PIN_PUPDR_PULLUP(GPIOC_PIN5) |         \
599
                                     PIN_PUPDR_PULLUP(GPIOC_PIN6) |         \
600
                                     PIN_PUPDR_FLOATING(GPIOC_MCLK) |       \
601
                                     PIN_PUPDR_PULLUP(GPIOC_PIN8) |         \
602
                                     PIN_PUPDR_PULLUP(GPIOC_PIN9) |         \
603
                                     PIN_PUPDR_FLOATING(GPIOC_SCLK) |       \
604
                                     PIN_PUPDR_PULLUP(GPIOC_PIN11) |        \
605
                                     PIN_PUPDR_FLOATING(GPIOC_SDIN) |       \
606
                                     PIN_PUPDR_PULLUP(GPIOC_PIN13) |        \
607
                                     PIN_PUPDR_PULLUP(GPIOC_PIN14) |        \
608
                                     PIN_PUPDR_PULLUP(GPIOC_PIN15))
609
#define VAL_GPIOC_ODR               (PIN_ODR_HIGH(GPIOC_OTG_FS_POWER_ON) |  \
610
                                     PIN_ODR_HIGH(GPIOC_PIN1) |             \
611
                                     PIN_ODR_HIGH(GPIOC_PIN2) |             \
612
                                     PIN_ODR_HIGH(GPIOC_PDM_OUT) |          \
613
                                     PIN_ODR_HIGH(GPIOC_PIN4) |             \
614
                                     PIN_ODR_HIGH(GPIOC_PIN5) |             \
615
                                     PIN_ODR_HIGH(GPIOC_PIN6) |             \
616
                                     PIN_ODR_HIGH(GPIOC_MCLK) |             \
617
                                     PIN_ODR_HIGH(GPIOC_PIN8) |             \
618
                                     PIN_ODR_HIGH(GPIOC_PIN9) |             \
619
                                     PIN_ODR_HIGH(GPIOC_SCLK) |             \
620
                                     PIN_ODR_HIGH(GPIOC_PIN11) |            \
621
                                     PIN_ODR_HIGH(GPIOC_SDIN) |             \
622
                                     PIN_ODR_HIGH(GPIOC_PIN13) |            \
623
                                     PIN_ODR_HIGH(GPIOC_PIN14) |            \
624
                                     PIN_ODR_HIGH(GPIOC_PIN15))
625
#define VAL_GPIOC_AFRL              (PIN_AFIO_AF(GPIOC_OTG_FS_POWER_ON, 0U) |\
626
                                     PIN_AFIO_AF(GPIOC_PIN1, 0U) |          \
627
                                     PIN_AFIO_AF(GPIOC_PIN2, 0U) |          \
628
                                     PIN_AFIO_AF(GPIOC_PDM_OUT, 0U) |       \
629
                                     PIN_AFIO_AF(GPIOC_PIN4, 0U) |          \
630
                                     PIN_AFIO_AF(GPIOC_PIN5, 0U) |          \
631
                                     PIN_AFIO_AF(GPIOC_PIN6, 0U) |          \
632
                                     PIN_AFIO_AF(GPIOC_MCLK, 6U))
633
#define VAL_GPIOC_AFRH              (PIN_AFIO_AF(GPIOC_PIN8, 0U) |          \
634
                                     PIN_AFIO_AF(GPIOC_PIN9, 0U) |          \
635
                                     PIN_AFIO_AF(GPIOC_SCLK, 6U) |          \
636
                                     PIN_AFIO_AF(GPIOC_PIN11, 0U) |         \
637
                                     PIN_AFIO_AF(GPIOC_SDIN, 6U) |          \
638
                                     PIN_AFIO_AF(GPIOC_PIN13, 0U) |         \
639
                                     PIN_AFIO_AF(GPIOC_PIN14, 0U) |         \
640
                                     PIN_AFIO_AF(GPIOC_PIN15, 0U))
641
642
/*
643
 * GPIOD setup:
644
 *
645
 * PD0  - PIN0                      (input pullup).
646
 * PD1  - PIN1                      (input pullup).
647
 * PD2  - PIN2                      (input pullup).
648
 * PD3  - PIN3                      (input pullup).
649
 * PD4  - RESET                     (output pushpull maximum).
650
 * PD5  - OVER_CURRENT              (input floating).
651
 * PD6  - PIN6                      (input pullup).
652
 * PD7  - PIN7                      (input pullup).
653
 * PD8  - PIN8                      (input pullup).
654
 * PD9  - PIN9                      (input pullup).
655
 * PD10 - PIN10                     (input pullup).
656
 * PD11 - PIN11                     (input pullup).
657
 * PD12 - LED4                      (output pushpull maximum).
658
 * PD13 - LED3                      (output pushpull maximum).
659
 * PD14 - LED5                      (output pushpull maximum).
660
 * PD15 - LED6                      (output pushpull maximum).
661
 */
662
#define VAL_GPIOD_MODER             (PIN_MODE_INPUT(GPIOD_PIN0) |           \
663
                                     PIN_MODE_INPUT(GPIOD_PIN1) |           \
664
                                     PIN_MODE_INPUT(GPIOD_PIN2) |           \
665
                                     PIN_MODE_INPUT(GPIOD_PIN3) |           \
666
                                     PIN_MODE_OUTPUT(GPIOD_RESET) |         \
667
                                     PIN_MODE_INPUT(GPIOD_OVER_CURRENT) |   \
668
                                     PIN_MODE_INPUT(GPIOD_PIN6) |           \
669
                                     PIN_MODE_INPUT(GPIOD_PIN7) |           \
670
                                     PIN_MODE_INPUT(GPIOD_PIN8) |           \
671
                                     PIN_MODE_INPUT(GPIOD_PIN9) |           \
672
                                     PIN_MODE_INPUT(GPIOD_PIN10) |          \
673
                                     PIN_MODE_INPUT(GPIOD_PIN11) |          \
674
                                     PIN_MODE_OUTPUT(GPIOD_LED4) |          \
675
                                     PIN_MODE_OUTPUT(GPIOD_LED3) |          \
676
                                     PIN_MODE_OUTPUT(GPIOD_LED5) |          \
677
                                     PIN_MODE_OUTPUT(GPIOD_LED6))
678
#define VAL_GPIOD_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) |       \
679
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN1) |       \
680
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN2) |       \
681
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN3) |       \
682
                                     PIN_OTYPE_PUSHPULL(GPIOD_RESET) |      \
683
                                     PIN_OTYPE_PUSHPULL(GPIOD_OVER_CURRENT) |\
684
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN6) |       \
685
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN7) |       \
686
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN8) |       \
687
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN9) |       \
688
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN10) |      \
689
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN11) |      \
690
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED4) |       \
691
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED3) |       \
692
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED5) |       \
693
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED6))
694
#define VAL_GPIOD_OSPEEDR           (PIN_OSPEED_HIGH(GPIOD_PIN0) |          \
695
                                     PIN_OSPEED_HIGH(GPIOD_PIN1) |          \
696
                                     PIN_OSPEED_HIGH(GPIOD_PIN2) |          \
697
                                     PIN_OSPEED_HIGH(GPIOD_PIN3) |          \
698
                                     PIN_OSPEED_HIGH(GPIOD_RESET) |         \
699
                                     PIN_OSPEED_HIGH(GPIOD_OVER_CURRENT) |  \
700
                                     PIN_OSPEED_HIGH(GPIOD_PIN6) |          \
701
                                     PIN_OSPEED_HIGH(GPIOD_PIN7) |          \
702
                                     PIN_OSPEED_HIGH(GPIOD_PIN8) |          \
703
                                     PIN_OSPEED_HIGH(GPIOD_PIN9) |          \
704
                                     PIN_OSPEED_HIGH(GPIOD_PIN10) |         \
705
                                     PIN_OSPEED_HIGH(GPIOD_PIN11) |         \
706
                                     PIN_OSPEED_HIGH(GPIOD_LED4) |          \
707
                                     PIN_OSPEED_HIGH(GPIOD_LED3) |          \
708
                                     PIN_OSPEED_HIGH(GPIOD_LED5) |          \
709
                                     PIN_OSPEED_HIGH(GPIOD_LED6))
710
#define VAL_GPIOD_PUPDR             (PIN_PUPDR_PULLUP(GPIOD_PIN0) |         \
711
                                     PIN_PUPDR_PULLUP(GPIOD_PIN1) |         \
712
                                     PIN_PUPDR_PULLUP(GPIOD_PIN2) |         \
713
                                     PIN_PUPDR_PULLUP(GPIOD_PIN3) |         \
714
                                     PIN_PUPDR_FLOATING(GPIOD_RESET) |      \
715
                                     PIN_PUPDR_FLOATING(GPIOD_OVER_CURRENT) |\
716
                                     PIN_PUPDR_PULLUP(GPIOD_PIN6) |         \
717
                                     PIN_PUPDR_PULLUP(GPIOD_PIN7) |         \
718
                                     PIN_PUPDR_PULLUP(GPIOD_PIN8) |         \
719
                                     PIN_PUPDR_PULLUP(GPIOD_PIN9) |         \
720
                                     PIN_PUPDR_PULLUP(GPIOD_PIN10) |        \
721
                                     PIN_PUPDR_PULLUP(GPIOD_PIN11) |        \
722
                                     PIN_PUPDR_FLOATING(GPIOD_LED4) |       \
723
                                     PIN_PUPDR_FLOATING(GPIOD_LED3) |       \
724
                                     PIN_PUPDR_FLOATING(GPIOD_LED5) |       \
725
                                     PIN_PUPDR_FLOATING(GPIOD_LED6))
726
#define VAL_GPIOD_ODR               (PIN_ODR_HIGH(GPIOD_PIN0) |             \
727
                                     PIN_ODR_HIGH(GPIOD_PIN1) |             \
728
                                     PIN_ODR_HIGH(GPIOD_PIN2) |             \
729
                                     PIN_ODR_HIGH(GPIOD_PIN3) |             \
730
                                     PIN_ODR_HIGH(GPIOD_RESET) |            \
731
                                     PIN_ODR_HIGH(GPIOD_OVER_CURRENT) |     \
732
                                     PIN_ODR_HIGH(GPIOD_PIN6) |             \
733
                                     PIN_ODR_HIGH(GPIOD_PIN7) |             \
734
                                     PIN_ODR_HIGH(GPIOD_PIN8) |             \
735
                                     PIN_ODR_HIGH(GPIOD_PIN9) |             \
736
                                     PIN_ODR_HIGH(GPIOD_PIN10) |            \
737
                                     PIN_ODR_HIGH(GPIOD_PIN11) |            \
738
                                     PIN_ODR_LOW(GPIOD_LED4) |              \
739
                                     PIN_ODR_LOW(GPIOD_LED3) |              \
740
                                     PIN_ODR_LOW(GPIOD_LED5) |              \
741
                                     PIN_ODR_LOW(GPIOD_LED6))
742
#define VAL_GPIOD_AFRL              (PIN_AFIO_AF(GPIOD_PIN0, 0U) |          \
743
                                     PIN_AFIO_AF(GPIOD_PIN1, 0U) |          \
744
                                     PIN_AFIO_AF(GPIOD_PIN2, 0U) |          \
745
                                     PIN_AFIO_AF(GPIOD_PIN3, 0U) |          \
746
                                     PIN_AFIO_AF(GPIOD_RESET, 0U) |         \
747
                                     PIN_AFIO_AF(GPIOD_OVER_CURRENT, 0U) |  \
748
                                     PIN_AFIO_AF(GPIOD_PIN6, 0U) |          \
749
                                     PIN_AFIO_AF(GPIOD_PIN7, 0U))
750
#define VAL_GPIOD_AFRH              (PIN_AFIO_AF(GPIOD_PIN8, 0U) |          \
751
                                     PIN_AFIO_AF(GPIOD_PIN9, 0U) |          \
752
                                     PIN_AFIO_AF(GPIOD_PIN10, 0U) |         \
753
                                     PIN_AFIO_AF(GPIOD_PIN11, 0U) |         \
754
                                     PIN_AFIO_AF(GPIOD_LED4, 0U) |          \
755
                                     PIN_AFIO_AF(GPIOD_LED3, 0U) |          \
756
                                     PIN_AFIO_AF(GPIOD_LED5, 0U) |          \
757
                                     PIN_AFIO_AF(GPIOD_LED6, 0U))
758
759
/*
760
 * GPIOE setup:
761
 *
762
 * PE0  - INT1                      (input floating).
763
 * PE1  - INT2                      (input floating).
764
 * PE2  - PIN2                      (input floating).
765
 * PE3  - CS_SPI                    (output pushpull maximum).
766
 * PE4  - PIN4                      (input floating).
767
 * PE5  - PIN5                      (input floating).
768
 * PE6  - PIN6                      (input floating).
769
 * PE7  - PIN7                      (input floating).
770
 * PE8  - PIN8                      (input floating).
771
 * PE9  - PIN9                      (input floating).
772
 * PE10 - PIN10                     (input floating).
773
 * PE11 - PIN11                     (input floating).
774
 * PE12 - PIN12                     (input floating).
775
 * PE13 - PIN13                     (input floating).
776
 * PE14 - PIN14                     (input floating).
777
 * PE15 - PIN15                     (input floating).
778
 */
779
#define VAL_GPIOE_MODER             (PIN_MODE_INPUT(GPIOE_INT1) |           \
780
                                     PIN_MODE_INPUT(GPIOE_INT2) |           \
781
                                     PIN_MODE_INPUT(GPIOE_PIN2) |           \
782
                                     PIN_MODE_OUTPUT(GPIOE_CS_SPI) |        \
783
                                     PIN_MODE_INPUT(GPIOE_PIN4) |           \
784
                                     PIN_MODE_INPUT(GPIOE_PIN5) |           \
785
                                     PIN_MODE_INPUT(GPIOE_PIN6) |           \
786
                                     PIN_MODE_INPUT(GPIOE_PIN7) |           \
787
                                     PIN_MODE_INPUT(GPIOE_PIN8) |           \
788
                                     PIN_MODE_INPUT(GPIOE_PIN9) |           \
789
                                     PIN_MODE_INPUT(GPIOE_PIN10) |          \
790
                                     PIN_MODE_INPUT(GPIOE_PIN11) |          \
791
                                     PIN_MODE_INPUT(GPIOE_PIN12) |          \
792
                                     PIN_MODE_INPUT(GPIOE_PIN13) |          \
793
                                     PIN_MODE_INPUT(GPIOE_PIN14) |          \
794
                                     PIN_MODE_INPUT(GPIOE_PIN15))
795
#define VAL_GPIOE_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOE_INT1) |       \
796
                                     PIN_OTYPE_PUSHPULL(GPIOE_INT2) |       \
797
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |       \
798
                                     PIN_OTYPE_PUSHPULL(GPIOE_CS_SPI) |     \
799
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |       \
800
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |       \
801
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN6) |       \
802
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN7) |       \
803
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN8) |       \
804
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN9) |       \
805
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |      \
806
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN11) |      \
807
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN12) |      \
808
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN13) |      \
809
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |      \
810
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
811
#define VAL_GPIOE_OSPEEDR           (PIN_OSPEED_HIGH(GPIOE_INT1) |          \
812
                                     PIN_OSPEED_HIGH(GPIOE_INT2) |          \
813
                                     PIN_OSPEED_HIGH(GPIOE_PIN2) |          \
814
                                     PIN_OSPEED_HIGH(GPIOE_CS_SPI) |        \
815
                                     PIN_OSPEED_HIGH(GPIOE_PIN4) |          \
816
                                     PIN_OSPEED_HIGH(GPIOE_PIN5) |          \
817
                                     PIN_OSPEED_HIGH(GPIOE_PIN6) |          \
818
                                     PIN_OSPEED_HIGH(GPIOE_PIN7) |          \
819
                                     PIN_OSPEED_HIGH(GPIOE_PIN8) |          \
820
                                     PIN_OSPEED_HIGH(GPIOE_PIN9) |          \
821
                                     PIN_OSPEED_HIGH(GPIOE_PIN10) |         \
822
                                     PIN_OSPEED_HIGH(GPIOE_PIN11) |         \
823
                                     PIN_OSPEED_HIGH(GPIOE_PIN12) |         \
824
                                     PIN_OSPEED_HIGH(GPIOE_PIN13) |         \
825
                                     PIN_OSPEED_HIGH(GPIOE_PIN14) |         \
826
                                     PIN_OSPEED_HIGH(GPIOE_PIN15))
827
#define VAL_GPIOE_PUPDR             (PIN_PUPDR_FLOATING(GPIOE_INT1) |       \
828
                                     PIN_PUPDR_FLOATING(GPIOE_INT2) |       \
829
                                     PIN_PUPDR_FLOATING(GPIOE_PIN2) |       \
830
                                     PIN_PUPDR_FLOATING(GPIOE_CS_SPI) |     \
831
                                     PIN_PUPDR_FLOATING(GPIOE_PIN4) |       \
832
                                     PIN_PUPDR_FLOATING(GPIOE_PIN5) |       \
833
                                     PIN_PUPDR_FLOATING(GPIOE_PIN6) |       \
834
                                     PIN_PUPDR_FLOATING(GPIOE_PIN7) |       \
835
                                     PIN_PUPDR_FLOATING(GPIOE_PIN8) |       \
836
                                     PIN_PUPDR_FLOATING(GPIOE_PIN9) |       \
837
                                     PIN_PUPDR_FLOATING(GPIOE_PIN10) |      \
838
                                     PIN_PUPDR_FLOATING(GPIOE_PIN11) |      \
839
                                     PIN_PUPDR_FLOATING(GPIOE_PIN12) |      \
840
                                     PIN_PUPDR_FLOATING(GPIOE_PIN13) |      \
841
                                     PIN_PUPDR_FLOATING(GPIOE_PIN14) |      \
842
                                     PIN_PUPDR_FLOATING(GPIOE_PIN15))
843
#define VAL_GPIOE_ODR               (PIN_ODR_HIGH(GPIOE_INT1) |             \
844
                                     PIN_ODR_HIGH(GPIOE_INT2) |             \
845
                                     PIN_ODR_HIGH(GPIOE_PIN2) |             \
846
                                     PIN_ODR_HIGH(GPIOE_CS_SPI) |           \
847
                                     PIN_ODR_HIGH(GPIOE_PIN4) |             \
848
                                     PIN_ODR_HIGH(GPIOE_PIN5) |             \
849
                                     PIN_ODR_HIGH(GPIOE_PIN6) |             \
850
                                     PIN_ODR_HIGH(GPIOE_PIN7) |             \
851
                                     PIN_ODR_HIGH(GPIOE_PIN8) |             \
852
                                     PIN_ODR_HIGH(GPIOE_PIN9) |             \
853
                                     PIN_ODR_HIGH(GPIOE_PIN10) |            \
854
                                     PIN_ODR_HIGH(GPIOE_PIN11) |            \
855
                                     PIN_ODR_HIGH(GPIOE_PIN12) |            \
856
                                     PIN_ODR_HIGH(GPIOE_PIN13) |            \
857
                                     PIN_ODR_HIGH(GPIOE_PIN14) |            \
858
                                     PIN_ODR_HIGH(GPIOE_PIN15))
859
#define VAL_GPIOE_AFRL              (PIN_AFIO_AF(GPIOE_INT1, 0U) |          \
860
                                     PIN_AFIO_AF(GPIOE_INT2, 0U) |          \
861
                                     PIN_AFIO_AF(GPIOE_PIN2, 0U) |          \
862
                                     PIN_AFIO_AF(GPIOE_CS_SPI, 0U) |        \
863
                                     PIN_AFIO_AF(GPIOE_PIN4, 0U) |          \
864
                                     PIN_AFIO_AF(GPIOE_PIN5, 0U) |          \
865
                                     PIN_AFIO_AF(GPIOE_PIN6, 0U) |          \
866
                                     PIN_AFIO_AF(GPIOE_PIN7, 0U))
867
#define VAL_GPIOE_AFRH              (PIN_AFIO_AF(GPIOE_PIN8, 0U) |          \
868
                                     PIN_AFIO_AF(GPIOE_PIN9, 0U) |          \
869
                                     PIN_AFIO_AF(GPIOE_PIN10, 0U) |         \
870
                                     PIN_AFIO_AF(GPIOE_PIN11, 0U) |         \
871
                                     PIN_AFIO_AF(GPIOE_PIN12, 0U) |         \
872
                                     PIN_AFIO_AF(GPIOE_PIN13, 0U) |         \
873
                                     PIN_AFIO_AF(GPIOE_PIN14, 0U) |         \
874
                                     PIN_AFIO_AF(GPIOE_PIN15, 0U))
875
876
/*
877
 * GPIOF setup:
878
 *
879
 * PF0  - PIN0                      (input floating).
880
 * PF1  - PIN1                      (input floating).
881
 * PF2  - PIN2                      (input floating).
882
 * PF3  - PIN3                      (input floating).
883
 * PF4  - PIN4                      (input floating).
884
 * PF5  - PIN5                      (input floating).
885
 * PF6  - PIN6                      (input floating).
886
 * PF7  - PIN7                      (input floating).
887
 * PF8  - PIN8                      (input floating).
888
 * PF9  - PIN9                      (input floating).
889
 * PF10 - PIN10                     (input floating).
890
 * PF11 - PIN11                     (input floating).
891
 * PF12 - PIN12                     (input floating).
892
 * PF13 - PIN13                     (input floating).
893
 * PF14 - PIN14                     (input floating).
894
 * PF15 - PIN15                     (input floating).
895
 */
896
#define VAL_GPIOF_MODER             (PIN_MODE_INPUT(GPIOF_PIN0) |           \
897
                                     PIN_MODE_INPUT(GPIOF_PIN1) |           \
898
                                     PIN_MODE_INPUT(GPIOF_PIN2) |           \
899
                                     PIN_MODE_INPUT(GPIOF_PIN3) |           \
900
                                     PIN_MODE_INPUT(GPIOF_PIN4) |           \
901
                                     PIN_MODE_INPUT(GPIOF_PIN5) |           \
902
                                     PIN_MODE_INPUT(GPIOF_PIN6) |           \
903
                                     PIN_MODE_INPUT(GPIOF_PIN7) |           \
904
                                     PIN_MODE_INPUT(GPIOF_PIN8) |           \
905
                                     PIN_MODE_INPUT(GPIOF_PIN9) |           \
906
                                     PIN_MODE_INPUT(GPIOF_PIN10) |          \
907
                                     PIN_MODE_INPUT(GPIOF_PIN11) |          \
908
                                     PIN_MODE_INPUT(GPIOF_PIN12) |          \
909
                                     PIN_MODE_INPUT(GPIOF_PIN13) |          \
910
                                     PIN_MODE_INPUT(GPIOF_PIN14) |          \
911
                                     PIN_MODE_INPUT(GPIOF_PIN15))
912
#define VAL_GPIOF_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) |       \
913
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN1) |       \
914
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN2) |       \
915
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN3) |       \
916
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN4) |       \
917
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN5) |       \
918
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN6) |       \
919
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN7) |       \
920
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN8) |       \
921
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN9) |       \
922
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN10) |      \
923
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN11) |      \
924
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN12) |      \
925
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN13) |      \
926
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN14) |      \
927
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
928
#define VAL_GPIOF_OSPEEDR           (PIN_OSPEED_HIGH(GPIOF_PIN0) |          \
929
                                     PIN_OSPEED_HIGH(GPIOF_PIN1) |          \
930
                                     PIN_OSPEED_HIGH(GPIOF_PIN2) |          \
931
                                     PIN_OSPEED_HIGH(GPIOF_PIN3) |          \
932
                                     PIN_OSPEED_HIGH(GPIOF_PIN4) |          \
933
                                     PIN_OSPEED_HIGH(GPIOF_PIN5) |          \
934
                                     PIN_OSPEED_HIGH(GPIOF_PIN6) |          \
935
                                     PIN_OSPEED_HIGH(GPIOF_PIN7) |          \
936
                                     PIN_OSPEED_HIGH(GPIOF_PIN8) |          \
937
                                     PIN_OSPEED_HIGH(GPIOF_PIN9) |          \
938
                                     PIN_OSPEED_HIGH(GPIOF_PIN10) |         \
939
                                     PIN_OSPEED_HIGH(GPIOF_PIN11) |         \
940
                                     PIN_OSPEED_HIGH(GPIOF_PIN12) |         \
941
                                     PIN_OSPEED_HIGH(GPIOF_PIN13) |         \
942
                                     PIN_OSPEED_HIGH(GPIOF_PIN14) |         \
943
                                     PIN_OSPEED_HIGH(GPIOF_PIN15))
944
#define VAL_GPIOF_PUPDR             (PIN_PUPDR_FLOATING(GPIOF_PIN0) |       \
945
                                     PIN_PUPDR_FLOATING(GPIOF_PIN1) |       \
946
                                     PIN_PUPDR_FLOATING(GPIOF_PIN2) |       \
947
                                     PIN_PUPDR_FLOATING(GPIOF_PIN3) |       \
948
                                     PIN_PUPDR_FLOATING(GPIOF_PIN4) |       \
949
                                     PIN_PUPDR_FLOATING(GPIOF_PIN5) |       \
950
                                     PIN_PUPDR_FLOATING(GPIOF_PIN6) |       \
951
                                     PIN_PUPDR_FLOATING(GPIOF_PIN7) |       \
952
                                     PIN_PUPDR_FLOATING(GPIOF_PIN8) |       \
953
                                     PIN_PUPDR_FLOATING(GPIOF_PIN9) |       \
954
                                     PIN_PUPDR_FLOATING(GPIOF_PIN10) |      \
955
                                     PIN_PUPDR_FLOATING(GPIOF_PIN11) |      \
956
                                     PIN_PUPDR_FLOATING(GPIOF_PIN12) |      \
957
                                     PIN_PUPDR_FLOATING(GPIOF_PIN13) |      \
958
                                     PIN_PUPDR_FLOATING(GPIOF_PIN14) |      \
959
                                     PIN_PUPDR_FLOATING(GPIOF_PIN15))
960
#define VAL_GPIOF_ODR               (PIN_ODR_HIGH(GPIOF_PIN0) |             \
961
                                     PIN_ODR_HIGH(GPIOF_PIN1) |             \
962
                                     PIN_ODR_HIGH(GPIOF_PIN2) |             \
963
                                     PIN_ODR_HIGH(GPIOF_PIN3) |             \
964
                                     PIN_ODR_HIGH(GPIOF_PIN4) |             \
965
                                     PIN_ODR_HIGH(GPIOF_PIN5) |             \
966
                                     PIN_ODR_HIGH(GPIOF_PIN6) |             \
967
                                     PIN_ODR_HIGH(GPIOF_PIN7) |             \
968
                                     PIN_ODR_HIGH(GPIOF_PIN8) |             \
969
                                     PIN_ODR_HIGH(GPIOF_PIN9) |             \
970
                                     PIN_ODR_HIGH(GPIOF_PIN10) |            \
971
                                     PIN_ODR_HIGH(GPIOF_PIN11) |            \
972
                                     PIN_ODR_HIGH(GPIOF_PIN12) |            \
973
                                     PIN_ODR_HIGH(GPIOF_PIN13) |            \
974
                                     PIN_ODR_HIGH(GPIOF_PIN14) |            \
975
                                     PIN_ODR_HIGH(GPIOF_PIN15))
976
#define VAL_GPIOF_AFRL              (PIN_AFIO_AF(GPIOF_PIN0, 0U) |          \
977
                                     PIN_AFIO_AF(GPIOF_PIN1, 0U) |          \
978
                                     PIN_AFIO_AF(GPIOF_PIN2, 0U) |          \
979
                                     PIN_AFIO_AF(GPIOF_PIN3, 0U) |          \
980
                                     PIN_AFIO_AF(GPIOF_PIN4, 0U) |          \
981
                                     PIN_AFIO_AF(GPIOF_PIN5, 0U) |          \
982
                                     PIN_AFIO_AF(GPIOF_PIN6, 0U) |          \
983
                                     PIN_AFIO_AF(GPIOF_PIN7, 0U))
984
#define VAL_GPIOF_AFRH              (PIN_AFIO_AF(GPIOF_PIN8, 0U) |          \
985
                                     PIN_AFIO_AF(GPIOF_PIN9, 0U) |          \
986
                                     PIN_AFIO_AF(GPIOF_PIN10, 0U) |         \
987
                                     PIN_AFIO_AF(GPIOF_PIN11, 0U) |         \
988
                                     PIN_AFIO_AF(GPIOF_PIN12, 0U) |         \
989
                                     PIN_AFIO_AF(GPIOF_PIN13, 0U) |         \
990
                                     PIN_AFIO_AF(GPIOF_PIN14, 0U) |         \
991
                                     PIN_AFIO_AF(GPIOF_PIN15, 0U))
992
993
/*
994
 * GPIOG setup:
995
 *
996
 * PG0  - PIN0                      (input floating).
997
 * PG1  - PIN1                      (input floating).
998
 * PG2  - PIN2                      (input floating).
999
 * PG3  - PIN3                      (input floating).
1000
 * PG4  - PIN4                      (input floating).
1001
 * PG5  - PIN5                      (input floating).
1002
 * PG6  - PIN6                      (input floating).
1003
 * PG7  - PIN7                      (input floating).
1004
 * PG8  - PIN8                      (input floating).
1005
 * PG9  - PIN9                      (input floating).
1006
 * PG10 - PIN10                     (input floating).
1007
 * PG11 - PIN11                     (input floating).
1008
 * PG12 - PIN12                     (input floating).
1009
 * PG13 - PIN13                     (input floating).
1010
 * PG14 - PIN14                     (input floating).
1011
 * PG15 - PIN15                     (input floating).
1012
 */
1013
#define VAL_GPIOG_MODER             (PIN_MODE_INPUT(GPIOG_PIN0) |           \
1014
                                     PIN_MODE_INPUT(GPIOG_PIN1) |           \
1015
                                     PIN_MODE_INPUT(GPIOG_PIN2) |           \
1016
                                     PIN_MODE_INPUT(GPIOG_PIN3) |           \
1017
                                     PIN_MODE_INPUT(GPIOG_PIN4) |           \
1018
                                     PIN_MODE_INPUT(GPIOG_PIN5) |           \
1019
                                     PIN_MODE_INPUT(GPIOG_PIN6) |           \
1020
                                     PIN_MODE_INPUT(GPIOG_PIN7) |           \
1021
                                     PIN_MODE_INPUT(GPIOG_PIN8) |           \
1022
                                     PIN_MODE_INPUT(GPIOG_PIN9) |           \
1023
                                     PIN_MODE_INPUT(GPIOG_PIN10) |          \
1024
                                     PIN_MODE_INPUT(GPIOG_PIN11) |          \
1025
                                     PIN_MODE_INPUT(GPIOG_PIN12) |          \
1026
                                     PIN_MODE_INPUT(GPIOG_PIN13) |          \
1027
                                     PIN_MODE_INPUT(GPIOG_PIN14) |          \
1028
                                     PIN_MODE_INPUT(GPIOG_PIN15))
1029
#define VAL_GPIOG_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) |       \
1030
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN1) |       \
1031
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN2) |       \
1032
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN3) |       \
1033
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN4) |       \
1034
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN5) |       \
1035
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN6) |       \
1036
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN7) |       \
1037
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN8) |       \
1038
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN9) |       \
1039
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN10) |      \
1040
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN11) |      \
1041
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN12) |      \
1042
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN13) |      \
1043
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN14) |      \
1044
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1045
#define VAL_GPIOG_OSPEEDR           (PIN_OSPEED_HIGH(GPIOG_PIN0) |          \
1046
                                     PIN_OSPEED_HIGH(GPIOG_PIN1) |          \
1047
                                     PIN_OSPEED_HIGH(GPIOG_PIN2) |          \
1048
                                     PIN_OSPEED_HIGH(GPIOG_PIN3) |          \
1049
                                     PIN_OSPEED_HIGH(GPIOG_PIN4) |          \
1050
                                     PIN_OSPEED_HIGH(GPIOG_PIN5) |          \
1051
                                     PIN_OSPEED_HIGH(GPIOG_PIN6) |          \
1052
                                     PIN_OSPEED_HIGH(GPIOG_PIN7) |          \
1053
                                     PIN_OSPEED_HIGH(GPIOG_PIN8) |          \
1054
                                     PIN_OSPEED_HIGH(GPIOG_PIN9) |          \
1055
                                     PIN_OSPEED_HIGH(GPIOG_PIN10) |         \
1056
                                     PIN_OSPEED_HIGH(GPIOG_PIN11) |         \
1057
                                     PIN_OSPEED_HIGH(GPIOG_PIN12) |         \
1058
                                     PIN_OSPEED_HIGH(GPIOG_PIN13) |         \
1059
                                     PIN_OSPEED_HIGH(GPIOG_PIN14) |         \
1060
                                     PIN_OSPEED_HIGH(GPIOG_PIN15))
1061
#define VAL_GPIOG_PUPDR             (PIN_PUPDR_FLOATING(GPIOG_PIN0) |       \
1062
                                     PIN_PUPDR_FLOATING(GPIOG_PIN1) |       \
1063
                                     PIN_PUPDR_FLOATING(GPIOG_PIN2) |       \
1064
                                     PIN_PUPDR_FLOATING(GPIOG_PIN3) |       \
1065
                                     PIN_PUPDR_FLOATING(GPIOG_PIN4) |       \
1066
                                     PIN_PUPDR_FLOATING(GPIOG_PIN5) |       \
1067
                                     PIN_PUPDR_FLOATING(GPIOG_PIN6) |       \
1068
                                     PIN_PUPDR_FLOATING(GPIOG_PIN7) |       \
1069
                                     PIN_PUPDR_FLOATING(GPIOG_PIN8) |       \
1070
                                     PIN_PUPDR_FLOATING(GPIOG_PIN9) |       \
1071
                                     PIN_PUPDR_FLOATING(GPIOG_PIN10) |      \
1072
                                     PIN_PUPDR_FLOATING(GPIOG_PIN11) |      \
1073
                                     PIN_PUPDR_FLOATING(GPIOG_PIN12) |      \
1074
                                     PIN_PUPDR_FLOATING(GPIOG_PIN13) |      \
1075
                                     PIN_PUPDR_FLOATING(GPIOG_PIN14) |      \
1076
                                     PIN_PUPDR_FLOATING(GPIOG_PIN15))
1077
#define VAL_GPIOG_ODR               (PIN_ODR_HIGH(GPIOG_PIN0) |             \
1078
                                     PIN_ODR_HIGH(GPIOG_PIN1) |             \
1079
                                     PIN_ODR_HIGH(GPIOG_PIN2) |             \
1080
                                     PIN_ODR_HIGH(GPIOG_PIN3) |             \
1081
                                     PIN_ODR_HIGH(GPIOG_PIN4) |             \
1082
                                     PIN_ODR_HIGH(GPIOG_PIN5) |             \
1083
                                     PIN_ODR_HIGH(GPIOG_PIN6) |             \
1084
                                     PIN_ODR_HIGH(GPIOG_PIN7) |             \
1085
                                     PIN_ODR_HIGH(GPIOG_PIN8) |             \
1086
                                     PIN_ODR_HIGH(GPIOG_PIN9) |             \
1087
                                     PIN_ODR_HIGH(GPIOG_PIN10) |            \
1088
                                     PIN_ODR_HIGH(GPIOG_PIN11) |            \
1089
                                     PIN_ODR_HIGH(GPIOG_PIN12) |            \
1090
                                     PIN_ODR_HIGH(GPIOG_PIN13) |            \
1091
                                     PIN_ODR_HIGH(GPIOG_PIN14) |            \
1092
                                     PIN_ODR_HIGH(GPIOG_PIN15))
1093
#define VAL_GPIOG_AFRL              (PIN_AFIO_AF(GPIOG_PIN0, 0U) |          \
1094
                                     PIN_AFIO_AF(GPIOG_PIN1, 0U) |          \
1095
                                     PIN_AFIO_AF(GPIOG_PIN2, 0U) |          \
1096
                                     PIN_AFIO_AF(GPIOG_PIN3, 0U) |          \
1097
                                     PIN_AFIO_AF(GPIOG_PIN4, 0U) |          \
1098
                                     PIN_AFIO_AF(GPIOG_PIN5, 0U) |          \
1099
                                     PIN_AFIO_AF(GPIOG_PIN6, 0U) |          \
1100
                                     PIN_AFIO_AF(GPIOG_PIN7, 0U))
1101
#define VAL_GPIOG_AFRH              (PIN_AFIO_AF(GPIOG_PIN8, 0U) |          \
1102
                                     PIN_AFIO_AF(GPIOG_PIN9, 0U) |          \
1103
                                     PIN_AFIO_AF(GPIOG_PIN10, 0U) |         \
1104
                                     PIN_AFIO_AF(GPIOG_PIN11, 0U) |         \
1105
                                     PIN_AFIO_AF(GPIOG_PIN12, 0U) |         \
1106
                                     PIN_AFIO_AF(GPIOG_PIN13, 0U) |         \
1107
                                     PIN_AFIO_AF(GPIOG_PIN14, 0U) |         \
1108
                                     PIN_AFIO_AF(GPIOG_PIN15, 0U))
1109
1110
/*
1111
 * GPIOH setup:
1112
 *
1113
 * PH0  - OSC_IN                    (input floating).
1114
 * PH1  - OSC_OUT                   (input floating).
1115
 * PH2  - PIN2                      (input floating).
1116
 * PH3  - PIN3                      (input floating).
1117
 * PH4  - PIN4                      (input floating).
1118
 * PH5  - PIN5                      (input floating).
1119
 * PH6  - PIN6                      (input floating).
1120
 * PH7  - PIN7                      (input floating).
1121
 * PH8  - PIN8                      (input floating).
1122
 * PH9  - PIN9                      (input floating).
1123
 * PH10 - PIN10                     (input floating).
1124
 * PH11 - PIN11                     (input floating).
1125
 * PH12 - PIN12                     (input floating).
1126
 * PH13 - PIN13                     (input floating).
1127
 * PH14 - PIN14                     (input floating).
1128
 * PH15 - PIN15                     (input floating).
1129
 */
1130
#define VAL_GPIOH_MODER             (PIN_MODE_INPUT(GPIOH_OSC_IN) |         \
1131
                                     PIN_MODE_INPUT(GPIOH_OSC_OUT) |        \
1132
                                     PIN_MODE_INPUT(GPIOH_PIN2) |           \
1133
                                     PIN_MODE_INPUT(GPIOH_PIN3) |           \
1134
                                     PIN_MODE_INPUT(GPIOH_PIN4) |           \
1135
                                     PIN_MODE_INPUT(GPIOH_PIN5) |           \
1136
                                     PIN_MODE_INPUT(GPIOH_PIN6) |           \
1137
                                     PIN_MODE_INPUT(GPIOH_PIN7) |           \
1138
                                     PIN_MODE_INPUT(GPIOH_PIN8) |           \
1139
                                     PIN_MODE_INPUT(GPIOH_PIN9) |           \
1140
                                     PIN_MODE_INPUT(GPIOH_PIN10) |          \
1141
                                     PIN_MODE_INPUT(GPIOH_PIN11) |          \
1142
                                     PIN_MODE_INPUT(GPIOH_PIN12) |          \
1143
                                     PIN_MODE_INPUT(GPIOH_PIN13) |          \
1144
                                     PIN_MODE_INPUT(GPIOH_PIN14) |          \
1145
                                     PIN_MODE_INPUT(GPIOH_PIN15))
1146
#define VAL_GPIOH_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) |     \
1147
                                     PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) |    \
1148
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN2) |       \
1149
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN3) |       \
1150
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN4) |       \
1151
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN5) |       \
1152
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN6) |       \
1153
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN7) |       \
1154
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN8) |       \
1155
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN9) |       \
1156
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN10) |      \
1157
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN11) |      \
1158
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN12) |      \
1159
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN13) |      \
1160
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN14) |      \
1161
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1162
#define VAL_GPIOH_OSPEEDR           (PIN_OSPEED_HIGH(GPIOH_OSC_IN) |        \
1163
                                     PIN_OSPEED_HIGH(GPIOH_OSC_OUT) |       \
1164
                                     PIN_OSPEED_HIGH(GPIOH_PIN2) |          \
1165
                                     PIN_OSPEED_HIGH(GPIOH_PIN3) |          \
1166
                                     PIN_OSPEED_HIGH(GPIOH_PIN4) |          \
1167
                                     PIN_OSPEED_HIGH(GPIOH_PIN5) |          \
1168
                                     PIN_OSPEED_HIGH(GPIOH_PIN6) |          \
1169
                                     PIN_OSPEED_HIGH(GPIOH_PIN7) |          \
1170
                                     PIN_OSPEED_HIGH(GPIOH_PIN8) |          \
1171
                                     PIN_OSPEED_HIGH(GPIOH_PIN9) |          \
1172
                                     PIN_OSPEED_HIGH(GPIOH_PIN10) |         \
1173
                                     PIN_OSPEED_HIGH(GPIOH_PIN11) |         \
1174
                                     PIN_OSPEED_HIGH(GPIOH_PIN12) |         \
1175
                                     PIN_OSPEED_HIGH(GPIOH_PIN13) |         \
1176
                                     PIN_OSPEED_HIGH(GPIOH_PIN14) |         \
1177
                                     PIN_OSPEED_HIGH(GPIOH_PIN15))
1178
#define VAL_GPIOH_PUPDR             (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) |     \
1179
                                     PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) |    \
1180
                                     PIN_PUPDR_FLOATING(GPIOH_PIN2) |       \
1181
                                     PIN_PUPDR_FLOATING(GPIOH_PIN3) |       \
1182
                                     PIN_PUPDR_FLOATING(GPIOH_PIN4) |       \
1183
                                     PIN_PUPDR_FLOATING(GPIOH_PIN5) |       \
1184
                                     PIN_PUPDR_FLOATING(GPIOH_PIN6) |       \
1185
                                     PIN_PUPDR_FLOATING(GPIOH_PIN7) |       \
1186
                                     PIN_PUPDR_FLOATING(GPIOH_PIN8) |       \
1187
                                     PIN_PUPDR_FLOATING(GPIOH_PIN9) |       \
1188
                                     PIN_PUPDR_FLOATING(GPIOH_PIN10) |      \
1189
                                     PIN_PUPDR_FLOATING(GPIOH_PIN11) |      \
1190
                                     PIN_PUPDR_FLOATING(GPIOH_PIN12) |      \
1191
                                     PIN_PUPDR_FLOATING(GPIOH_PIN13) |      \
1192
                                     PIN_PUPDR_FLOATING(GPIOH_PIN14) |      \
1193
                                     PIN_PUPDR_FLOATING(GPIOH_PIN15))
1194
#define VAL_GPIOH_ODR               (PIN_ODR_HIGH(GPIOH_OSC_IN) |           \
1195
                                     PIN_ODR_HIGH(GPIOH_OSC_OUT) |          \
1196
                                     PIN_ODR_HIGH(GPIOH_PIN2) |             \
1197
                                     PIN_ODR_HIGH(GPIOH_PIN3) |             \
1198
                                     PIN_ODR_HIGH(GPIOH_PIN4) |             \
1199
                                     PIN_ODR_HIGH(GPIOH_PIN5) |             \
1200
                                     PIN_ODR_HIGH(GPIOH_PIN6) |             \
1201
                                     PIN_ODR_HIGH(GPIOH_PIN7) |             \
1202
                                     PIN_ODR_HIGH(GPIOH_PIN8) |             \
1203
                                     PIN_ODR_HIGH(GPIOH_PIN9) |             \
1204
                                     PIN_ODR_HIGH(GPIOH_PIN10) |            \
1205
                                     PIN_ODR_HIGH(GPIOH_PIN11) |            \
1206
                                     PIN_ODR_HIGH(GPIOH_PIN12) |            \
1207
                                     PIN_ODR_HIGH(GPIOH_PIN13) |            \
1208
                                     PIN_ODR_HIGH(GPIOH_PIN14) |            \
1209
                                     PIN_ODR_HIGH(GPIOH_PIN15))
1210
#define VAL_GPIOH_AFRL              (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) |        \
1211
                                     PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) |       \
1212
                                     PIN_AFIO_AF(GPIOH_PIN2, 0U) |          \
1213
                                     PIN_AFIO_AF(GPIOH_PIN3, 0U) |          \
1214
                                     PIN_AFIO_AF(GPIOH_PIN4, 0U) |          \
1215
                                     PIN_AFIO_AF(GPIOH_PIN5, 0U) |          \
1216
                                     PIN_AFIO_AF(GPIOH_PIN6, 0U) |          \
1217
                                     PIN_AFIO_AF(GPIOH_PIN7, 0U))
1218
#define VAL_GPIOH_AFRH              (PIN_AFIO_AF(GPIOH_PIN8, 0U) |          \
1219
                                     PIN_AFIO_AF(GPIOH_PIN9, 0U) |          \
1220
                                     PIN_AFIO_AF(GPIOH_PIN10, 0U) |         \
1221
                                     PIN_AFIO_AF(GPIOH_PIN11, 0U) |         \
1222
                                     PIN_AFIO_AF(GPIOH_PIN12, 0U) |         \
1223
                                     PIN_AFIO_AF(GPIOH_PIN13, 0U) |         \
1224
                                     PIN_AFIO_AF(GPIOH_PIN14, 0U) |         \
1225
                                     PIN_AFIO_AF(GPIOH_PIN15, 0U))
1226
1227
/*
1228
 * GPIOI setup:
1229
 *
1230
 * PI0  - PIN0                      (input floating).
1231
 * PI1  - PIN1                      (input floating).
1232
 * PI2  - PIN2                      (input floating).
1233
 * PI3  - PIN3                      (input floating).
1234
 * PI4  - PIN4                      (input floating).
1235
 * PI5  - PIN5                      (input floating).
1236
 * PI6  - PIN6                      (input floating).
1237
 * PI7  - PIN7                      (input floating).
1238
 * PI8  - PIN8                      (input floating).
1239
 * PI9  - PIN9                      (input floating).
1240
 * PI10 - PIN10                     (input floating).
1241
 * PI11 - PIN11                     (input floating).
1242
 * PI12 - PIN12                     (input floating).
1243
 * PI13 - PIN13                     (input floating).
1244
 * PI14 - PIN14                     (input floating).
1245
 * PI15 - PIN15                     (input floating).
1246
 */
1247
#define VAL_GPIOI_MODER             (PIN_MODE_INPUT(GPIOI_PIN0) |           \
1248
                                     PIN_MODE_INPUT(GPIOI_PIN1) |           \
1249
                                     PIN_MODE_INPUT(GPIOI_PIN2) |           \
1250
                                     PIN_MODE_INPUT(GPIOI_PIN3) |           \
1251
                                     PIN_MODE_INPUT(GPIOI_PIN4) |           \
1252
                                     PIN_MODE_INPUT(GPIOI_PIN5) |           \
1253
                                     PIN_MODE_INPUT(GPIOI_PIN6) |           \
1254
                                     PIN_MODE_INPUT(GPIOI_PIN7) |           \
1255
                                     PIN_MODE_INPUT(GPIOI_PIN8) |           \
1256
                                     PIN_MODE_INPUT(GPIOI_PIN9) |           \
1257
                                     PIN_MODE_INPUT(GPIOI_PIN10) |          \
1258
                                     PIN_MODE_INPUT(GPIOI_PIN11) |          \
1259
                                     PIN_MODE_INPUT(GPIOI_PIN12) |          \
1260
                                     PIN_MODE_INPUT(GPIOI_PIN13) |          \
1261
                                     PIN_MODE_INPUT(GPIOI_PIN14) |          \
1262
                                     PIN_MODE_INPUT(GPIOI_PIN15))
1263
#define VAL_GPIOI_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) |       \
1264
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN1) |       \
1265
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN2) |       \
1266
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN3) |       \
1267
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN4) |       \
1268
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN5) |       \
1269
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN6) |       \
1270
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN7) |       \
1271
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN8) |       \
1272
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN9) |       \
1273
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN10) |      \
1274
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN11) |      \
1275
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN12) |      \
1276
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN13) |      \
1277
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN14) |      \
1278
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
1279
#define VAL_GPIOI_OSPEEDR           (PIN_OSPEED_HIGH(GPIOI_PIN0) |          \
1280
                                     PIN_OSPEED_HIGH(GPIOI_PIN1) |          \
1281
                                     PIN_OSPEED_HIGH(GPIOI_PIN2) |          \
1282
                                     PIN_OSPEED_HIGH(GPIOI_PIN3) |          \
1283
                                     PIN_OSPEED_HIGH(GPIOI_PIN4) |          \
1284
                                     PIN_OSPEED_HIGH(GPIOI_PIN5) |          \
1285
                                     PIN_OSPEED_HIGH(GPIOI_PIN6) |          \
1286
                                     PIN_OSPEED_HIGH(GPIOI_PIN7) |          \
1287
                                     PIN_OSPEED_HIGH(GPIOI_PIN8) |          \
1288
                                     PIN_OSPEED_HIGH(GPIOI_PIN9) |          \
1289
                                     PIN_OSPEED_HIGH(GPIOI_PIN10) |         \
1290
                                     PIN_OSPEED_HIGH(GPIOI_PIN11) |         \
1291
                                     PIN_OSPEED_HIGH(GPIOI_PIN12) |         \
1292
                                     PIN_OSPEED_HIGH(GPIOI_PIN13) |         \
1293
                                     PIN_OSPEED_HIGH(GPIOI_PIN14) |         \
1294
                                     PIN_OSPEED_HIGH(GPIOI_PIN15))
1295
#define VAL_GPIOI_PUPDR             (PIN_PUPDR_FLOATING(GPIOI_PIN0) |       \
1296
                                     PIN_PUPDR_FLOATING(GPIOI_PIN1) |       \
1297
                                     PIN_PUPDR_FLOATING(GPIOI_PIN2) |       \
1298
                                     PIN_PUPDR_FLOATING(GPIOI_PIN3) |       \
1299
                                     PIN_PUPDR_FLOATING(GPIOI_PIN4) |       \
1300
                                     PIN_PUPDR_FLOATING(GPIOI_PIN5) |       \
1301
                                     PIN_PUPDR_FLOATING(GPIOI_PIN6) |       \
1302
                                     PIN_PUPDR_FLOATING(GPIOI_PIN7) |       \
1303
                                     PIN_PUPDR_FLOATING(GPIOI_PIN8) |       \
1304
                                     PIN_PUPDR_FLOATING(GPIOI_PIN9) |       \
1305
                                     PIN_PUPDR_FLOATING(GPIOI_PIN10) |      \
1306
                                     PIN_PUPDR_FLOATING(GPIOI_PIN11) |      \
1307
                                     PIN_PUPDR_FLOATING(GPIOI_PIN12) |      \
1308
                                     PIN_PUPDR_FLOATING(GPIOI_PIN13) |      \
1309
                                     PIN_PUPDR_FLOATING(GPIOI_PIN14) |      \
1310
                                     PIN_PUPDR_FLOATING(GPIOI_PIN15))
1311
#define VAL_GPIOI_ODR               (PIN_ODR_HIGH(GPIOI_PIN0) |             \
1312
                                     PIN_ODR_HIGH(GPIOI_PIN1) |             \
1313
                                     PIN_ODR_HIGH(GPIOI_PIN2) |             \
1314
                                     PIN_ODR_HIGH(GPIOI_PIN3) |             \
1315
                                     PIN_ODR_HIGH(GPIOI_PIN4) |             \
1316
                                     PIN_ODR_HIGH(GPIOI_PIN5) |             \
1317
                                     PIN_ODR_HIGH(GPIOI_PIN6) |             \
1318
                                     PIN_ODR_HIGH(GPIOI_PIN7) |             \
1319
                                     PIN_ODR_HIGH(GPIOI_PIN8) |             \
1320
                                     PIN_ODR_HIGH(GPIOI_PIN9) |             \
1321
                                     PIN_ODR_HIGH(GPIOI_PIN10) |            \
1322
                                     PIN_ODR_HIGH(GPIOI_PIN11) |            \
1323
                                     PIN_ODR_HIGH(GPIOI_PIN12) |            \
1324
                                     PIN_ODR_HIGH(GPIOI_PIN13) |            \
1325
                                     PIN_ODR_HIGH(GPIOI_PIN14) |            \
1326
                                     PIN_ODR_HIGH(GPIOI_PIN15))
1327
#define VAL_GPIOI_AFRL              (PIN_AFIO_AF(GPIOI_PIN0, 0U) |          \
1328
                                     PIN_AFIO_AF(GPIOI_PIN1, 0U) |          \
1329
                                     PIN_AFIO_AF(GPIOI_PIN2, 0U) |          \
1330
                                     PIN_AFIO_AF(GPIOI_PIN3, 0U) |          \
1331
                                     PIN_AFIO_AF(GPIOI_PIN4, 0U) |          \
1332
                                     PIN_AFIO_AF(GPIOI_PIN5, 0U) |          \
1333
                                     PIN_AFIO_AF(GPIOI_PIN6, 0U) |          \
1334
                                     PIN_AFIO_AF(GPIOI_PIN7, 0U))
1335
#define VAL_GPIOI_AFRH              (PIN_AFIO_AF(GPIOI_PIN8, 0U) |          \
1336
                                     PIN_AFIO_AF(GPIOI_PIN9, 0U) |          \
1337
                                     PIN_AFIO_AF(GPIOI_PIN10, 0U) |         \
1338
                                     PIN_AFIO_AF(GPIOI_PIN11, 0U) |         \
1339
                                     PIN_AFIO_AF(GPIOI_PIN12, 0U) |         \
1340
                                     PIN_AFIO_AF(GPIOI_PIN13, 0U) |         \
1341
                                     PIN_AFIO_AF(GPIOI_PIN14, 0U) |         \
1342
                                     PIN_AFIO_AF(GPIOI_PIN15, 0U))
1343
1344
/*===========================================================================*/
1345
/* External declarations.                                                    */
1346
/*===========================================================================*/
1347
1348
#if !defined(_FROM_ASM_)
1349
#ifdef __cplusplus
1350
extern "C" {
1351
#endif
1352
  void boardInit(void);
1353
#ifdef __cplusplus
1354
}
1355
#endif
1356
#endif /* _FROM_ASM_ */
1357
1358
#endif /* BOARD_H */