Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / STM32F407G-DISC1 / board.h @ 0f60c8ad

History | View | Annotate | Download (85.5 KB)

1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

    
19
#ifndef BOARD_H
20
#define BOARD_H
21

    
22
/*===========================================================================*/
23
/* Driver constants.                                                         */
24
/*===========================================================================*/
25

    
26
/*
27
 * Setup for STMicroelectronics STM32F4-Discovery board.
28
 */
29

    
30
/*
31
 * Board identifier.
32
 */
33
#define BOARD_ST_STM32F4_DISCOVERY
34
#define BOARD_NAME                  "STMicroelectronics STM32F4-Discovery"
35

    
36
/*
37
 * Board oscillators-related settings.
38
 * NOTE: LSE not fitted.
39
 */
40
#if !defined(STM32_LSECLK)
41
#define STM32_LSECLK                0U
42
#endif
43

    
44
#if !defined(STM32_HSECLK)
45
#define STM32_HSECLK                8000000U
46
#endif
47

    
48
/*
49
 * Board voltages.
50
 * Required for performance limits calculation.
51
 */
52
#define STM32_VDD                   300U
53

    
54
/*
55
 * MCU type as defined in the ST header.
56
 */
57
#define STM32F407xx
58

    
59
/*
60
 * IO pins assignments.
61
 */
62
#define GPIOA_BUTTON                0U
63
#define GPIOA_PIN1                  1U
64
#define GPIOA_PIN2                  2U
65
#define GPIOA_PIN3                  3U
66
#define GPIOA_LRCK                  4U
67
#define GPIOA_SPC                   5U
68
#define GPIOA_SDO                   6U
69
#define GPIOA_SDI                   7U
70
#define GPIOA_PIN8                  8U
71
#define GPIOA_VBUS_FS               9U
72
#define GPIOA_OTG_FS_ID             10U
73
#define GPIOA_OTG_FS_DM             11U
74
#define GPIOA_OTG_FS_DP             12U
75
#define GPIOA_SWDIO                 13U
76
#define GPIOA_SWCLK                 14U
77
#define GPIOA_PIN15                 15U
78

    
79
#define GPIOB_PIN0                  0U
80
#define GPIOB_PIN1                  1U
81
#define GPIOB_PIN2                  2U
82
#define GPIOB_SWO                   3U
83
#define GPIOB_PIN4                  4U
84
#define GPIOB_PIN5                  5U
85
#define GPIOB_SCL                   6U
86
#define GPIOB_PIN7                  7U
87
#define GPIOB_PIN8                  8U
88
#define GPIOB_SDA                   9U
89
#define GPIOB_CLK_IN                10U
90
#define GPIOB_PIN11                 11U
91
#define GPIOB_PIN12                 12U
92
#define GPIOB_PIN13                 13U
93
#define GPIOB_PIN14                 14U
94
#define GPIOB_PIN15                 15U
95

    
96
#define GPIOC_OTG_FS_POWER_ON       0U
97
#define GPIOC_PIN1                  1U
98
#define GPIOC_PIN2                  2U
99
#define GPIOC_PDM_OUT               3U
100
#define GPIOC_PIN4                  4U
101
#define GPIOC_PIN5                  5U
102
#define GPIOC_PIN6                  6U
103
#define GPIOC_MCLK                  7U
104
#define GPIOC_PIN8                  8U
105
#define GPIOC_PIN9                  9U
106
#define GPIOC_SCLK                  10U
107
#define GPIOC_PIN11                 11U
108
#define GPIOC_SDIN                  12U
109
#define GPIOC_PIN13                 13U
110
#define GPIOC_PIN14                 14U
111
#define GPIOC_PIN15                 15U
112

    
113
#define GPIOD_PIN0                  0U
114
#define GPIOD_PIN1                  1U
115
#define GPIOD_PIN2                  2U
116
#define GPIOD_PIN3                  3U
117
#define GPIOD_RESET                 4U
118
#define GPIOD_OVER_CURRENT          5U
119
#define GPIOD_PIN6                  6U
120
#define GPIOD_PIN7                  7U
121
#define GPIOD_PIN8                  8U
122
#define GPIOD_PIN9                  9U
123
#define GPIOD_PIN10                 10U
124
#define GPIOD_PIN11                 11U
125
#define GPIOD_LED4                  12U
126
#define GPIOD_LED3                  13U
127
#define GPIOD_LED5                  14U
128
#define GPIOD_LED6                  15U
129

    
130
#define GPIOE_INT1                  0U
131
#define GPIOE_INT2                  1U
132
#define GPIOE_PIN2                  2U
133
#define GPIOE_CS_SPI                3U
134
#define GPIOE_PIN4                  4U
135
#define GPIOE_PIN5                  5U
136
#define GPIOE_PIN6                  6U
137
#define GPIOE_PIN7                  7U
138
#define GPIOE_PIN8                  8U
139
#define GPIOE_PIN9                  9U
140
#define GPIOE_PIN10                 10U
141
#define GPIOE_PIN11                 11U
142
#define GPIOE_PIN12                 12U
143
#define GPIOE_PIN13                 13U
144
#define GPIOE_PIN14                 14U
145
#define GPIOE_PIN15                 15U
146

    
147
#define GPIOF_PIN0                  0U
148
#define GPIOF_PIN1                  1U
149
#define GPIOF_PIN2                  2U
150
#define GPIOF_PIN3                  3U
151
#define GPIOF_PIN4                  4U
152
#define GPIOF_PIN5                  5U
153
#define GPIOF_PIN6                  6U
154
#define GPIOF_PIN7                  7U
155
#define GPIOF_PIN8                  8U
156
#define GPIOF_PIN9                  9U
157
#define GPIOF_PIN10                 10U
158
#define GPIOF_PIN11                 11U
159
#define GPIOF_PIN12                 12U
160
#define GPIOF_PIN13                 13U
161
#define GPIOF_PIN14                 14U
162
#define GPIOF_PIN15                 15U
163

    
164
#define GPIOG_PIN0                  0U
165
#define GPIOG_PIN1                  1U
166
#define GPIOG_PIN2                  2U
167
#define GPIOG_PIN3                  3U
168
#define GPIOG_PIN4                  4U
169
#define GPIOG_PIN5                  5U
170
#define GPIOG_PIN6                  6U
171
#define GPIOG_PIN7                  7U
172
#define GPIOG_PIN8                  8U
173
#define GPIOG_PIN9                  9U
174
#define GPIOG_PIN10                 10U
175
#define GPIOG_PIN11                 11U
176
#define GPIOG_PIN12                 12U
177
#define GPIOG_PIN13                 13U
178
#define GPIOG_PIN14                 14U
179
#define GPIOG_PIN15                 15U
180

    
181
#define GPIOH_OSC_IN                0U
182
#define GPIOH_OSC_OUT               1U
183
#define GPIOH_PIN2                  2U
184
#define GPIOH_PIN3                  3U
185
#define GPIOH_PIN4                  4U
186
#define GPIOH_PIN5                  5U
187
#define GPIOH_PIN6                  6U
188
#define GPIOH_PIN7                  7U
189
#define GPIOH_PIN8                  8U
190
#define GPIOH_PIN9                  9U
191
#define GPIOH_PIN10                 10U
192
#define GPIOH_PIN11                 11U
193
#define GPIOH_PIN12                 12U
194
#define GPIOH_PIN13                 13U
195
#define GPIOH_PIN14                 14U
196
#define GPIOH_PIN15                 15U
197

    
198
#define GPIOI_PIN0                  0U
199
#define GPIOI_PIN1                  1U
200
#define GPIOI_PIN2                  2U
201
#define GPIOI_PIN3                  3U
202
#define GPIOI_PIN4                  4U
203
#define GPIOI_PIN5                  5U
204
#define GPIOI_PIN6                  6U
205
#define GPIOI_PIN7                  7U
206
#define GPIOI_PIN8                  8U
207
#define GPIOI_PIN9                  9U
208
#define GPIOI_PIN10                 10U
209
#define GPIOI_PIN11                 11U
210
#define GPIOI_PIN12                 12U
211
#define GPIOI_PIN13                 13U
212
#define GPIOI_PIN14                 14U
213
#define GPIOI_PIN15                 15U
214

    
215
/*
216
 * IO lines assignments.
217
 */
218
#define LINE_BUTTON                 PAL_LINE(GPIOA, 0U)
219
#define LINE_LRCK                   PAL_LINE(GPIOA, 4U)
220
#define LINE_SPC                    PAL_LINE(GPIOA, 5U)
221
#define LINE_SDO                    PAL_LINE(GPIOA, 6U)
222
#define LINE_SDI                    PAL_LINE(GPIOA, 7U)
223
#define LINE_VBUS_FS                PAL_LINE(GPIOA, 9U)
224
#define LINE_OTG_FS_ID              PAL_LINE(GPIOA, 10U)
225
#define LINE_OTG_FS_DM              PAL_LINE(GPIOA, 11U)
226
#define LINE_OTG_FS_DP              PAL_LINE(GPIOA, 12U)
227
#define LINE_SWDIO                  PAL_LINE(GPIOA, 13U)
228
#define LINE_SWCLK                  PAL_LINE(GPIOA, 14U)
229
#define LINE_SWO                    PAL_LINE(GPIOB, 3U)
230
#define LINE_SCL                    PAL_LINE(GPIOB, 6U)
231
#define LINE_SDA                    PAL_LINE(GPIOB, 9U)
232
#define LINE_CLK_IN                 PAL_LINE(GPIOB, 10U)
233
#define LINE_OTG_FS_POWER_ON        PAL_LINE(GPIOC, 0U)
234
#define LINE_PDM_OUT                PAL_LINE(GPIOC, 3U)
235
#define LINE_MCLK                   PAL_LINE(GPIOC, 7U)
236
#define LINE_SCLK                   PAL_LINE(GPIOC, 10U)
237
#define LINE_SDIN                   PAL_LINE(GPIOC, 12U)
238
#define LINE_RESET                  PAL_LINE(GPIOD, 4U)
239
#define LINE_OVER_CURRENT           PAL_LINE(GPIOD, 5U)
240
#define LINE_LED4                   PAL_LINE(GPIOD, 12U)
241
#define LINE_LED3                   PAL_LINE(GPIOD, 13U)
242
#define LINE_LED5                   PAL_LINE(GPIOD, 14U)
243
#define LINE_LED6                   PAL_LINE(GPIOD, 15U)
244
#define LINE_INT1                   PAL_LINE(GPIOE, 0U)
245
#define LINE_INT2                   PAL_LINE(GPIOE, 1U)
246
#define LINE_CS_SPI                 PAL_LINE(GPIOE, 3U)
247
#define LINE_OSC_IN                 PAL_LINE(GPIOH, 0U)
248
#define LINE_OSC_OUT                PAL_LINE(GPIOH, 1U)
249

    
250
/*===========================================================================*/
251
/* Driver pre-compile time settings.                                         */
252
/*===========================================================================*/
253

    
254
/*===========================================================================*/
255
/* Derived constants and error checks.                                       */
256
/*===========================================================================*/
257

    
258
/*===========================================================================*/
259
/* Driver data structures and types.                                         */
260
/*===========================================================================*/
261

    
262
/*===========================================================================*/
263
/* Driver macros.                                                            */
264
/*===========================================================================*/
265

    
266
/*
267
 * I/O ports initial setup, this configuration is established soon after reset
268
 * in the initialization code.
269
 * Please refer to the STM32 Reference Manual for details.
270
 */
271
#define PIN_MODE_INPUT(n)           (0U << ((n) * 2U))
272
#define PIN_MODE_OUTPUT(n)          (1U << ((n) * 2U))
273
#define PIN_MODE_ALTERNATE(n)       (2U << ((n) * 2U))
274
#define PIN_MODE_ANALOG(n)          (3U << ((n) * 2U))
275
#define PIN_ODR_LOW(n)              (0U << (n))
276
#define PIN_ODR_HIGH(n)             (1U << (n))
277
#define PIN_OTYPE_PUSHPULL(n)       (0U << (n))
278
#define PIN_OTYPE_OPENDRAIN(n)      (1U << (n))
279
#define PIN_OSPEED_VERYLOW(n)       (0U << ((n) * 2U))
280
#define PIN_OSPEED_LOW(n)           (1U << ((n) * 2U))
281
#define PIN_OSPEED_MEDIUM(n)        (2U << ((n) * 2U))
282
#define PIN_OSPEED_HIGH(n)          (3U << ((n) * 2U))
283
#define PIN_PUPDR_FLOATING(n)       (0U << ((n) * 2U))
284
#define PIN_PUPDR_PULLUP(n)         (1U << ((n) * 2U))
285
#define PIN_PUPDR_PULLDOWN(n)       (2U << ((n) * 2U))
286
#define PIN_AFIO_AF(n, v)           ((v) << (((n) % 8U) * 4U))
287

    
288
/*
289
 * GPIOA setup:
290
 *
291
 * PA0  - BUTTON                    (input floating).
292
 * PA1  - PIN1                      (input pullup).
293
 * PA2  - PIN2                      (input pullup).
294
 * PA3  - PIN3                      (input pullup).
295
 * PA4  - LRCK                      (alternate 6).
296
 * PA5  - SPC                       (alternate 5).
297
 * PA6  - SDO                       (alternate 5).
298
 * PA7  - SDI                       (alternate 5).
299
 * PA8  - PIN8                      (input pullup).
300
 * PA9  - VBUS_FS                   (input floating).
301
 * PA10 - OTG_FS_ID                 (alternate 10).
302
 * PA11 - OTG_FS_DM                 (alternate 10).
303
 * PA12 - OTG_FS_DP                 (alternate 10).
304
 * PA13 - SWDIO                     (alternate 0).
305
 * PA14 - SWCLK                     (alternate 0).
306
 * PA15 - PIN15                     (input pullup).
307
 */
308
#define VAL_GPIOA_MODER             (PIN_MODE_INPUT(GPIOA_BUTTON) |         \
309
                                     PIN_MODE_INPUT(GPIOA_PIN1) |           \
310
                                     PIN_MODE_ALTERNATE(GPIOA_PIN2) |       \
311
                                     PIN_MODE_ALTERNATE(GPIOA_PIN3) |       \
312
                                     PIN_MODE_ALTERNATE(GPIOA_LRCK) |       \
313
                                     PIN_MODE_ALTERNATE(GPIOA_SPC) |        \
314
                                     PIN_MODE_ALTERNATE(GPIOA_SDO) |        \
315
                                     PIN_MODE_ALTERNATE(GPIOA_SDI) |        \
316
                                     PIN_MODE_INPUT(GPIOA_PIN8) |           \
317
                                     PIN_MODE_INPUT(GPIOA_VBUS_FS) |        \
318
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_ID) |  \
319
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) |  \
320
                                     PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) |  \
321
                                     PIN_MODE_ALTERNATE(GPIOA_SWDIO) |      \
322
                                     PIN_MODE_ALTERNATE(GPIOA_SWCLK) |      \
323
                                     PIN_MODE_INPUT(GPIOA_PIN15))
324
#define VAL_GPIOA_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) |     \
325
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN1) |       \
326
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN2) |       \
327
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN3) |       \
328
                                     PIN_OTYPE_PUSHPULL(GPIOA_LRCK) |       \
329
                                     PIN_OTYPE_PUSHPULL(GPIOA_SPC) |        \
330
                                     PIN_OTYPE_PUSHPULL(GPIOA_SDO) |        \
331
                                     PIN_OTYPE_PUSHPULL(GPIOA_SDI) |        \
332
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN8) |       \
333
                                     PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS) |    \
334
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_ID) |  \
335
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) |  \
336
                                     PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) |  \
337
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) |      \
338
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) |      \
339
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
340
#define VAL_GPIOA_OSPEEDR           (PIN_OSPEED_HIGH(GPIOA_BUTTON) |        \
341
                                     PIN_OSPEED_HIGH(GPIOA_PIN1) |          \
342
                                     PIN_OSPEED_HIGH(GPIOA_PIN2) |          \
343
                                     PIN_OSPEED_HIGH(GPIOA_PIN3) |          \
344
                                     PIN_OSPEED_HIGH(GPIOA_LRCK) |          \
345
                                     PIN_OSPEED_MEDIUM(GPIOA_SPC) |         \
346
                                     PIN_OSPEED_MEDIUM(GPIOA_SDO) |         \
347
                                     PIN_OSPEED_MEDIUM(GPIOA_SDI) |         \
348
                                     PIN_OSPEED_HIGH(GPIOA_PIN8) |          \
349
                                     PIN_OSPEED_HIGH(GPIOA_VBUS_FS) |       \
350
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_ID) |     \
351
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) |     \
352
                                     PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) |     \
353
                                     PIN_OSPEED_HIGH(GPIOA_SWDIO) |         \
354
                                     PIN_OSPEED_HIGH(GPIOA_SWCLK) |         \
355
                                     PIN_OSPEED_HIGH(GPIOA_PIN15))
356
#define VAL_GPIOA_PUPDR             (PIN_PUPDR_FLOATING(GPIOA_BUTTON) |     \
357
                                     PIN_PUPDR_PULLUP(GPIOA_PIN1) |         \
358
                                     PIN_PUPDR_PULLUP(GPIOA_PIN2) |         \
359
                                     PIN_PUPDR_PULLUP(GPIOA_PIN3) |         \
360
                                     PIN_PUPDR_FLOATING(GPIOA_LRCK) |       \
361
                                     PIN_PUPDR_FLOATING(GPIOA_SPC) |        \
362
                                     PIN_PUPDR_FLOATING(GPIOA_SDO) |        \
363
                                     PIN_PUPDR_FLOATING(GPIOA_SDI) |        \
364
                                     PIN_PUPDR_PULLUP(GPIOA_PIN8) |         \
365
                                     PIN_PUPDR_FLOATING(GPIOA_VBUS_FS) |    \
366
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_ID) |  \
367
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) |  \
368
                                     PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) |  \
369
                                     PIN_PUPDR_FLOATING(GPIOA_SWDIO) |      \
370
                                     PIN_PUPDR_FLOATING(GPIOA_SWCLK) |      \
371
                                     PIN_PUPDR_PULLUP(GPIOA_PIN15))
372
#define VAL_GPIOA_ODR               (PIN_ODR_HIGH(GPIOA_BUTTON) |           \
373
                                     PIN_ODR_HIGH(GPIOA_PIN1) |             \
374
                                     PIN_ODR_HIGH(GPIOA_PIN2) |             \
375
                                     PIN_ODR_HIGH(GPIOA_PIN3) |             \
376
                                     PIN_ODR_HIGH(GPIOA_LRCK) |             \
377
                                     PIN_ODR_HIGH(GPIOA_SPC) |              \
378
                                     PIN_ODR_HIGH(GPIOA_SDO) |              \
379
                                     PIN_ODR_HIGH(GPIOA_SDI) |              \
380
                                     PIN_ODR_HIGH(GPIOA_PIN8) |             \
381
                                     PIN_ODR_HIGH(GPIOA_VBUS_FS) |          \
382
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_ID) |        \
383
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_DM) |        \
384
                                     PIN_ODR_HIGH(GPIOA_OTG_FS_DP) |        \
385
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |            \
386
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |            \
387
                                     PIN_ODR_HIGH(GPIOA_PIN15))
388
#define VAL_GPIOA_AFRL              (PIN_AFIO_AF(GPIOA_BUTTON, 0U) |        \
389
                                     PIN_AFIO_AF(GPIOA_PIN1, 0U) |          \
390
                                     PIN_AFIO_AF(GPIOA_PIN2, 7U) |          \
391
                                     PIN_AFIO_AF(GPIOA_PIN3, 7U) |          \
392
                                     PIN_AFIO_AF(GPIOA_LRCK, 6U) |          \
393
                                     PIN_AFIO_AF(GPIOA_SPC, 5U) |           \
394
                                     PIN_AFIO_AF(GPIOA_SDO, 5U) |           \
395
                                     PIN_AFIO_AF(GPIOA_SDI, 5U))
396
#define VAL_GPIOA_AFRH              (PIN_AFIO_AF(GPIOA_PIN8, 0U) |          \
397
                                     PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) |       \
398
                                     PIN_AFIO_AF(GPIOA_OTG_FS_ID, 10U) |    \
399
                                     PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) |    \
400
                                     PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) |    \
401
                                     PIN_AFIO_AF(GPIOA_SWDIO, 0U) |         \
402
                                     PIN_AFIO_AF(GPIOA_SWCLK, 0U) |         \
403
                                     PIN_AFIO_AF(GPIOA_PIN15, 0U))
404

    
405
/*
406
 * GPIOB setup:
407
 *
408
 * PB0  - PIN0                      (input pullup).
409
 * PB1  - PIN1                      (input pullup).
410
 * PB2  - PIN2                      (input pullup).
411
 * PB3  - SWO                       (alternate 0).
412
 * PB4  - PIN4                      (input pullup).
413
 * PB5  - PIN5                      (input pullup).
414
 * PB6  - SCL                       (alternate 4).
415
 * PB7  - PIN7                      (input pullup).
416
 * PB8  - PIN8                      (input pullup).
417
 * PB9  - SDA                       (alternate 4).
418
 * PB10 - CLK_IN                    (input pullup).
419
 * PB11 - PIN11                     (input pullup).
420
 * PB12 - PIN12                     (input pullup).
421
 * PB13 - PIN13                     (input pullup).
422
 * PB14 - PIN14                     (input pullup).
423
 * PB15 - PIN15                     (input pullup).
424
 */
425
#define VAL_GPIOB_MODER             (PIN_MODE_INPUT(GPIOB_PIN0) |           \
426
                                     PIN_MODE_INPUT(GPIOB_PIN1) |           \
427
                                     PIN_MODE_INPUT(GPIOB_PIN2) |           \
428
                                     PIN_MODE_ALTERNATE(GPIOB_SWO) |        \
429
                                     PIN_MODE_INPUT(GPIOB_PIN4) |           \
430
                                     PIN_MODE_INPUT(GPIOB_PIN5) |           \
431
                                     PIN_MODE_ALTERNATE(GPIOB_SCL) |        \
432
                                     PIN_MODE_INPUT(GPIOB_PIN7) |           \
433
                                     PIN_MODE_INPUT(GPIOB_PIN8) |           \
434
                                     PIN_MODE_ALTERNATE(GPIOB_SDA) |        \
435
                                     PIN_MODE_INPUT(GPIOB_CLK_IN) |         \
436
                                     PIN_MODE_INPUT(GPIOB_PIN11) |          \
437
                                     PIN_MODE_INPUT(GPIOB_PIN12) |          \
438
                                     PIN_MODE_INPUT(GPIOB_PIN13) |          \
439
                                     PIN_MODE_INPUT(GPIOB_PIN14) |          \
440
                                     PIN_MODE_INPUT(GPIOB_PIN15))
441
#define VAL_GPIOB_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) |       \
442
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN1) |       \
443
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN2) |       \
444
                                     PIN_OTYPE_PUSHPULL(GPIOB_SWO) |        \
445
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN4) |       \
446
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN5) |       \
447
                                     PIN_OTYPE_OPENDRAIN(GPIOB_SCL) |       \
448
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN7) |       \
449
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN8) |       \
450
                                     PIN_OTYPE_OPENDRAIN(GPIOB_SDA) |       \
451
                                     PIN_OTYPE_PUSHPULL(GPIOB_CLK_IN) |     \
452
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN11) |      \
453
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN12) |      \
454
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN13) |      \
455
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN14) |      \
456
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
457
#define VAL_GPIOB_OSPEEDR           (PIN_OSPEED_HIGH(GPIOB_PIN0) |          \
458
                                     PIN_OSPEED_HIGH(GPIOB_PIN1) |          \
459
                                     PIN_OSPEED_HIGH(GPIOB_PIN2) |          \
460
                                     PIN_OSPEED_HIGH(GPIOB_SWO) |           \
461
                                     PIN_OSPEED_HIGH(GPIOB_PIN4) |          \
462
                                     PIN_OSPEED_HIGH(GPIOB_PIN5) |          \
463
                                     PIN_OSPEED_HIGH(GPIOB_SCL) |           \
464
                                     PIN_OSPEED_HIGH(GPIOB_PIN7) |          \
465
                                     PIN_OSPEED_HIGH(GPIOB_PIN8) |          \
466
                                     PIN_OSPEED_HIGH(GPIOB_SDA) |           \
467
                                     PIN_OSPEED_HIGH(GPIOB_CLK_IN) |        \
468
                                     PIN_OSPEED_HIGH(GPIOB_PIN11) |         \
469
                                     PIN_OSPEED_HIGH(GPIOB_PIN12) |         \
470
                                     PIN_OSPEED_HIGH(GPIOB_PIN13) |         \
471
                                     PIN_OSPEED_HIGH(GPIOB_PIN14) |         \
472
                                     PIN_OSPEED_HIGH(GPIOB_PIN15))
473
#define VAL_GPIOB_PUPDR             (PIN_PUPDR_PULLUP(GPIOB_PIN0) |         \
474
                                     PIN_PUPDR_PULLUP(GPIOB_PIN1) |         \
475
                                     PIN_PUPDR_PULLUP(GPIOB_PIN2) |         \
476
                                     PIN_PUPDR_FLOATING(GPIOB_SWO) |        \
477
                                     PIN_PUPDR_PULLUP(GPIOB_PIN4) |         \
478
                                     PIN_PUPDR_PULLUP(GPIOB_PIN5) |         \
479
                                     PIN_PUPDR_FLOATING(GPIOB_SCL) |        \
480
                                     PIN_PUPDR_PULLUP(GPIOB_PIN7) |         \
481
                                     PIN_PUPDR_PULLUP(GPIOB_PIN8) |         \
482
                                     PIN_PUPDR_FLOATING(GPIOB_SDA) |        \
483
                                     PIN_PUPDR_PULLUP(GPIOB_CLK_IN) |       \
484
                                     PIN_PUPDR_PULLUP(GPIOB_PIN11) |        \
485
                                     PIN_PUPDR_PULLUP(GPIOB_PIN12) |        \
486
                                     PIN_PUPDR_PULLUP(GPIOB_PIN13) |        \
487
                                     PIN_PUPDR_PULLUP(GPIOB_PIN14) |        \
488
                                     PIN_PUPDR_PULLUP(GPIOB_PIN15))
489
#define VAL_GPIOB_ODR               (PIN_ODR_HIGH(GPIOB_PIN0) |             \
490
                                     PIN_ODR_HIGH(GPIOB_PIN1) |             \
491
                                     PIN_ODR_HIGH(GPIOB_PIN2) |             \
492
                                     PIN_ODR_HIGH(GPIOB_SWO) |              \
493
                                     PIN_ODR_HIGH(GPIOB_PIN4) |             \
494
                                     PIN_ODR_HIGH(GPIOB_PIN5) |             \
495
                                     PIN_ODR_HIGH(GPIOB_SCL) |              \
496
                                     PIN_ODR_HIGH(GPIOB_PIN7) |             \
497
                                     PIN_ODR_HIGH(GPIOB_PIN8) |             \
498
                                     PIN_ODR_HIGH(GPIOB_SDA) |              \
499
                                     PIN_ODR_HIGH(GPIOB_CLK_IN) |           \
500
                                     PIN_ODR_HIGH(GPIOB_PIN11) |            \
501
                                     PIN_ODR_HIGH(GPIOB_PIN12) |            \
502
                                     PIN_ODR_HIGH(GPIOB_PIN13) |            \
503
                                     PIN_ODR_HIGH(GPIOB_PIN14) |            \
504
                                     PIN_ODR_HIGH(GPIOB_PIN15))
505
#define VAL_GPIOB_AFRL              (PIN_AFIO_AF(GPIOB_PIN0, 0U) |          \
506
                                     PIN_AFIO_AF(GPIOB_PIN1, 0U) |          \
507
                                     PIN_AFIO_AF(GPIOB_PIN2, 0U) |          \
508
                                     PIN_AFIO_AF(GPIOB_SWO, 0U) |           \
509
                                     PIN_AFIO_AF(GPIOB_PIN4, 0U) |          \
510
                                     PIN_AFIO_AF(GPIOB_PIN5, 0U) |          \
511
                                     PIN_AFIO_AF(GPIOB_SCL, 4U) |           \
512
                                     PIN_AFIO_AF(GPIOB_PIN7, 0U))
513
#define VAL_GPIOB_AFRH              (PIN_AFIO_AF(GPIOB_PIN8, 0U) |          \
514
                                     PIN_AFIO_AF(GPIOB_SDA, 4U) |           \
515
                                     PIN_AFIO_AF(GPIOB_CLK_IN, 0U) |        \
516
                                     PIN_AFIO_AF(GPIOB_PIN11, 0U) |         \
517
                                     PIN_AFIO_AF(GPIOB_PIN12, 0U) |         \
518
                                     PIN_AFIO_AF(GPIOB_PIN13, 0U) |         \
519
                                     PIN_AFIO_AF(GPIOB_PIN14, 0U) |         \
520
                                     PIN_AFIO_AF(GPIOB_PIN15, 0U))
521

    
522
/*
523
 * GPIOC setup:
524
 *
525
 * PC0  - OTG_FS_POWER_ON           (output pushpull maximum).
526
 * PC1  - PIN1                      (input pullup).
527
 * PC2  - PIN2                      (input pullup).
528
 * PC3  - PDM_OUT                   (input pullup).
529
 * PC4  - PIN4                      (input pullup).
530
 * PC5  - PIN5                      (input pullup).
531
 * PC6  - PIN6                      (input pullup).
532
 * PC7  - MCLK                      (alternate 6).
533
 * PC8  - PIN8                      (input pullup).
534
 * PC9  - PIN9                      (input pullup).
535
 * PC10 - SCLK                      (alternate 6).
536
 * PC11 - PIN11                     (input pullup).
537
 * PC12 - SDIN                      (alternate 6).
538
 * PC13 - PIN13                     (input pullup).
539
 * PC14 - PIN14                     (input pullup).
540
 * PC15 - PIN15                     (input pullup).
541
 */
542
#define VAL_GPIOC_MODER             (PIN_MODE_OUTPUT(GPIOC_OTG_FS_POWER_ON) |\
543
                                     PIN_MODE_INPUT(GPIOC_PIN1) |           \
544
                                     PIN_MODE_INPUT(GPIOC_PIN2) |           \
545
                                     PIN_MODE_INPUT(GPIOC_PDM_OUT) |        \
546
                                     PIN_MODE_INPUT(GPIOC_PIN4) |           \
547
                                     PIN_MODE_INPUT(GPIOC_PIN5) |           \
548
                                     PIN_MODE_INPUT(GPIOC_PIN6) |           \
549
                                     PIN_MODE_ALTERNATE(GPIOC_MCLK) |       \
550
                                     PIN_MODE_INPUT(GPIOC_PIN8) |           \
551
                                     PIN_MODE_INPUT(GPIOC_PIN9) |           \
552
                                     PIN_MODE_ALTERNATE(GPIOC_SCLK) |       \
553
                                     PIN_MODE_INPUT(GPIOC_PIN11) |          \
554
                                     PIN_MODE_ALTERNATE(GPIOC_SDIN) |       \
555
                                     PIN_MODE_INPUT(GPIOC_PIN13) |          \
556
                                     PIN_MODE_INPUT(GPIOC_PIN14) |          \
557
                                     PIN_MODE_INPUT(GPIOC_PIN15))
558
#define VAL_GPIOC_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_POWER_ON) |\
559
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN1) |       \
560
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN2) |       \
561
                                     PIN_OTYPE_PUSHPULL(GPIOC_PDM_OUT) |    \
562
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN4) |       \
563
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN5) |       \
564
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN6) |       \
565
                                     PIN_OTYPE_PUSHPULL(GPIOC_MCLK) |       \
566
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN8) |       \
567
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN9) |       \
568
                                     PIN_OTYPE_PUSHPULL(GPIOC_SCLK) |       \
569
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN11) |      \
570
                                     PIN_OTYPE_PUSHPULL(GPIOC_SDIN) |       \
571
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN13) |      \
572
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN14) |      \
573
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
574
#define VAL_GPIOC_OSPEEDR           (PIN_OSPEED_HIGH(GPIOC_OTG_FS_POWER_ON) |\
575
                                     PIN_OSPEED_HIGH(GPIOC_PIN1) |          \
576
                                     PIN_OSPEED_HIGH(GPIOC_PIN2) |          \
577
                                     PIN_OSPEED_HIGH(GPIOC_PDM_OUT) |       \
578
                                     PIN_OSPEED_HIGH(GPIOC_PIN4) |          \
579
                                     PIN_OSPEED_HIGH(GPIOC_PIN5) |          \
580
                                     PIN_OSPEED_HIGH(GPIOC_PIN6) |          \
581
                                     PIN_OSPEED_HIGH(GPIOC_MCLK) |          \
582
                                     PIN_OSPEED_HIGH(GPIOC_PIN8) |          \
583
                                     PIN_OSPEED_HIGH(GPIOC_PIN9) |          \
584
                                     PIN_OSPEED_HIGH(GPIOC_SCLK) |          \
585
                                     PIN_OSPEED_HIGH(GPIOC_PIN11) |         \
586
                                     PIN_OSPEED_HIGH(GPIOC_SDIN) |          \
587
                                     PIN_OSPEED_HIGH(GPIOC_PIN13) |         \
588
                                     PIN_OSPEED_HIGH(GPIOC_PIN14) |         \
589
                                     PIN_OSPEED_HIGH(GPIOC_PIN15))
590
#define VAL_GPIOC_PUPDR             (PIN_PUPDR_FLOATING(GPIOC_OTG_FS_POWER_ON) |\
591
                                     PIN_PUPDR_PULLUP(GPIOC_PIN1) |         \
592
                                     PIN_PUPDR_PULLUP(GPIOC_PIN2) |         \
593
                                     PIN_PUPDR_PULLUP(GPIOC_PDM_OUT) |      \
594
                                     PIN_PUPDR_PULLUP(GPIOC_PIN4) |         \
595
                                     PIN_PUPDR_PULLUP(GPIOC_PIN5) |         \
596
                                     PIN_PUPDR_PULLUP(GPIOC_PIN6) |         \
597
                                     PIN_PUPDR_FLOATING(GPIOC_MCLK) |       \
598
                                     PIN_PUPDR_PULLUP(GPIOC_PIN8) |         \
599
                                     PIN_PUPDR_PULLUP(GPIOC_PIN9) |         \
600
                                     PIN_PUPDR_FLOATING(GPIOC_SCLK) |       \
601
                                     PIN_PUPDR_PULLUP(GPIOC_PIN11) |        \
602
                                     PIN_PUPDR_FLOATING(GPIOC_SDIN) |       \
603
                                     PIN_PUPDR_PULLUP(GPIOC_PIN13) |        \
604
                                     PIN_PUPDR_PULLUP(GPIOC_PIN14) |        \
605
                                     PIN_PUPDR_PULLUP(GPIOC_PIN15))
606
#define VAL_GPIOC_ODR               (PIN_ODR_HIGH(GPIOC_OTG_FS_POWER_ON) |  \
607
                                     PIN_ODR_HIGH(GPIOC_PIN1) |             \
608
                                     PIN_ODR_HIGH(GPIOC_PIN2) |             \
609
                                     PIN_ODR_HIGH(GPIOC_PDM_OUT) |          \
610
                                     PIN_ODR_HIGH(GPIOC_PIN4) |             \
611
                                     PIN_ODR_HIGH(GPIOC_PIN5) |             \
612
                                     PIN_ODR_HIGH(GPIOC_PIN6) |             \
613
                                     PIN_ODR_HIGH(GPIOC_MCLK) |             \
614
                                     PIN_ODR_HIGH(GPIOC_PIN8) |             \
615
                                     PIN_ODR_HIGH(GPIOC_PIN9) |             \
616
                                     PIN_ODR_HIGH(GPIOC_SCLK) |             \
617
                                     PIN_ODR_HIGH(GPIOC_PIN11) |            \
618
                                     PIN_ODR_HIGH(GPIOC_SDIN) |             \
619
                                     PIN_ODR_HIGH(GPIOC_PIN13) |            \
620
                                     PIN_ODR_HIGH(GPIOC_PIN14) |            \
621
                                     PIN_ODR_HIGH(GPIOC_PIN15))
622
#define VAL_GPIOC_AFRL              (PIN_AFIO_AF(GPIOC_OTG_FS_POWER_ON, 0U) |\
623
                                     PIN_AFIO_AF(GPIOC_PIN1, 0U) |          \
624
                                     PIN_AFIO_AF(GPIOC_PIN2, 0U) |          \
625
                                     PIN_AFIO_AF(GPIOC_PDM_OUT, 0U) |       \
626
                                     PIN_AFIO_AF(GPIOC_PIN4, 0U) |          \
627
                                     PIN_AFIO_AF(GPIOC_PIN5, 0U) |          \
628
                                     PIN_AFIO_AF(GPIOC_PIN6, 0U) |          \
629
                                     PIN_AFIO_AF(GPIOC_MCLK, 6U))
630
#define VAL_GPIOC_AFRH              (PIN_AFIO_AF(GPIOC_PIN8, 0U) |          \
631
                                     PIN_AFIO_AF(GPIOC_PIN9, 0U) |          \
632
                                     PIN_AFIO_AF(GPIOC_SCLK, 6U) |          \
633
                                     PIN_AFIO_AF(GPIOC_PIN11, 0U) |         \
634
                                     PIN_AFIO_AF(GPIOC_SDIN, 6U) |          \
635
                                     PIN_AFIO_AF(GPIOC_PIN13, 0U) |         \
636
                                     PIN_AFIO_AF(GPIOC_PIN14, 0U) |         \
637
                                     PIN_AFIO_AF(GPIOC_PIN15, 0U))
638

    
639
/*
640
 * GPIOD setup:
641
 *
642
 * PD0  - PIN0                      (input pullup).
643
 * PD1  - PIN1                      (input pullup).
644
 * PD2  - PIN2                      (input pullup).
645
 * PD3  - PIN3                      (input pullup).
646
 * PD4  - RESET                     (output pushpull maximum).
647
 * PD5  - OVER_CURRENT              (input floating).
648
 * PD6  - PIN6                      (input pullup).
649
 * PD7  - PIN7                      (input pullup).
650
 * PD8  - PIN8                      (input pullup).
651
 * PD9  - PIN9                      (input pullup).
652
 * PD10 - PIN10                     (input pullup).
653
 * PD11 - PIN11                     (input pullup).
654
 * PD12 - LED4                      (output pushpull maximum).
655
 * PD13 - LED3                      (output pushpull maximum).
656
 * PD14 - LED5                      (output pushpull maximum).
657
 * PD15 - LED6                      (output pushpull maximum).
658
 */
659
#define VAL_GPIOD_MODER             (PIN_MODE_INPUT(GPIOD_PIN0) |           \
660
                                     PIN_MODE_INPUT(GPIOD_PIN1) |           \
661
                                     PIN_MODE_INPUT(GPIOD_PIN2) |           \
662
                                     PIN_MODE_INPUT(GPIOD_PIN3) |           \
663
                                     PIN_MODE_OUTPUT(GPIOD_RESET) |         \
664
                                     PIN_MODE_INPUT(GPIOD_OVER_CURRENT) |   \
665
                                     PIN_MODE_INPUT(GPIOD_PIN6) |           \
666
                                     PIN_MODE_INPUT(GPIOD_PIN7) |           \
667
                                     PIN_MODE_INPUT(GPIOD_PIN8) |           \
668
                                     PIN_MODE_INPUT(GPIOD_PIN9) |           \
669
                                     PIN_MODE_INPUT(GPIOD_PIN10) |          \
670
                                     PIN_MODE_INPUT(GPIOD_PIN11) |          \
671
                                     PIN_MODE_OUTPUT(GPIOD_LED4) |          \
672
                                     PIN_MODE_OUTPUT(GPIOD_LED3) |          \
673
                                     PIN_MODE_OUTPUT(GPIOD_LED5) |          \
674
                                     PIN_MODE_OUTPUT(GPIOD_LED6))
675
#define VAL_GPIOD_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) |       \
676
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN1) |       \
677
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN2) |       \
678
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN3) |       \
679
                                     PIN_OTYPE_PUSHPULL(GPIOD_RESET) |      \
680
                                     PIN_OTYPE_PUSHPULL(GPIOD_OVER_CURRENT) |\
681
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN6) |       \
682
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN7) |       \
683
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN8) |       \
684
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN9) |       \
685
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN10) |      \
686
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN11) |      \
687
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED4) |       \
688
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED3) |       \
689
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED5) |       \
690
                                     PIN_OTYPE_PUSHPULL(GPIOD_LED6))
691
#define VAL_GPIOD_OSPEEDR           (PIN_OSPEED_HIGH(GPIOD_PIN0) |          \
692
                                     PIN_OSPEED_HIGH(GPIOD_PIN1) |          \
693
                                     PIN_OSPEED_HIGH(GPIOD_PIN2) |          \
694
                                     PIN_OSPEED_HIGH(GPIOD_PIN3) |          \
695
                                     PIN_OSPEED_HIGH(GPIOD_RESET) |         \
696
                                     PIN_OSPEED_HIGH(GPIOD_OVER_CURRENT) |  \
697
                                     PIN_OSPEED_HIGH(GPIOD_PIN6) |          \
698
                                     PIN_OSPEED_HIGH(GPIOD_PIN7) |          \
699
                                     PIN_OSPEED_HIGH(GPIOD_PIN8) |          \
700
                                     PIN_OSPEED_HIGH(GPIOD_PIN9) |          \
701
                                     PIN_OSPEED_HIGH(GPIOD_PIN10) |         \
702
                                     PIN_OSPEED_HIGH(GPIOD_PIN11) |         \
703
                                     PIN_OSPEED_HIGH(GPIOD_LED4) |          \
704
                                     PIN_OSPEED_HIGH(GPIOD_LED3) |          \
705
                                     PIN_OSPEED_HIGH(GPIOD_LED5) |          \
706
                                     PIN_OSPEED_HIGH(GPIOD_LED6))
707
#define VAL_GPIOD_PUPDR             (PIN_PUPDR_PULLUP(GPIOD_PIN0) |         \
708
                                     PIN_PUPDR_PULLUP(GPIOD_PIN1) |         \
709
                                     PIN_PUPDR_PULLUP(GPIOD_PIN2) |         \
710
                                     PIN_PUPDR_PULLUP(GPIOD_PIN3) |         \
711
                                     PIN_PUPDR_FLOATING(GPIOD_RESET) |      \
712
                                     PIN_PUPDR_FLOATING(GPIOD_OVER_CURRENT) |\
713
                                     PIN_PUPDR_PULLUP(GPIOD_PIN6) |         \
714
                                     PIN_PUPDR_PULLUP(GPIOD_PIN7) |         \
715
                                     PIN_PUPDR_PULLUP(GPIOD_PIN8) |         \
716
                                     PIN_PUPDR_PULLUP(GPIOD_PIN9) |         \
717
                                     PIN_PUPDR_PULLUP(GPIOD_PIN10) |        \
718
                                     PIN_PUPDR_PULLUP(GPIOD_PIN11) |        \
719
                                     PIN_PUPDR_FLOATING(GPIOD_LED4) |       \
720
                                     PIN_PUPDR_FLOATING(GPIOD_LED3) |       \
721
                                     PIN_PUPDR_FLOATING(GPIOD_LED5) |       \
722
                                     PIN_PUPDR_FLOATING(GPIOD_LED6))
723
#define VAL_GPIOD_ODR               (PIN_ODR_HIGH(GPIOD_PIN0) |             \
724
                                     PIN_ODR_HIGH(GPIOD_PIN1) |             \
725
                                     PIN_ODR_HIGH(GPIOD_PIN2) |             \
726
                                     PIN_ODR_HIGH(GPIOD_PIN3) |             \
727
                                     PIN_ODR_HIGH(GPIOD_RESET) |            \
728
                                     PIN_ODR_HIGH(GPIOD_OVER_CURRENT) |     \
729
                                     PIN_ODR_HIGH(GPIOD_PIN6) |             \
730
                                     PIN_ODR_HIGH(GPIOD_PIN7) |             \
731
                                     PIN_ODR_HIGH(GPIOD_PIN8) |             \
732
                                     PIN_ODR_HIGH(GPIOD_PIN9) |             \
733
                                     PIN_ODR_HIGH(GPIOD_PIN10) |            \
734
                                     PIN_ODR_HIGH(GPIOD_PIN11) |            \
735
                                     PIN_ODR_LOW(GPIOD_LED4) |              \
736
                                     PIN_ODR_LOW(GPIOD_LED3) |              \
737
                                     PIN_ODR_LOW(GPIOD_LED5) |              \
738
                                     PIN_ODR_LOW(GPIOD_LED6))
739
#define VAL_GPIOD_AFRL              (PIN_AFIO_AF(GPIOD_PIN0, 0U) |          \
740
                                     PIN_AFIO_AF(GPIOD_PIN1, 0U) |          \
741
                                     PIN_AFIO_AF(GPIOD_PIN2, 0U) |          \
742
                                     PIN_AFIO_AF(GPIOD_PIN3, 0U) |          \
743
                                     PIN_AFIO_AF(GPIOD_RESET, 0U) |         \
744
                                     PIN_AFIO_AF(GPIOD_OVER_CURRENT, 0U) |  \
745
                                     PIN_AFIO_AF(GPIOD_PIN6, 0U) |          \
746
                                     PIN_AFIO_AF(GPIOD_PIN7, 0U))
747
#define VAL_GPIOD_AFRH              (PIN_AFIO_AF(GPIOD_PIN8, 0U) |          \
748
                                     PIN_AFIO_AF(GPIOD_PIN9, 0U) |          \
749
                                     PIN_AFIO_AF(GPIOD_PIN10, 0U) |         \
750
                                     PIN_AFIO_AF(GPIOD_PIN11, 0U) |         \
751
                                     PIN_AFIO_AF(GPIOD_LED4, 0U) |          \
752
                                     PIN_AFIO_AF(GPIOD_LED3, 0U) |          \
753
                                     PIN_AFIO_AF(GPIOD_LED5, 0U) |          \
754
                                     PIN_AFIO_AF(GPIOD_LED6, 0U))
755

    
756
/*
757
 * GPIOE setup:
758
 *
759
 * PE0  - INT1                      (input floating).
760
 * PE1  - INT2                      (input floating).
761
 * PE2  - PIN2                      (input floating).
762
 * PE3  - CS_SPI                    (output pushpull maximum).
763
 * PE4  - PIN4                      (input floating).
764
 * PE5  - PIN5                      (input floating).
765
 * PE6  - PIN6                      (input floating).
766
 * PE7  - PIN7                      (input floating).
767
 * PE8  - PIN8                      (input floating).
768
 * PE9  - PIN9                      (input floating).
769
 * PE10 - PIN10                     (input floating).
770
 * PE11 - PIN11                     (input floating).
771
 * PE12 - PIN12                     (input floating).
772
 * PE13 - PIN13                     (input floating).
773
 * PE14 - PIN14                     (input floating).
774
 * PE15 - PIN15                     (input floating).
775
 */
776
#define VAL_GPIOE_MODER             (PIN_MODE_INPUT(GPIOE_INT1) |           \
777
                                     PIN_MODE_INPUT(GPIOE_INT2) |           \
778
                                     PIN_MODE_INPUT(GPIOE_PIN2) |           \
779
                                     PIN_MODE_OUTPUT(GPIOE_CS_SPI) |        \
780
                                     PIN_MODE_INPUT(GPIOE_PIN4) |           \
781
                                     PIN_MODE_INPUT(GPIOE_PIN5) |           \
782
                                     PIN_MODE_INPUT(GPIOE_PIN6) |           \
783
                                     PIN_MODE_INPUT(GPIOE_PIN7) |           \
784
                                     PIN_MODE_INPUT(GPIOE_PIN8) |           \
785
                                     PIN_MODE_INPUT(GPIOE_PIN9) |           \
786
                                     PIN_MODE_INPUT(GPIOE_PIN10) |          \
787
                                     PIN_MODE_INPUT(GPIOE_PIN11) |          \
788
                                     PIN_MODE_INPUT(GPIOE_PIN12) |          \
789
                                     PIN_MODE_INPUT(GPIOE_PIN13) |          \
790
                                     PIN_MODE_INPUT(GPIOE_PIN14) |          \
791
                                     PIN_MODE_INPUT(GPIOE_PIN15))
792
#define VAL_GPIOE_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOE_INT1) |       \
793
                                     PIN_OTYPE_PUSHPULL(GPIOE_INT2) |       \
794
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |       \
795
                                     PIN_OTYPE_PUSHPULL(GPIOE_CS_SPI) |     \
796
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |       \
797
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |       \
798
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN6) |       \
799
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN7) |       \
800
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN8) |       \
801
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN9) |       \
802
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |      \
803
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN11) |      \
804
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN12) |      \
805
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN13) |      \
806
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |      \
807
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
808
#define VAL_GPIOE_OSPEEDR           (PIN_OSPEED_HIGH(GPIOE_INT1) |          \
809
                                     PIN_OSPEED_HIGH(GPIOE_INT2) |          \
810
                                     PIN_OSPEED_HIGH(GPIOE_PIN2) |          \
811
                                     PIN_OSPEED_HIGH(GPIOE_CS_SPI) |        \
812
                                     PIN_OSPEED_HIGH(GPIOE_PIN4) |          \
813
                                     PIN_OSPEED_HIGH(GPIOE_PIN5) |          \
814
                                     PIN_OSPEED_HIGH(GPIOE_PIN6) |          \
815
                                     PIN_OSPEED_HIGH(GPIOE_PIN7) |          \
816
                                     PIN_OSPEED_HIGH(GPIOE_PIN8) |          \
817
                                     PIN_OSPEED_HIGH(GPIOE_PIN9) |          \
818
                                     PIN_OSPEED_HIGH(GPIOE_PIN10) |         \
819
                                     PIN_OSPEED_HIGH(GPIOE_PIN11) |         \
820
                                     PIN_OSPEED_HIGH(GPIOE_PIN12) |         \
821
                                     PIN_OSPEED_HIGH(GPIOE_PIN13) |         \
822
                                     PIN_OSPEED_HIGH(GPIOE_PIN14) |         \
823
                                     PIN_OSPEED_HIGH(GPIOE_PIN15))
824
#define VAL_GPIOE_PUPDR             (PIN_PUPDR_FLOATING(GPIOE_INT1) |       \
825
                                     PIN_PUPDR_FLOATING(GPIOE_INT2) |       \
826
                                     PIN_PUPDR_FLOATING(GPIOE_PIN2) |       \
827
                                     PIN_PUPDR_FLOATING(GPIOE_CS_SPI) |     \
828
                                     PIN_PUPDR_FLOATING(GPIOE_PIN4) |       \
829
                                     PIN_PUPDR_FLOATING(GPIOE_PIN5) |       \
830
                                     PIN_PUPDR_FLOATING(GPIOE_PIN6) |       \
831
                                     PIN_PUPDR_FLOATING(GPIOE_PIN7) |       \
832
                                     PIN_PUPDR_FLOATING(GPIOE_PIN8) |       \
833
                                     PIN_PUPDR_FLOATING(GPIOE_PIN9) |       \
834
                                     PIN_PUPDR_FLOATING(GPIOE_PIN10) |      \
835
                                     PIN_PUPDR_FLOATING(GPIOE_PIN11) |      \
836
                                     PIN_PUPDR_FLOATING(GPIOE_PIN12) |      \
837
                                     PIN_PUPDR_FLOATING(GPIOE_PIN13) |      \
838
                                     PIN_PUPDR_FLOATING(GPIOE_PIN14) |      \
839
                                     PIN_PUPDR_FLOATING(GPIOE_PIN15))
840
#define VAL_GPIOE_ODR               (PIN_ODR_HIGH(GPIOE_INT1) |             \
841
                                     PIN_ODR_HIGH(GPIOE_INT2) |             \
842
                                     PIN_ODR_HIGH(GPIOE_PIN2) |             \
843
                                     PIN_ODR_HIGH(GPIOE_CS_SPI) |           \
844
                                     PIN_ODR_HIGH(GPIOE_PIN4) |             \
845
                                     PIN_ODR_HIGH(GPIOE_PIN5) |             \
846
                                     PIN_ODR_HIGH(GPIOE_PIN6) |             \
847
                                     PIN_ODR_HIGH(GPIOE_PIN7) |             \
848
                                     PIN_ODR_HIGH(GPIOE_PIN8) |             \
849
                                     PIN_ODR_HIGH(GPIOE_PIN9) |             \
850
                                     PIN_ODR_HIGH(GPIOE_PIN10) |            \
851
                                     PIN_ODR_HIGH(GPIOE_PIN11) |            \
852
                                     PIN_ODR_HIGH(GPIOE_PIN12) |            \
853
                                     PIN_ODR_HIGH(GPIOE_PIN13) |            \
854
                                     PIN_ODR_HIGH(GPIOE_PIN14) |            \
855
                                     PIN_ODR_HIGH(GPIOE_PIN15))
856
#define VAL_GPIOE_AFRL              (PIN_AFIO_AF(GPIOE_INT1, 0U) |          \
857
                                     PIN_AFIO_AF(GPIOE_INT2, 0U) |          \
858
                                     PIN_AFIO_AF(GPIOE_PIN2, 0U) |          \
859
                                     PIN_AFIO_AF(GPIOE_CS_SPI, 0U) |        \
860
                                     PIN_AFIO_AF(GPIOE_PIN4, 0U) |          \
861
                                     PIN_AFIO_AF(GPIOE_PIN5, 0U) |          \
862
                                     PIN_AFIO_AF(GPIOE_PIN6, 0U) |          \
863
                                     PIN_AFIO_AF(GPIOE_PIN7, 0U))
864
#define VAL_GPIOE_AFRH              (PIN_AFIO_AF(GPIOE_PIN8, 0U) |          \
865
                                     PIN_AFIO_AF(GPIOE_PIN9, 0U) |          \
866
                                     PIN_AFIO_AF(GPIOE_PIN10, 0U) |         \
867
                                     PIN_AFIO_AF(GPIOE_PIN11, 0U) |         \
868
                                     PIN_AFIO_AF(GPIOE_PIN12, 0U) |         \
869
                                     PIN_AFIO_AF(GPIOE_PIN13, 0U) |         \
870
                                     PIN_AFIO_AF(GPIOE_PIN14, 0U) |         \
871
                                     PIN_AFIO_AF(GPIOE_PIN15, 0U))
872

    
873
/*
874
 * GPIOF setup:
875
 *
876
 * PF0  - PIN0                      (input floating).
877
 * PF1  - PIN1                      (input floating).
878
 * PF2  - PIN2                      (input floating).
879
 * PF3  - PIN3                      (input floating).
880
 * PF4  - PIN4                      (input floating).
881
 * PF5  - PIN5                      (input floating).
882
 * PF6  - PIN6                      (input floating).
883
 * PF7  - PIN7                      (input floating).
884
 * PF8  - PIN8                      (input floating).
885
 * PF9  - PIN9                      (input floating).
886
 * PF10 - PIN10                     (input floating).
887
 * PF11 - PIN11                     (input floating).
888
 * PF12 - PIN12                     (input floating).
889
 * PF13 - PIN13                     (input floating).
890
 * PF14 - PIN14                     (input floating).
891
 * PF15 - PIN15                     (input floating).
892
 */
893
#define VAL_GPIOF_MODER             (PIN_MODE_INPUT(GPIOF_PIN0) |           \
894
                                     PIN_MODE_INPUT(GPIOF_PIN1) |           \
895
                                     PIN_MODE_INPUT(GPIOF_PIN2) |           \
896
                                     PIN_MODE_INPUT(GPIOF_PIN3) |           \
897
                                     PIN_MODE_INPUT(GPIOF_PIN4) |           \
898
                                     PIN_MODE_INPUT(GPIOF_PIN5) |           \
899
                                     PIN_MODE_INPUT(GPIOF_PIN6) |           \
900
                                     PIN_MODE_INPUT(GPIOF_PIN7) |           \
901
                                     PIN_MODE_INPUT(GPIOF_PIN8) |           \
902
                                     PIN_MODE_INPUT(GPIOF_PIN9) |           \
903
                                     PIN_MODE_INPUT(GPIOF_PIN10) |          \
904
                                     PIN_MODE_INPUT(GPIOF_PIN11) |          \
905
                                     PIN_MODE_INPUT(GPIOF_PIN12) |          \
906
                                     PIN_MODE_INPUT(GPIOF_PIN13) |          \
907
                                     PIN_MODE_INPUT(GPIOF_PIN14) |          \
908
                                     PIN_MODE_INPUT(GPIOF_PIN15))
909
#define VAL_GPIOF_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) |       \
910
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN1) |       \
911
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN2) |       \
912
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN3) |       \
913
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN4) |       \
914
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN5) |       \
915
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN6) |       \
916
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN7) |       \
917
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN8) |       \
918
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN9) |       \
919
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN10) |      \
920
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN11) |      \
921
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN12) |      \
922
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN13) |      \
923
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN14) |      \
924
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
925
#define VAL_GPIOF_OSPEEDR           (PIN_OSPEED_HIGH(GPIOF_PIN0) |          \
926
                                     PIN_OSPEED_HIGH(GPIOF_PIN1) |          \
927
                                     PIN_OSPEED_HIGH(GPIOF_PIN2) |          \
928
                                     PIN_OSPEED_HIGH(GPIOF_PIN3) |          \
929
                                     PIN_OSPEED_HIGH(GPIOF_PIN4) |          \
930
                                     PIN_OSPEED_HIGH(GPIOF_PIN5) |          \
931
                                     PIN_OSPEED_HIGH(GPIOF_PIN6) |          \
932
                                     PIN_OSPEED_HIGH(GPIOF_PIN7) |          \
933
                                     PIN_OSPEED_HIGH(GPIOF_PIN8) |          \
934
                                     PIN_OSPEED_HIGH(GPIOF_PIN9) |          \
935
                                     PIN_OSPEED_HIGH(GPIOF_PIN10) |         \
936
                                     PIN_OSPEED_HIGH(GPIOF_PIN11) |         \
937
                                     PIN_OSPEED_HIGH(GPIOF_PIN12) |         \
938
                                     PIN_OSPEED_HIGH(GPIOF_PIN13) |         \
939
                                     PIN_OSPEED_HIGH(GPIOF_PIN14) |         \
940
                                     PIN_OSPEED_HIGH(GPIOF_PIN15))
941
#define VAL_GPIOF_PUPDR             (PIN_PUPDR_FLOATING(GPIOF_PIN0) |       \
942
                                     PIN_PUPDR_FLOATING(GPIOF_PIN1) |       \
943
                                     PIN_PUPDR_FLOATING(GPIOF_PIN2) |       \
944
                                     PIN_PUPDR_FLOATING(GPIOF_PIN3) |       \
945
                                     PIN_PUPDR_FLOATING(GPIOF_PIN4) |       \
946
                                     PIN_PUPDR_FLOATING(GPIOF_PIN5) |       \
947
                                     PIN_PUPDR_FLOATING(GPIOF_PIN6) |       \
948
                                     PIN_PUPDR_FLOATING(GPIOF_PIN7) |       \
949
                                     PIN_PUPDR_FLOATING(GPIOF_PIN8) |       \
950
                                     PIN_PUPDR_FLOATING(GPIOF_PIN9) |       \
951
                                     PIN_PUPDR_FLOATING(GPIOF_PIN10) |      \
952
                                     PIN_PUPDR_FLOATING(GPIOF_PIN11) |      \
953
                                     PIN_PUPDR_FLOATING(GPIOF_PIN12) |      \
954
                                     PIN_PUPDR_FLOATING(GPIOF_PIN13) |      \
955
                                     PIN_PUPDR_FLOATING(GPIOF_PIN14) |      \
956
                                     PIN_PUPDR_FLOATING(GPIOF_PIN15))
957
#define VAL_GPIOF_ODR               (PIN_ODR_HIGH(GPIOF_PIN0) |             \
958
                                     PIN_ODR_HIGH(GPIOF_PIN1) |             \
959
                                     PIN_ODR_HIGH(GPIOF_PIN2) |             \
960
                                     PIN_ODR_HIGH(GPIOF_PIN3) |             \
961
                                     PIN_ODR_HIGH(GPIOF_PIN4) |             \
962
                                     PIN_ODR_HIGH(GPIOF_PIN5) |             \
963
                                     PIN_ODR_HIGH(GPIOF_PIN6) |             \
964
                                     PIN_ODR_HIGH(GPIOF_PIN7) |             \
965
                                     PIN_ODR_HIGH(GPIOF_PIN8) |             \
966
                                     PIN_ODR_HIGH(GPIOF_PIN9) |             \
967
                                     PIN_ODR_HIGH(GPIOF_PIN10) |            \
968
                                     PIN_ODR_HIGH(GPIOF_PIN11) |            \
969
                                     PIN_ODR_HIGH(GPIOF_PIN12) |            \
970
                                     PIN_ODR_HIGH(GPIOF_PIN13) |            \
971
                                     PIN_ODR_HIGH(GPIOF_PIN14) |            \
972
                                     PIN_ODR_HIGH(GPIOF_PIN15))
973
#define VAL_GPIOF_AFRL              (PIN_AFIO_AF(GPIOF_PIN0, 0U) |          \
974
                                     PIN_AFIO_AF(GPIOF_PIN1, 0U) |          \
975
                                     PIN_AFIO_AF(GPIOF_PIN2, 0U) |          \
976
                                     PIN_AFIO_AF(GPIOF_PIN3, 0U) |          \
977
                                     PIN_AFIO_AF(GPIOF_PIN4, 0U) |          \
978
                                     PIN_AFIO_AF(GPIOF_PIN5, 0U) |          \
979
                                     PIN_AFIO_AF(GPIOF_PIN6, 0U) |          \
980
                                     PIN_AFIO_AF(GPIOF_PIN7, 0U))
981
#define VAL_GPIOF_AFRH              (PIN_AFIO_AF(GPIOF_PIN8, 0U) |          \
982
                                     PIN_AFIO_AF(GPIOF_PIN9, 0U) |          \
983
                                     PIN_AFIO_AF(GPIOF_PIN10, 0U) |         \
984
                                     PIN_AFIO_AF(GPIOF_PIN11, 0U) |         \
985
                                     PIN_AFIO_AF(GPIOF_PIN12, 0U) |         \
986
                                     PIN_AFIO_AF(GPIOF_PIN13, 0U) |         \
987
                                     PIN_AFIO_AF(GPIOF_PIN14, 0U) |         \
988
                                     PIN_AFIO_AF(GPIOF_PIN15, 0U))
989

    
990
/*
991
 * GPIOG setup:
992
 *
993
 * PG0  - PIN0                      (input floating).
994
 * PG1  - PIN1                      (input floating).
995
 * PG2  - PIN2                      (input floating).
996
 * PG3  - PIN3                      (input floating).
997
 * PG4  - PIN4                      (input floating).
998
 * PG5  - PIN5                      (input floating).
999
 * PG6  - PIN6                      (input floating).
1000
 * PG7  - PIN7                      (input floating).
1001
 * PG8  - PIN8                      (input floating).
1002
 * PG9  - PIN9                      (input floating).
1003
 * PG10 - PIN10                     (input floating).
1004
 * PG11 - PIN11                     (input floating).
1005
 * PG12 - PIN12                     (input floating).
1006
 * PG13 - PIN13                     (input floating).
1007
 * PG14 - PIN14                     (input floating).
1008
 * PG15 - PIN15                     (input floating).
1009
 */
1010
#define VAL_GPIOG_MODER             (PIN_MODE_INPUT(GPIOG_PIN0) |           \
1011
                                     PIN_MODE_INPUT(GPIOG_PIN1) |           \
1012
                                     PIN_MODE_INPUT(GPIOG_PIN2) |           \
1013
                                     PIN_MODE_INPUT(GPIOG_PIN3) |           \
1014
                                     PIN_MODE_INPUT(GPIOG_PIN4) |           \
1015
                                     PIN_MODE_INPUT(GPIOG_PIN5) |           \
1016
                                     PIN_MODE_INPUT(GPIOG_PIN6) |           \
1017
                                     PIN_MODE_INPUT(GPIOG_PIN7) |           \
1018
                                     PIN_MODE_INPUT(GPIOG_PIN8) |           \
1019
                                     PIN_MODE_INPUT(GPIOG_PIN9) |           \
1020
                                     PIN_MODE_INPUT(GPIOG_PIN10) |          \
1021
                                     PIN_MODE_INPUT(GPIOG_PIN11) |          \
1022
                                     PIN_MODE_INPUT(GPIOG_PIN12) |          \
1023
                                     PIN_MODE_INPUT(GPIOG_PIN13) |          \
1024
                                     PIN_MODE_INPUT(GPIOG_PIN14) |          \
1025
                                     PIN_MODE_INPUT(GPIOG_PIN15))
1026
#define VAL_GPIOG_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) |       \
1027
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN1) |       \
1028
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN2) |       \
1029
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN3) |       \
1030
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN4) |       \
1031
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN5) |       \
1032
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN6) |       \
1033
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN7) |       \
1034
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN8) |       \
1035
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN9) |       \
1036
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN10) |      \
1037
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN11) |      \
1038
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN12) |      \
1039
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN13) |      \
1040
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN14) |      \
1041
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1042
#define VAL_GPIOG_OSPEEDR           (PIN_OSPEED_HIGH(GPIOG_PIN0) |          \
1043
                                     PIN_OSPEED_HIGH(GPIOG_PIN1) |          \
1044
                                     PIN_OSPEED_HIGH(GPIOG_PIN2) |          \
1045
                                     PIN_OSPEED_HIGH(GPIOG_PIN3) |          \
1046
                                     PIN_OSPEED_HIGH(GPIOG_PIN4) |          \
1047
                                     PIN_OSPEED_HIGH(GPIOG_PIN5) |          \
1048
                                     PIN_OSPEED_HIGH(GPIOG_PIN6) |          \
1049
                                     PIN_OSPEED_HIGH(GPIOG_PIN7) |          \
1050
                                     PIN_OSPEED_HIGH(GPIOG_PIN8) |          \
1051
                                     PIN_OSPEED_HIGH(GPIOG_PIN9) |          \
1052
                                     PIN_OSPEED_HIGH(GPIOG_PIN10) |         \
1053
                                     PIN_OSPEED_HIGH(GPIOG_PIN11) |         \
1054
                                     PIN_OSPEED_HIGH(GPIOG_PIN12) |         \
1055
                                     PIN_OSPEED_HIGH(GPIOG_PIN13) |         \
1056
                                     PIN_OSPEED_HIGH(GPIOG_PIN14) |         \
1057
                                     PIN_OSPEED_HIGH(GPIOG_PIN15))
1058
#define VAL_GPIOG_PUPDR             (PIN_PUPDR_FLOATING(GPIOG_PIN0) |       \
1059
                                     PIN_PUPDR_FLOATING(GPIOG_PIN1) |       \
1060
                                     PIN_PUPDR_FLOATING(GPIOG_PIN2) |       \
1061
                                     PIN_PUPDR_FLOATING(GPIOG_PIN3) |       \
1062
                                     PIN_PUPDR_FLOATING(GPIOG_PIN4) |       \
1063
                                     PIN_PUPDR_FLOATING(GPIOG_PIN5) |       \
1064
                                     PIN_PUPDR_FLOATING(GPIOG_PIN6) |       \
1065
                                     PIN_PUPDR_FLOATING(GPIOG_PIN7) |       \
1066
                                     PIN_PUPDR_FLOATING(GPIOG_PIN8) |       \
1067
                                     PIN_PUPDR_FLOATING(GPIOG_PIN9) |       \
1068
                                     PIN_PUPDR_FLOATING(GPIOG_PIN10) |      \
1069
                                     PIN_PUPDR_FLOATING(GPIOG_PIN11) |      \
1070
                                     PIN_PUPDR_FLOATING(GPIOG_PIN12) |      \
1071
                                     PIN_PUPDR_FLOATING(GPIOG_PIN13) |      \
1072
                                     PIN_PUPDR_FLOATING(GPIOG_PIN14) |      \
1073
                                     PIN_PUPDR_FLOATING(GPIOG_PIN15))
1074
#define VAL_GPIOG_ODR               (PIN_ODR_HIGH(GPIOG_PIN0) |             \
1075
                                     PIN_ODR_HIGH(GPIOG_PIN1) |             \
1076
                                     PIN_ODR_HIGH(GPIOG_PIN2) |             \
1077
                                     PIN_ODR_HIGH(GPIOG_PIN3) |             \
1078
                                     PIN_ODR_HIGH(GPIOG_PIN4) |             \
1079
                                     PIN_ODR_HIGH(GPIOG_PIN5) |             \
1080
                                     PIN_ODR_HIGH(GPIOG_PIN6) |             \
1081
                                     PIN_ODR_HIGH(GPIOG_PIN7) |             \
1082
                                     PIN_ODR_HIGH(GPIOG_PIN8) |             \
1083
                                     PIN_ODR_HIGH(GPIOG_PIN9) |             \
1084
                                     PIN_ODR_HIGH(GPIOG_PIN10) |            \
1085
                                     PIN_ODR_HIGH(GPIOG_PIN11) |            \
1086
                                     PIN_ODR_HIGH(GPIOG_PIN12) |            \
1087
                                     PIN_ODR_HIGH(GPIOG_PIN13) |            \
1088
                                     PIN_ODR_HIGH(GPIOG_PIN14) |            \
1089
                                     PIN_ODR_HIGH(GPIOG_PIN15))
1090
#define VAL_GPIOG_AFRL              (PIN_AFIO_AF(GPIOG_PIN0, 0U) |          \
1091
                                     PIN_AFIO_AF(GPIOG_PIN1, 0U) |          \
1092
                                     PIN_AFIO_AF(GPIOG_PIN2, 0U) |          \
1093
                                     PIN_AFIO_AF(GPIOG_PIN3, 0U) |          \
1094
                                     PIN_AFIO_AF(GPIOG_PIN4, 0U) |          \
1095
                                     PIN_AFIO_AF(GPIOG_PIN5, 0U) |          \
1096
                                     PIN_AFIO_AF(GPIOG_PIN6, 0U) |          \
1097
                                     PIN_AFIO_AF(GPIOG_PIN7, 0U))
1098
#define VAL_GPIOG_AFRH              (PIN_AFIO_AF(GPIOG_PIN8, 0U) |          \
1099
                                     PIN_AFIO_AF(GPIOG_PIN9, 0U) |          \
1100
                                     PIN_AFIO_AF(GPIOG_PIN10, 0U) |         \
1101
                                     PIN_AFIO_AF(GPIOG_PIN11, 0U) |         \
1102
                                     PIN_AFIO_AF(GPIOG_PIN12, 0U) |         \
1103
                                     PIN_AFIO_AF(GPIOG_PIN13, 0U) |         \
1104
                                     PIN_AFIO_AF(GPIOG_PIN14, 0U) |         \
1105
                                     PIN_AFIO_AF(GPIOG_PIN15, 0U))
1106

    
1107
/*
1108
 * GPIOH setup:
1109
 *
1110
 * PH0  - OSC_IN                    (input floating).
1111
 * PH1  - OSC_OUT                   (input floating).
1112
 * PH2  - PIN2                      (input floating).
1113
 * PH3  - PIN3                      (input floating).
1114
 * PH4  - PIN4                      (input floating).
1115
 * PH5  - PIN5                      (input floating).
1116
 * PH6  - PIN6                      (input floating).
1117
 * PH7  - PIN7                      (input floating).
1118
 * PH8  - PIN8                      (input floating).
1119
 * PH9  - PIN9                      (input floating).
1120
 * PH10 - PIN10                     (input floating).
1121
 * PH11 - PIN11                     (input floating).
1122
 * PH12 - PIN12                     (input floating).
1123
 * PH13 - PIN13                     (input floating).
1124
 * PH14 - PIN14                     (input floating).
1125
 * PH15 - PIN15                     (input floating).
1126
 */
1127
#define VAL_GPIOH_MODER             (PIN_MODE_INPUT(GPIOH_OSC_IN) |         \
1128
                                     PIN_MODE_INPUT(GPIOH_OSC_OUT) |        \
1129
                                     PIN_MODE_INPUT(GPIOH_PIN2) |           \
1130
                                     PIN_MODE_INPUT(GPIOH_PIN3) |           \
1131
                                     PIN_MODE_INPUT(GPIOH_PIN4) |           \
1132
                                     PIN_MODE_INPUT(GPIOH_PIN5) |           \
1133
                                     PIN_MODE_INPUT(GPIOH_PIN6) |           \
1134
                                     PIN_MODE_INPUT(GPIOH_PIN7) |           \
1135
                                     PIN_MODE_INPUT(GPIOH_PIN8) |           \
1136
                                     PIN_MODE_INPUT(GPIOH_PIN9) |           \
1137
                                     PIN_MODE_INPUT(GPIOH_PIN10) |          \
1138
                                     PIN_MODE_INPUT(GPIOH_PIN11) |          \
1139
                                     PIN_MODE_INPUT(GPIOH_PIN12) |          \
1140
                                     PIN_MODE_INPUT(GPIOH_PIN13) |          \
1141
                                     PIN_MODE_INPUT(GPIOH_PIN14) |          \
1142
                                     PIN_MODE_INPUT(GPIOH_PIN15))
1143
#define VAL_GPIOH_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) |     \
1144
                                     PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) |    \
1145
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN2) |       \
1146
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN3) |       \
1147
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN4) |       \
1148
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN5) |       \
1149
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN6) |       \
1150
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN7) |       \
1151
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN8) |       \
1152
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN9) |       \
1153
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN10) |      \
1154
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN11) |      \
1155
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN12) |      \
1156
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN13) |      \
1157
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN14) |      \
1158
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1159
#define VAL_GPIOH_OSPEEDR           (PIN_OSPEED_HIGH(GPIOH_OSC_IN) |        \
1160
                                     PIN_OSPEED_HIGH(GPIOH_OSC_OUT) |       \
1161
                                     PIN_OSPEED_HIGH(GPIOH_PIN2) |          \
1162
                                     PIN_OSPEED_HIGH(GPIOH_PIN3) |          \
1163
                                     PIN_OSPEED_HIGH(GPIOH_PIN4) |          \
1164
                                     PIN_OSPEED_HIGH(GPIOH_PIN5) |          \
1165
                                     PIN_OSPEED_HIGH(GPIOH_PIN6) |          \
1166
                                     PIN_OSPEED_HIGH(GPIOH_PIN7) |          \
1167
                                     PIN_OSPEED_HIGH(GPIOH_PIN8) |          \
1168
                                     PIN_OSPEED_HIGH(GPIOH_PIN9) |          \
1169
                                     PIN_OSPEED_HIGH(GPIOH_PIN10) |         \
1170
                                     PIN_OSPEED_HIGH(GPIOH_PIN11) |         \
1171
                                     PIN_OSPEED_HIGH(GPIOH_PIN12) |         \
1172
                                     PIN_OSPEED_HIGH(GPIOH_PIN13) |         \
1173
                                     PIN_OSPEED_HIGH(GPIOH_PIN14) |         \
1174
                                     PIN_OSPEED_HIGH(GPIOH_PIN15))
1175
#define VAL_GPIOH_PUPDR             (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) |     \
1176
                                     PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) |    \
1177
                                     PIN_PUPDR_FLOATING(GPIOH_PIN2) |       \
1178
                                     PIN_PUPDR_FLOATING(GPIOH_PIN3) |       \
1179
                                     PIN_PUPDR_FLOATING(GPIOH_PIN4) |       \
1180
                                     PIN_PUPDR_FLOATING(GPIOH_PIN5) |       \
1181
                                     PIN_PUPDR_FLOATING(GPIOH_PIN6) |       \
1182
                                     PIN_PUPDR_FLOATING(GPIOH_PIN7) |       \
1183
                                     PIN_PUPDR_FLOATING(GPIOH_PIN8) |       \
1184
                                     PIN_PUPDR_FLOATING(GPIOH_PIN9) |       \
1185
                                     PIN_PUPDR_FLOATING(GPIOH_PIN10) |      \
1186
                                     PIN_PUPDR_FLOATING(GPIOH_PIN11) |      \
1187
                                     PIN_PUPDR_FLOATING(GPIOH_PIN12) |      \
1188
                                     PIN_PUPDR_FLOATING(GPIOH_PIN13) |      \
1189
                                     PIN_PUPDR_FLOATING(GPIOH_PIN14) |      \
1190
                                     PIN_PUPDR_FLOATING(GPIOH_PIN15))
1191
#define VAL_GPIOH_ODR               (PIN_ODR_HIGH(GPIOH_OSC_IN) |           \
1192
                                     PIN_ODR_HIGH(GPIOH_OSC_OUT) |          \
1193
                                     PIN_ODR_HIGH(GPIOH_PIN2) |             \
1194
                                     PIN_ODR_HIGH(GPIOH_PIN3) |             \
1195
                                     PIN_ODR_HIGH(GPIOH_PIN4) |             \
1196
                                     PIN_ODR_HIGH(GPIOH_PIN5) |             \
1197
                                     PIN_ODR_HIGH(GPIOH_PIN6) |             \
1198
                                     PIN_ODR_HIGH(GPIOH_PIN7) |             \
1199
                                     PIN_ODR_HIGH(GPIOH_PIN8) |             \
1200
                                     PIN_ODR_HIGH(GPIOH_PIN9) |             \
1201
                                     PIN_ODR_HIGH(GPIOH_PIN10) |            \
1202
                                     PIN_ODR_HIGH(GPIOH_PIN11) |            \
1203
                                     PIN_ODR_HIGH(GPIOH_PIN12) |            \
1204
                                     PIN_ODR_HIGH(GPIOH_PIN13) |            \
1205
                                     PIN_ODR_HIGH(GPIOH_PIN14) |            \
1206
                                     PIN_ODR_HIGH(GPIOH_PIN15))
1207
#define VAL_GPIOH_AFRL              (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) |        \
1208
                                     PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) |       \
1209
                                     PIN_AFIO_AF(GPIOH_PIN2, 0U) |          \
1210
                                     PIN_AFIO_AF(GPIOH_PIN3, 0U) |          \
1211
                                     PIN_AFIO_AF(GPIOH_PIN4, 0U) |          \
1212
                                     PIN_AFIO_AF(GPIOH_PIN5, 0U) |          \
1213
                                     PIN_AFIO_AF(GPIOH_PIN6, 0U) |          \
1214
                                     PIN_AFIO_AF(GPIOH_PIN7, 0U))
1215
#define VAL_GPIOH_AFRH              (PIN_AFIO_AF(GPIOH_PIN8, 0U) |          \
1216
                                     PIN_AFIO_AF(GPIOH_PIN9, 0U) |          \
1217
                                     PIN_AFIO_AF(GPIOH_PIN10, 0U) |         \
1218
                                     PIN_AFIO_AF(GPIOH_PIN11, 0U) |         \
1219
                                     PIN_AFIO_AF(GPIOH_PIN12, 0U) |         \
1220
                                     PIN_AFIO_AF(GPIOH_PIN13, 0U) |         \
1221
                                     PIN_AFIO_AF(GPIOH_PIN14, 0U) |         \
1222
                                     PIN_AFIO_AF(GPIOH_PIN15, 0U))
1223

    
1224
/*
1225
 * GPIOI setup:
1226
 *
1227
 * PI0  - PIN0                      (input floating).
1228
 * PI1  - PIN1                      (input floating).
1229
 * PI2  - PIN2                      (input floating).
1230
 * PI3  - PIN3                      (input floating).
1231
 * PI4  - PIN4                      (input floating).
1232
 * PI5  - PIN5                      (input floating).
1233
 * PI6  - PIN6                      (input floating).
1234
 * PI7  - PIN7                      (input floating).
1235
 * PI8  - PIN8                      (input floating).
1236
 * PI9  - PIN9                      (input floating).
1237
 * PI10 - PIN10                     (input floating).
1238
 * PI11 - PIN11                     (input floating).
1239
 * PI12 - PIN12                     (input floating).
1240
 * PI13 - PIN13                     (input floating).
1241
 * PI14 - PIN14                     (input floating).
1242
 * PI15 - PIN15                     (input floating).
1243
 */
1244
#define VAL_GPIOI_MODER             (PIN_MODE_INPUT(GPIOI_PIN0) |           \
1245
                                     PIN_MODE_INPUT(GPIOI_PIN1) |           \
1246
                                     PIN_MODE_INPUT(GPIOI_PIN2) |           \
1247
                                     PIN_MODE_INPUT(GPIOI_PIN3) |           \
1248
                                     PIN_MODE_INPUT(GPIOI_PIN4) |           \
1249
                                     PIN_MODE_INPUT(GPIOI_PIN5) |           \
1250
                                     PIN_MODE_INPUT(GPIOI_PIN6) |           \
1251
                                     PIN_MODE_INPUT(GPIOI_PIN7) |           \
1252
                                     PIN_MODE_INPUT(GPIOI_PIN8) |           \
1253
                                     PIN_MODE_INPUT(GPIOI_PIN9) |           \
1254
                                     PIN_MODE_INPUT(GPIOI_PIN10) |          \
1255
                                     PIN_MODE_INPUT(GPIOI_PIN11) |          \
1256
                                     PIN_MODE_INPUT(GPIOI_PIN12) |          \
1257
                                     PIN_MODE_INPUT(GPIOI_PIN13) |          \
1258
                                     PIN_MODE_INPUT(GPIOI_PIN14) |          \
1259
                                     PIN_MODE_INPUT(GPIOI_PIN15))
1260
#define VAL_GPIOI_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) |       \
1261
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN1) |       \
1262
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN2) |       \
1263
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN3) |       \
1264
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN4) |       \
1265
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN5) |       \
1266
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN6) |       \
1267
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN7) |       \
1268
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN8) |       \
1269
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN9) |       \
1270
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN10) |      \
1271
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN11) |      \
1272
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN12) |      \
1273
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN13) |      \
1274
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN14) |      \
1275
                                     PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
1276
#define VAL_GPIOI_OSPEEDR           (PIN_OSPEED_HIGH(GPIOI_PIN0) |          \
1277
                                     PIN_OSPEED_HIGH(GPIOI_PIN1) |          \
1278
                                     PIN_OSPEED_HIGH(GPIOI_PIN2) |          \
1279
                                     PIN_OSPEED_HIGH(GPIOI_PIN3) |          \
1280
                                     PIN_OSPEED_HIGH(GPIOI_PIN4) |          \
1281
                                     PIN_OSPEED_HIGH(GPIOI_PIN5) |          \
1282
                                     PIN_OSPEED_HIGH(GPIOI_PIN6) |          \
1283
                                     PIN_OSPEED_HIGH(GPIOI_PIN7) |          \
1284
                                     PIN_OSPEED_HIGH(GPIOI_PIN8) |          \
1285
                                     PIN_OSPEED_HIGH(GPIOI_PIN9) |          \
1286
                                     PIN_OSPEED_HIGH(GPIOI_PIN10) |         \
1287
                                     PIN_OSPEED_HIGH(GPIOI_PIN11) |         \
1288
                                     PIN_OSPEED_HIGH(GPIOI_PIN12) |         \
1289
                                     PIN_OSPEED_HIGH(GPIOI_PIN13) |         \
1290
                                     PIN_OSPEED_HIGH(GPIOI_PIN14) |         \
1291
                                     PIN_OSPEED_HIGH(GPIOI_PIN15))
1292
#define VAL_GPIOI_PUPDR             (PIN_PUPDR_FLOATING(GPIOI_PIN0) |       \
1293
                                     PIN_PUPDR_FLOATING(GPIOI_PIN1) |       \
1294
                                     PIN_PUPDR_FLOATING(GPIOI_PIN2) |       \
1295
                                     PIN_PUPDR_FLOATING(GPIOI_PIN3) |       \
1296
                                     PIN_PUPDR_FLOATING(GPIOI_PIN4) |       \
1297
                                     PIN_PUPDR_FLOATING(GPIOI_PIN5) |       \
1298
                                     PIN_PUPDR_FLOATING(GPIOI_PIN6) |       \
1299
                                     PIN_PUPDR_FLOATING(GPIOI_PIN7) |       \
1300
                                     PIN_PUPDR_FLOATING(GPIOI_PIN8) |       \
1301
                                     PIN_PUPDR_FLOATING(GPIOI_PIN9) |       \
1302
                                     PIN_PUPDR_FLOATING(GPIOI_PIN10) |      \
1303
                                     PIN_PUPDR_FLOATING(GPIOI_PIN11) |      \
1304
                                     PIN_PUPDR_FLOATING(GPIOI_PIN12) |      \
1305
                                     PIN_PUPDR_FLOATING(GPIOI_PIN13) |      \
1306
                                     PIN_PUPDR_FLOATING(GPIOI_PIN14) |      \
1307
                                     PIN_PUPDR_FLOATING(GPIOI_PIN15))
1308
#define VAL_GPIOI_ODR               (PIN_ODR_HIGH(GPIOI_PIN0) |             \
1309
                                     PIN_ODR_HIGH(GPIOI_PIN1) |             \
1310
                                     PIN_ODR_HIGH(GPIOI_PIN2) |             \
1311
                                     PIN_ODR_HIGH(GPIOI_PIN3) |             \
1312
                                     PIN_ODR_HIGH(GPIOI_PIN4) |             \
1313
                                     PIN_ODR_HIGH(GPIOI_PIN5) |             \
1314
                                     PIN_ODR_HIGH(GPIOI_PIN6) |             \
1315
                                     PIN_ODR_HIGH(GPIOI_PIN7) |             \
1316
                                     PIN_ODR_HIGH(GPIOI_PIN8) |             \
1317
                                     PIN_ODR_HIGH(GPIOI_PIN9) |             \
1318
                                     PIN_ODR_HIGH(GPIOI_PIN10) |            \
1319
                                     PIN_ODR_HIGH(GPIOI_PIN11) |            \
1320
                                     PIN_ODR_HIGH(GPIOI_PIN12) |            \
1321
                                     PIN_ODR_HIGH(GPIOI_PIN13) |            \
1322
                                     PIN_ODR_HIGH(GPIOI_PIN14) |            \
1323
                                     PIN_ODR_HIGH(GPIOI_PIN15))
1324
#define VAL_GPIOI_AFRL              (PIN_AFIO_AF(GPIOI_PIN0, 0U) |          \
1325
                                     PIN_AFIO_AF(GPIOI_PIN1, 0U) |          \
1326
                                     PIN_AFIO_AF(GPIOI_PIN2, 0U) |          \
1327
                                     PIN_AFIO_AF(GPIOI_PIN3, 0U) |          \
1328
                                     PIN_AFIO_AF(GPIOI_PIN4, 0U) |          \
1329
                                     PIN_AFIO_AF(GPIOI_PIN5, 0U) |          \
1330
                                     PIN_AFIO_AF(GPIOI_PIN6, 0U) |          \
1331
                                     PIN_AFIO_AF(GPIOI_PIN7, 0U))
1332
#define VAL_GPIOI_AFRH              (PIN_AFIO_AF(GPIOI_PIN8, 0U) |          \
1333
                                     PIN_AFIO_AF(GPIOI_PIN9, 0U) |          \
1334
                                     PIN_AFIO_AF(GPIOI_PIN10, 0U) |         \
1335
                                     PIN_AFIO_AF(GPIOI_PIN11, 0U) |         \
1336
                                     PIN_AFIO_AF(GPIOI_PIN12, 0U) |         \
1337
                                     PIN_AFIO_AF(GPIOI_PIN13, 0U) |         \
1338
                                     PIN_AFIO_AF(GPIOI_PIN14, 0U) |         \
1339
                                     PIN_AFIO_AF(GPIOI_PIN15, 0U))
1340

    
1341
/*===========================================================================*/
1342
/* External declarations.                                                    */
1343
/*===========================================================================*/
1344

    
1345
#if !defined(_FROM_ASM_)
1346
#ifdef __cplusplus
1347
extern "C" {
1348
#endif
1349
  void boardInit(void);
1350
#ifdef __cplusplus
1351
}
1352
#endif
1353
#endif /* _FROM_ASM_ */
1354

    
1355
#endif /* BOARD_H */