Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / NUCLEO-L476RG / board.h @ 4532b1ab

History | View | Annotate | Download (96.954 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 STM32 Nucleo64-L476RG board.
28
 */
29

    
30
/*
31
 * Board identifier.
32
 */
33
#define BOARD_ST_NUCLEO64_L476RG
34
#define BOARD_NAME                  "STMicroelectronics STM32 Nucleo64-L476RG"
35

    
36
/*
37
 * Board oscillators-related settings.
38
 */
39
#if !defined(STM32_LSECLK)
40
#define STM32_LSECLK                32768U
41
#endif
42

    
43
#define STM32_LSEDRV                (3U << 3U)
44

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

    
49
#define STM32_HSE_BYPASS
50

    
51
/*
52
 * Board voltages.
53
 * Required for performance limits calculation.
54
 */
55
#define STM32_VDD                   300U
56

    
57
/*
58
 * MCU type as defined in the ST header.
59
 */
60
#define STM32L476xx
61

    
62
/*
63
 * IO pins assignments.
64
 */
65
#define GPIOA_ARD_A0                0U
66
#define GPIOA_ADC12_IN5             0U
67
#define GPIOA_ARD_A1                1U
68
#define GPIOA_ADC12_IN6             1U
69
#define GPIOA_ARD_D1                2U
70
#define GPIOA_USART2_TX             2U
71
#define GPIOA_ARD_D0                3U
72
#define GPIOA_USART2_RX             3U
73
#define GPIOA_ARD_A2                4U
74
#define GPIOA_ADC12_IN9             4U
75
#define GPIOA_ARD_D13               5U
76
#define GPIOA_LED_GREEN             5U
77
#define GPIOA_ARD_D12               6U
78
#define GPIOA_ARD_D11               7U
79
#define GPIOA_ARD_D7                8U
80
#define GPIOA_ARD_D8                9U
81
#define GPIOA_ARD_D2                10U
82
#define GPIOA_PIN11                 11U
83
#define GPIOA_PIN12                 12U
84
#define GPIOA_SWDIO                 13U
85
#define GPIOA_SWCLK                 14U
86
#define GPIOA_PIN15                 15U
87

    
88
#define GPIOB_ARD_A3                0U
89
#define GPIOB_ADC12_IN15            0U
90
#define GPIOB_PIN1                  1U
91
#define GPIOB_PIN2                  2U
92
#define GPIOB_ARD_D3                3U
93
#define GPIOB_SWO                   3U
94
#define GPIOB_ARD_D5                4U
95
#define GPIOB_ARD_D4                5U
96
#define GPIOB_ARD_D10               6U
97
#define GPIOB_PIN7                  7U
98
#define GPIOB_ARD_D15               8U
99
#define GPIOB_ARD_D14               9U
100
#define GPIOB_ARD_D6                10U
101
#define GPIOB_PIN11                 11U
102
#define GPIOB_PIN12                 12U
103
#define GPIOB_PIN13                 13U
104
#define GPIOB_PIN14                 14U
105
#define GPIOB_PIN15                 15U
106

    
107
#define GPIOC_ARD_A5                0U
108
#define GPIOC_ADC123_IN1            0U
109
#define GPIOC_ARD_A4                1U
110
#define GPIOC_ADC123_IN2            1U
111
#define GPIOC_PIN2                  2U
112
#define GPIOC_PIN3                  3U
113
#define GPIOC_PIN4                  4U
114
#define GPIOC_PIN5                  5U
115
#define GPIOC_PIN6                  6U
116
#define GPIOC_ARD_D9                7U
117
#define GPIOC_PIN8                  8U
118
#define GPIOC_PIN9                  9U
119
#define GPIOC_PIN10                 10U
120
#define GPIOC_PIN11                 11U
121
#define GPIOC_PIN12                 12U
122
#define GPIOC_BUTTON                13U
123
#define GPIOC_OSC32_IN              14U
124
#define GPIOC_OSC32_OUT             15U
125

    
126
#define GPIOD_PIN0                  0U
127
#define GPIOD_PIN1                  1U
128
#define GPIOD_PIN2                  2U
129
#define GPIOD_PIN3                  3U
130
#define GPIOD_PIN4                  4U
131
#define GPIOD_PIN5                  5U
132
#define GPIOD_PIN6                  6U
133
#define GPIOD_PIN7                  7U
134
#define GPIOD_PIN8                  8U
135
#define GPIOD_PIN9                  9U
136
#define GPIOD_PIN10                 10U
137
#define GPIOD_PIN11                 11U
138
#define GPIOD_PIN12                 12U
139
#define GPIOD_PIN13                 13U
140
#define GPIOD_PIN14                 14U
141
#define GPIOD_PIN15                 15U
142

    
143
#define GPIOE_PIN0                  0U
144
#define GPIOE_PIN1                  1U
145
#define GPIOE_PIN2                  2U
146
#define GPIOE_PIN3                  3U
147
#define GPIOE_PIN4                  4U
148
#define GPIOE_PIN5                  5U
149
#define GPIOE_PIN6                  6U
150
#define GPIOE_PIN7                  7U
151
#define GPIOE_PIN8                  8U
152
#define GPIOE_PIN9                  9U
153
#define GPIOE_PIN10                 10U
154
#define GPIOE_PIN11                 11U
155
#define GPIOE_PIN12                 12U
156
#define GPIOE_PIN13                 13U
157
#define GPIOE_PIN14                 14U
158
#define GPIOE_PIN15                 15U
159

    
160
#define GPIOF_PIN0                  0U
161
#define GPIOF_PIN1                  1U
162
#define GPIOF_PIN2                  2U
163
#define GPIOF_PIN3                  3U
164
#define GPIOF_PIN4                  4U
165
#define GPIOF_PIN5                  5U
166
#define GPIOF_PIN6                  6U
167
#define GPIOF_PIN7                  7U
168
#define GPIOF_PIN8                  8U
169
#define GPIOF_PIN9                  9U
170
#define GPIOF_PIN10                 10U
171
#define GPIOF_PIN11                 11U
172
#define GPIOF_PIN12                 12U
173
#define GPIOF_PIN13                 13U
174
#define GPIOF_PIN14                 14U
175
#define GPIOF_PIN15                 15U
176

    
177
#define GPIOG_PIN0                  0U
178
#define GPIOG_PIN1                  1U
179
#define GPIOG_PIN2                  2U
180
#define GPIOG_PIN3                  3U
181
#define GPIOG_PIN4                  4U
182
#define GPIOG_PIN5                  5U
183
#define GPIOG_PIN6                  6U
184
#define GPIOG_PIN7                  7U
185
#define GPIOG_PIN8                  8U
186
#define GPIOG_PIN9                  9U
187
#define GPIOG_PIN10                 10U
188
#define GPIOG_PIN11                 11U
189
#define GPIOG_PIN12                 12U
190
#define GPIOG_PIN13                 13U
191
#define GPIOG_PIN14                 14U
192
#define GPIOG_PIN15                 15U
193

    
194
#define GPIOH_OSC_IN                0U
195
#define GPIOH_OSC_OUT               1U
196
#define GPIOH_PIN2                  2U
197
#define GPIOH_PIN3                  3U
198
#define GPIOH_PIN4                  4U
199
#define GPIOH_PIN5                  5U
200
#define GPIOH_PIN6                  6U
201
#define GPIOH_PIN7                  7U
202
#define GPIOH_PIN8                  8U
203
#define GPIOH_PIN9                  9U
204
#define GPIOH_PIN10                 10U
205
#define GPIOH_PIN11                 11U
206
#define GPIOH_PIN12                 12U
207
#define GPIOH_PIN13                 13U
208
#define GPIOH_PIN14                 14U
209
#define GPIOH_PIN15                 15U
210

    
211
/*
212
 * IO lines assignments.
213
 */
214
#define LINE_ARD_A0                 PAL_LINE(GPIOA, GPIOA_ARD_A0)
215
#define LINE_ADC12_IN5              PAL_LINE(GPIOA, GPIOA_ADC12_IN5)
216
#define LINE_ARD_A1                 PAL_LINE(GPIOA, GPIOA_ARD_A1)
217
#define LINE_ADC12_IN6              PAL_LINE(GPIOA, GPIOA_ADC12_IN6)
218
#define LINE_ARD_D1                 PAL_LINE(GPIOA, GPIOA_ARD_D1)
219
#define LINE_USART2_TX              PAL_LINE(GPIOA, GPIOA_USART2_TX)
220
#define LINE_ARD_D0                 PAL_LINE(GPIOA, GPIOA_ARD_D0)
221
#define LINE_USART2_RX              PAL_LINE(GPIOA, GPIOA_USART2_RX)
222
#define LINE_ARD_A2                 PAL_LINE(GPIOA, GPIOA_ARD_A2)
223
#define LINE_ADC12_IN9              PAL_LINE(GPIOA, GPIOA_ADC12_IN9)
224
#define LINE_ARD_D13                PAL_LINE(GPIOA, GPIOA_ARD_D13)
225
#define LINE_LED_GREEN              PAL_LINE(GPIOA, GPIOA_LED_GREEN)
226
#define LINE_ARD_D12                PAL_LINE(GPIOA, GPIOA_ARD_D12)
227
#define LINE_ARD_D11                PAL_LINE(GPIOA, GPIOA_ARD_D11)
228
#define LINE_ARD_D7                 PAL_LINE(GPIOA, GPIOA_ARD_D7)
229
#define LINE_ARD_D8                 PAL_LINE(GPIOA, GPIOA_ARD_D8)
230
#define LINE_ARD_D2                 PAL_LINE(GPIOA, GPIOA_ARD_D2)
231
#define LINE_SWDIO                  PAL_LINE(GPIOA, GPIOA_SWDIO)
232
#define LINE_SWCLK                  PAL_LINE(GPIOA, GPIOA_SWCLK)
233

    
234
#define LINE_ARD_A3                 PAL_LINE(GPIOB, GPIOB_ARD_A3)
235
#define LINE_ADC12_IN15             PAL_LINE(GPIOB, GPIOB_ADC12_IN15)
236
#define LINE_ARD_D3                 PAL_LINE(GPIOB, GPIOB_ARD_D3)
237
#define LINE_SWO                    PAL_LINE(GPIOB, GPIOB_SWO)
238
#define LINE_ARD_D5                 PAL_LINE(GPIOB, GPIOB_ARD_D5)
239
#define LINE_ARD_D4                 PAL_LINE(GPIOB, GPIOB_ARD_D4)
240
#define LINE_ARD_D10                PAL_LINE(GPIOB, GPIOB_ARD_D10)
241
#define LINE_ARD_D15                PAL_LINE(GPIOB, GPIOB_ARD_D15)
242
#define LINE_ARD_D14                PAL_LINE(GPIOB, GPIOB_ARD_D14)
243
#define LINE_ARD_D6                 PAL_LINE(GPIOB, GPIOB_ARD_D6)
244

    
245
#define LINE_ARD_A5                 PAL_LINE(GPIOC, GPIOC_ARD_A5)
246
#define LINE_ADC123_IN1             PAL_LINE(GPIOC, GPIOC_ADC123_IN1)
247
#define LINE_ARD_A4                 PAL_LINE(GPIOC, GPIOC_ARD_A4)
248
#define LINE_ADC123_IN2             PAL_LINE(GPIOC, GPIOC_ADC123_IN2)
249
#define LINE_ARD_D9                 PAL_LINE(GPIOC, GPIOC_ARD_D9)
250
#define LINE_BUTTON                 PAL_LINE(GPIOC, GPIOC_BUTTON)
251
#define LINE_OSC32_IN               PAL_LINE(GPIOC, GPIOC_OSC32_IN)
252
#define LINE_OSC32_OUT              PAL_LINE(GPIOC, GPIOC_OSC32_OUT)
253
#define LINE_OSC_IN                 PAL_LINE(GPIOH, GPIOH_OSC_IN)
254
#define LINE_OSC_OUT                PAL_LINE(GPIOH, GPIOH_OSC_OUT)
255

    
256
/*===========================================================================*/
257
/* Driver pre-compile time settings.                                         */
258
/*===========================================================================*/
259

    
260
/*===========================================================================*/
261
/* Derived constants and error checks.                                       */
262
/*===========================================================================*/
263

    
264
/*===========================================================================*/
265
/* Driver data structures and types.                                         */
266
/*===========================================================================*/
267

    
268
/*===========================================================================*/
269
/* Driver macros.                                                            */
270
/*===========================================================================*/
271

    
272
/*
273
 * I/O ports initial setup, this configuration is established soon after reset
274
 * in the initialization code.
275
 * Please refer to the STM32 Reference Manual for details.
276
 */
277
#define PIN_MODE_INPUT(n)           (0U << ((n) * 2U))
278
#define PIN_MODE_OUTPUT(n)          (1U << ((n) * 2U))
279
#define PIN_MODE_ALTERNATE(n)       (2U << ((n) * 2U))
280
#define PIN_MODE_ANALOG(n)          (3U << ((n) * 2U))
281
#define PIN_ODR_LOW(n)              (0U << (n))
282
#define PIN_ODR_HIGH(n)             (1U << (n))
283
#define PIN_OTYPE_PUSHPULL(n)       (0U << (n))
284
#define PIN_OTYPE_OPENDRAIN(n)      (1U << (n))
285
#define PIN_OSPEED_VERYLOW(n)       (0U << ((n) * 2U))
286
#define PIN_OSPEED_LOW(n)           (1U << ((n) * 2U))
287
#define PIN_OSPEED_MEDIUM(n)        (2U << ((n) * 2U))
288
#define PIN_OSPEED_HIGH(n)          (3U << ((n) * 2U))
289
#define PIN_PUPDR_FLOATING(n)       (0U << ((n) * 2U))
290
#define PIN_PUPDR_PULLUP(n)         (1U << ((n) * 2U))
291
#define PIN_PUPDR_PULLDOWN(n)       (2U << ((n) * 2U))
292
#define PIN_AFIO_AF(n, v)           ((v) << (((n) % 8U) * 4U))
293
#define PIN_ASCR_DISABLED(n)        (0U << (n))
294
#define PIN_ASCR_ENABLED(n)         (1U << (n))
295
#define PIN_LOCKR_DISABLED(n)       (0U << (n))
296
#define PIN_LOCKR_ENABLED(n)        (1U << (n))
297

    
298
/*
299
 * GPIOA setup:
300
 *
301
 * PA0  - ARD_A0 ACD12_IN5          (analog).
302
 * PA1  - ARD_A1 ACD12_IN6          (analog).
303
 * PA2  - ARD_D1 USART2_TX          (alternate 7).
304
 * PA3  - ARD_D0 USART2_RX          (alternate 7).
305
 * PA4  - ARD_A2 ACD12_IN9          (analog).
306
 * PA5  - ARD_D13 LED_GREEN         (output pushpull maximum).
307
 * PA6  - ARD_D12                   (analog).
308
 * PA7  - ARD_D11                   (analog).
309
 * PA8  - ARD_D7                    (analog).
310
 * PA9  - ARD_D8                    (analog).
311
 * PA10 - ARD_D2                    (analog).
312
 * PA11 - PIN11                     (analog).
313
 * PA12 - PIN12                     (analog).
314
 * PA13 - SWDIO                     (alternate 0).
315
 * PA14 - SWCLK                     (alternate 0).
316
 * PA15 - PIN15                     (analog).
317
 */
318
#define VAL_GPIOA_MODER             (PIN_MODE_ANALOG(GPIOA_ARD_A0) |        \
319
                                     PIN_MODE_ANALOG(GPIOA_ARD_A1) |        \
320
                                     PIN_MODE_ALTERNATE(GPIOA_ARD_D1) |     \
321
                                     PIN_MODE_ALTERNATE(GPIOA_ARD_D0) |     \
322
                                     PIN_MODE_ANALOG(GPIOA_ARD_A2) |        \
323
                                     PIN_MODE_OUTPUT(GPIOA_ARD_D13) |       \
324
                                     PIN_MODE_ANALOG(GPIOA_ARD_D12) |       \
325
                                     PIN_MODE_ANALOG(GPIOA_ARD_D11) |       \
326
                                     PIN_MODE_ANALOG(GPIOA_ARD_D7) |        \
327
                                     PIN_MODE_ANALOG(GPIOA_ARD_D8) |        \
328
                                     PIN_MODE_ANALOG(GPIOA_ARD_D2) |        \
329
                                     PIN_MODE_ANALOG(GPIOA_PIN11) |         \
330
                                     PIN_MODE_ANALOG(GPIOA_PIN12) |         \
331
                                     PIN_MODE_ALTERNATE(GPIOA_SWDIO) |      \
332
                                     PIN_MODE_ALTERNATE(GPIOA_SWCLK) |      \
333
                                     PIN_MODE_ANALOG(GPIOA_PIN15))
334
#define VAL_GPIOA_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) |     \
335
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) |     \
336
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) |     \
337
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) |     \
338
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) |     \
339
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D13) |    \
340
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) |    \
341
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) |    \
342
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) |     \
343
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) |     \
344
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) |     \
345
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN11) |      \
346
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN12) |      \
347
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) |      \
348
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) |      \
349
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
350
#define VAL_GPIOA_OSPEEDR           (PIN_OSPEED_HIGH(GPIOA_ARD_A0) |        \
351
                                     PIN_OSPEED_HIGH(GPIOA_ARD_A1) |        \
352
                                     PIN_OSPEED_MEDIUM(GPIOA_ARD_D1) |      \
353
                                     PIN_OSPEED_MEDIUM(GPIOA_ARD_D0) |      \
354
                                     PIN_OSPEED_HIGH(GPIOA_ARD_A2) |        \
355
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D13) |       \
356
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D12) |       \
357
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D11) |       \
358
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D7) |        \
359
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D8) |        \
360
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D2) |        \
361
                                     PIN_OSPEED_HIGH(GPIOA_PIN11) |         \
362
                                     PIN_OSPEED_HIGH(GPIOA_PIN12) |         \
363
                                     PIN_OSPEED_HIGH(GPIOA_SWDIO) |         \
364
                                     PIN_OSPEED_HIGH(GPIOA_SWCLK) |         \
365
                                     PIN_OSPEED_HIGH(GPIOA_PIN15))
366
#define VAL_GPIOA_PUPDR             (PIN_PUPDR_FLOATING(GPIOA_ARD_A0) |     \
367
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_A1) |     \
368
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D1) |     \
369
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D0) |     \
370
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_A2) |     \
371
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D13) |    \
372
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D12) |    \
373
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D11) |    \
374
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D7) |     \
375
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D8) |     \
376
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D2) |     \
377
                                     PIN_PUPDR_FLOATING(GPIOA_PIN11) |      \
378
                                     PIN_PUPDR_FLOATING(GPIOA_PIN12) |      \
379
                                     PIN_PUPDR_PULLUP(GPIOA_SWDIO) |        \
380
                                     PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) |      \
381
                                     PIN_PUPDR_FLOATING(GPIOA_PIN15))
382
#define VAL_GPIOA_ODR               (PIN_ODR_HIGH(GPIOA_ARD_A0) |           \
383
                                     PIN_ODR_HIGH(GPIOA_ARD_A1) |           \
384
                                     PIN_ODR_HIGH(GPIOA_ARD_D1) |           \
385
                                     PIN_ODR_HIGH(GPIOA_ARD_D0) |           \
386
                                     PIN_ODR_HIGH(GPIOA_ARD_A2) |           \
387
                                     PIN_ODR_LOW(GPIOA_ARD_D13) |           \
388
                                     PIN_ODR_HIGH(GPIOA_ARD_D12) |          \
389
                                     PIN_ODR_HIGH(GPIOA_ARD_D11) |          \
390
                                     PIN_ODR_HIGH(GPIOA_ARD_D7) |           \
391
                                     PIN_ODR_HIGH(GPIOA_ARD_D8) |           \
392
                                     PIN_ODR_HIGH(GPIOA_ARD_D2) |           \
393
                                     PIN_ODR_HIGH(GPIOA_PIN11) |            \
394
                                     PIN_ODR_HIGH(GPIOA_PIN12) |            \
395
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |            \
396
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |            \
397
                                     PIN_ODR_HIGH(GPIOA_PIN15))
398
#define VAL_GPIOA_AFRL              (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) |        \
399
                                     PIN_AFIO_AF(GPIOA_ARD_A1, 0U) |        \
400
                                     PIN_AFIO_AF(GPIOA_ARD_D1, 7U) |        \
401
                                     PIN_AFIO_AF(GPIOA_ARD_D0, 7U) |        \
402
                                     PIN_AFIO_AF(GPIOA_ARD_A2, 0U) |        \
403
                                     PIN_AFIO_AF(GPIOA_ARD_D13, 0U) |       \
404
                                     PIN_AFIO_AF(GPIOA_ARD_D12, 0U) |       \
405
                                     PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
406
#define VAL_GPIOA_AFRH              (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) |        \
407
                                     PIN_AFIO_AF(GPIOA_ARD_D8, 0U) |        \
408
                                     PIN_AFIO_AF(GPIOA_ARD_D2, 0U) |        \
409
                                     PIN_AFIO_AF(GPIOA_PIN11, 0U) |         \
410
                                     PIN_AFIO_AF(GPIOA_PIN12, 0U) |         \
411
                                     PIN_AFIO_AF(GPIOA_SWDIO, 0U) |         \
412
                                     PIN_AFIO_AF(GPIOA_SWCLK, 0U) |         \
413
                                     PIN_AFIO_AF(GPIOA_PIN15, 0U))
414
#define VAL_GPIOA_ASCR              (PIN_ASCR_DISABLED(GPIOA_ARD_A0) |      \
415
                                     PIN_ASCR_DISABLED(GPIOA_ARD_A1) |      \
416
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D1) |      \
417
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D0) |      \
418
                                     PIN_ASCR_DISABLED(GPIOA_ARD_A2) |      \
419
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D13) |     \
420
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D12) |     \
421
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D11) |     \
422
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D7) |      \
423
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D8) |      \
424
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D2) |      \
425
                                     PIN_ASCR_DISABLED(GPIOA_PIN11) |       \
426
                                     PIN_ASCR_DISABLED(GPIOA_PIN12) |       \
427
                                     PIN_ASCR_DISABLED(GPIOA_SWDIO) |       \
428
                                     PIN_ASCR_DISABLED(GPIOA_SWCLK) |       \
429
                                     PIN_ASCR_DISABLED(GPIOA_PIN15))
430
#define VAL_GPIOA_LOCKR             (PIN_LOCKR_DISABLED(GPIOA_ARD_A0) |     \
431
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_A1) |     \
432
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D1) |     \
433
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D0) |     \
434
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_A2) |     \
435
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D13) |    \
436
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D12) |    \
437
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D11) |    \
438
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D7) |     \
439
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D8) |     \
440
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D2) |     \
441
                                     PIN_LOCKR_DISABLED(GPIOA_PIN11) |      \
442
                                     PIN_LOCKR_DISABLED(GPIOA_PIN12) |      \
443
                                     PIN_LOCKR_DISABLED(GPIOA_SWDIO) |      \
444
                                     PIN_LOCKR_DISABLED(GPIOA_SWCLK) |      \
445
                                     PIN_LOCKR_DISABLED(GPIOA_PIN15))
446

    
447
/*
448
 * GPIOB setup:
449
 *
450
 * PB0  - ARD_A3 ACD12_IN15         (analog).
451
 * PB1  - PIN1                      (analog).
452
 * PB2  - PIN2                      (analog).
453
 * PB3  - ARD_D3 SWO                (analog).
454
 * PB4  - ARD_D5                    (analog).
455
 * PB5  - ARD_D4                    (analog).
456
 * PB6  - ARD_D10                   (analog).
457
 * PB7  - PIN7                      (analog).
458
 * PB8  - ARD_D15                   (analog).
459
 * PB9  - ARD_D14                   (analog).
460
 * PB10 - ARD_D6                    (analog).
461
 * PB11 - PIN11                     (analog).
462
 * PB12 - PIN12                     (analog).
463
 * PB13 - PIN13                     (analog).
464
 * PB14 - PIN14                     (analog).
465
 * PB15 - PIN15                     (analog).
466
 */
467
#define VAL_GPIOB_MODER             (PIN_MODE_ANALOG(GPIOB_ARD_A3) |        \
468
                                     PIN_MODE_ANALOG(GPIOB_PIN1) |          \
469
                                     PIN_MODE_ANALOG(GPIOB_PIN2) |          \
470
                                     PIN_MODE_ANALOG(GPIOB_ARD_D3) |        \
471
                                     PIN_MODE_ANALOG(GPIOB_ARD_D5) |        \
472
                                     PIN_MODE_ANALOG(GPIOB_ARD_D4) |        \
473
                                     PIN_MODE_ANALOG(GPIOB_ARD_D10) |       \
474
                                     PIN_MODE_ANALOG(GPIOB_PIN7) |          \
475
                                     PIN_MODE_ANALOG(GPIOB_ARD_D15) |       \
476
                                     PIN_MODE_ANALOG(GPIOB_ARD_D14) |       \
477
                                     PIN_MODE_ANALOG(GPIOB_ARD_D6) |        \
478
                                     PIN_MODE_ANALOG(GPIOB_PIN11) |         \
479
                                     PIN_MODE_ANALOG(GPIOB_PIN12) |         \
480
                                     PIN_MODE_ANALOG(GPIOB_PIN13) |         \
481
                                     PIN_MODE_ANALOG(GPIOB_PIN14) |         \
482
                                     PIN_MODE_ANALOG(GPIOB_PIN15))
483
#define VAL_GPIOB_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) |     \
484
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN1) |       \
485
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN2) |       \
486
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D3) |     \
487
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) |     \
488
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) |     \
489
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) |    \
490
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN7) |       \
491
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) |    \
492
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) |    \
493
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) |     \
494
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN11) |      \
495
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN12) |      \
496
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN13) |      \
497
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN14) |      \
498
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
499
#define VAL_GPIOB_OSPEEDR           (PIN_OSPEED_HIGH(GPIOB_ARD_A3) |        \
500
                                     PIN_OSPEED_HIGH(GPIOB_PIN1) |          \
501
                                     PIN_OSPEED_HIGH(GPIOB_PIN2) |          \
502
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D3) |        \
503
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D5) |        \
504
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D4) |        \
505
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D10) |       \
506
                                     PIN_OSPEED_HIGH(GPIOB_PIN7) |          \
507
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D15) |       \
508
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D14) |       \
509
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D6) |        \
510
                                     PIN_OSPEED_HIGH(GPIOB_PIN11) |         \
511
                                     PIN_OSPEED_HIGH(GPIOB_PIN12) |         \
512
                                     PIN_OSPEED_HIGH(GPIOB_PIN13) |         \
513
                                     PIN_OSPEED_HIGH(GPIOB_PIN14) |         \
514
                                     PIN_OSPEED_HIGH(GPIOB_PIN15))
515
#define VAL_GPIOB_PUPDR             (PIN_PUPDR_FLOATING(GPIOB_ARD_A3) |     \
516
                                     PIN_PUPDR_FLOATING(GPIOB_PIN1) |       \
517
                                     PIN_PUPDR_FLOATING(GPIOB_PIN2) |       \
518
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D3) |     \
519
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D5) |     \
520
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D4) |     \
521
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D10) |    \
522
                                     PIN_PUPDR_FLOATING(GPIOB_PIN7) |       \
523
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D15) |    \
524
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D14) |    \
525
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D6) |     \
526
                                     PIN_PUPDR_FLOATING(GPIOB_PIN11) |      \
527
                                     PIN_PUPDR_FLOATING(GPIOB_PIN12) |      \
528
                                     PIN_PUPDR_FLOATING(GPIOB_PIN13) |      \
529
                                     PIN_PUPDR_FLOATING(GPIOB_PIN14) |      \
530
                                     PIN_PUPDR_FLOATING(GPIOB_PIN15))
531
#define VAL_GPIOB_ODR               (PIN_ODR_HIGH(GPIOB_ARD_A3) |           \
532
                                     PIN_ODR_HIGH(GPIOB_PIN1) |             \
533
                                     PIN_ODR_HIGH(GPIOB_PIN2) |             \
534
                                     PIN_ODR_HIGH(GPIOB_ARD_D3) |           \
535
                                     PIN_ODR_HIGH(GPIOB_ARD_D5) |           \
536
                                     PIN_ODR_HIGH(GPIOB_ARD_D4) |           \
537
                                     PIN_ODR_HIGH(GPIOB_ARD_D10) |          \
538
                                     PIN_ODR_HIGH(GPIOB_PIN7) |             \
539
                                     PIN_ODR_HIGH(GPIOB_ARD_D15) |          \
540
                                     PIN_ODR_HIGH(GPIOB_ARD_D14) |          \
541
                                     PIN_ODR_HIGH(GPIOB_ARD_D6) |           \
542
                                     PIN_ODR_HIGH(GPIOB_PIN11) |            \
543
                                     PIN_ODR_HIGH(GPIOB_PIN12) |            \
544
                                     PIN_ODR_HIGH(GPIOB_PIN13) |            \
545
                                     PIN_ODR_HIGH(GPIOB_PIN14) |            \
546
                                     PIN_ODR_HIGH(GPIOB_PIN15))
547
#define VAL_GPIOB_AFRL              (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) |        \
548
                                     PIN_AFIO_AF(GPIOB_PIN1, 0U) |          \
549
                                     PIN_AFIO_AF(GPIOB_PIN2, 0U) |          \
550
                                     PIN_AFIO_AF(GPIOB_ARD_D3, 0U) |        \
551
                                     PIN_AFIO_AF(GPIOB_ARD_D5, 0U) |        \
552
                                     PIN_AFIO_AF(GPIOB_ARD_D4, 0U) |        \
553
                                     PIN_AFIO_AF(GPIOB_ARD_D10, 0U) |       \
554
                                     PIN_AFIO_AF(GPIOB_PIN7, 0U))
555
#define VAL_GPIOB_AFRH              (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) |       \
556
                                     PIN_AFIO_AF(GPIOB_ARD_D14, 0U) |       \
557
                                     PIN_AFIO_AF(GPIOB_ARD_D6, 0U) |        \
558
                                     PIN_AFIO_AF(GPIOB_PIN11, 0U) |         \
559
                                     PIN_AFIO_AF(GPIOB_PIN12, 0U) |         \
560
                                     PIN_AFIO_AF(GPIOB_PIN13, 0U) |         \
561
                                     PIN_AFIO_AF(GPIOB_PIN14, 0U) |         \
562
                                     PIN_AFIO_AF(GPIOB_PIN15, 0U))
563
#define VAL_GPIOB_ASCR              (PIN_ASCR_DISABLED(GPIOB_ARD_A3) |      \
564
                                     PIN_ASCR_DISABLED(GPIOB_PIN1) |        \
565
                                     PIN_ASCR_DISABLED(GPIOB_PIN2) |        \
566
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D3) |      \
567
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D5) |      \
568
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D4) |      \
569
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D10) |     \
570
                                     PIN_ASCR_DISABLED(GPIOB_PIN7) |        \
571
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D15) |     \
572
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D14) |     \
573
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D6) |      \
574
                                     PIN_ASCR_DISABLED(GPIOB_PIN11) |       \
575
                                     PIN_ASCR_DISABLED(GPIOB_PIN12) |       \
576
                                     PIN_ASCR_DISABLED(GPIOB_PIN13) |       \
577
                                     PIN_ASCR_DISABLED(GPIOB_PIN14) |       \
578
                                     PIN_ASCR_DISABLED(GPIOB_PIN15))
579
#define VAL_GPIOB_LOCKR             (PIN_LOCKR_DISABLED(GPIOB_ARD_A3) |     \
580
                                     PIN_LOCKR_DISABLED(GPIOB_PIN1) |       \
581
                                     PIN_LOCKR_DISABLED(GPIOB_PIN2) |       \
582
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D3) |     \
583
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D5) |     \
584
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D4) |     \
585
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D10) |    \
586
                                     PIN_LOCKR_DISABLED(GPIOB_PIN7) |       \
587
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D15) |    \
588
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D14) |    \
589
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D6) |     \
590
                                     PIN_LOCKR_DISABLED(GPIOB_PIN11) |      \
591
                                     PIN_LOCKR_DISABLED(GPIOB_PIN12) |      \
592
                                     PIN_LOCKR_DISABLED(GPIOB_PIN13) |      \
593
                                     PIN_LOCKR_DISABLED(GPIOB_PIN14) |      \
594
                                     PIN_LOCKR_DISABLED(GPIOB_PIN15))
595

    
596
/*
597
 * GPIOC setup:
598
 *
599
 * PC0  - ARD_A5 ACD123_IN1         (analog).
600
 * PC1  - ARD_A4 ACD123_IN2         (analog).
601
 * PC2  - PIN2                      (analog).
602
 * PC3  - PIN3                      (analog).
603
 * PC4  - PIN4                      (analog).
604
 * PC5  - PIN5                      (analog).
605
 * PC6  - PIN6                      (analog).
606
 * PC7  - ARD_D9                    (analog).
607
 * PC8  - PIN8                      (analog).
608
 * PC9  - PIN9                      (analog).
609
 * PC10 - PIN10                     (analog).
610
 * PC11 - PIN11                     (analog).
611
 * PC12 - PIN12                     (analog).
612
 * PC13 - BUTTON                    (input floating).
613
 * PC14 - OSC32_IN                  (input floating).
614
 * PC15 - OSC32_OUT                 (input floating).
615
 */
616
#define VAL_GPIOC_MODER             (PIN_MODE_ANALOG(GPIOC_ARD_A5) |        \
617
                                     PIN_MODE_ANALOG(GPIOC_ARD_A4) |        \
618
                                     PIN_MODE_ANALOG(GPIOC_PIN2) |          \
619
                                     PIN_MODE_ANALOG(GPIOC_PIN3) |          \
620
                                     PIN_MODE_ANALOG(GPIOC_PIN4) |          \
621
                                     PIN_MODE_ANALOG(GPIOC_PIN5) |          \
622
                                     PIN_MODE_ANALOG(GPIOC_PIN6) |          \
623
                                     PIN_MODE_ANALOG(GPIOC_ARD_D9) |        \
624
                                     PIN_MODE_ANALOG(GPIOC_PIN8) |          \
625
                                     PIN_MODE_ANALOG(GPIOC_PIN9) |          \
626
                                     PIN_MODE_ANALOG(GPIOC_PIN10) |         \
627
                                     PIN_MODE_ANALOG(GPIOC_PIN11) |         \
628
                                     PIN_MODE_ANALOG(GPIOC_PIN12) |         \
629
                                     PIN_MODE_INPUT(GPIOC_BUTTON) |         \
630
                                     PIN_MODE_INPUT(GPIOC_OSC32_IN) |       \
631
                                     PIN_MODE_INPUT(GPIOC_OSC32_OUT))
632
#define VAL_GPIOC_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) |     \
633
                                     PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) |     \
634
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN2) |       \
635
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN3) |       \
636
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN4) |       \
637
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN5) |       \
638
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN6) |       \
639
                                     PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) |     \
640
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN8) |       \
641
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN9) |       \
642
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN10) |      \
643
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN11) |      \
644
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN12) |      \
645
                                     PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) |     \
646
                                     PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) |   \
647
                                     PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
648
#define VAL_GPIOC_OSPEEDR           (PIN_OSPEED_HIGH(GPIOC_ARD_A5) |        \
649
                                     PIN_OSPEED_HIGH(GPIOC_ARD_A4) |        \
650
                                     PIN_OSPEED_HIGH(GPIOC_PIN2) |          \
651
                                     PIN_OSPEED_HIGH(GPIOC_PIN3) |          \
652
                                     PIN_OSPEED_HIGH(GPIOC_PIN4) |          \
653
                                     PIN_OSPEED_HIGH(GPIOC_PIN5) |          \
654
                                     PIN_OSPEED_HIGH(GPIOC_PIN6) |          \
655
                                     PIN_OSPEED_HIGH(GPIOC_ARD_D9) |        \
656
                                     PIN_OSPEED_HIGH(GPIOC_PIN8) |          \
657
                                     PIN_OSPEED_HIGH(GPIOC_PIN9) |          \
658
                                     PIN_OSPEED_HIGH(GPIOC_PIN10) |         \
659
                                     PIN_OSPEED_HIGH(GPIOC_PIN11) |         \
660
                                     PIN_OSPEED_HIGH(GPIOC_PIN12) |         \
661
                                     PIN_OSPEED_HIGH(GPIOC_BUTTON) |        \
662
                                     PIN_OSPEED_HIGH(GPIOC_OSC32_IN) |      \
663
                                     PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
664
#define VAL_GPIOC_PUPDR             (PIN_PUPDR_FLOATING(GPIOC_ARD_A5) |     \
665
                                     PIN_PUPDR_FLOATING(GPIOC_ARD_A4) |     \
666
                                     PIN_PUPDR_FLOATING(GPIOC_PIN2) |       \
667
                                     PIN_PUPDR_FLOATING(GPIOC_PIN3) |       \
668
                                     PIN_PUPDR_FLOATING(GPIOC_PIN4) |       \
669
                                     PIN_PUPDR_FLOATING(GPIOC_PIN5) |       \
670
                                     PIN_PUPDR_FLOATING(GPIOC_PIN6) |       \
671
                                     PIN_PUPDR_FLOATING(GPIOC_ARD_D9) |     \
672
                                     PIN_PUPDR_FLOATING(GPIOC_PIN8) |       \
673
                                     PIN_PUPDR_FLOATING(GPIOC_PIN9) |       \
674
                                     PIN_PUPDR_FLOATING(GPIOC_PIN10) |      \
675
                                     PIN_PUPDR_FLOATING(GPIOC_PIN11) |      \
676
                                     PIN_PUPDR_FLOATING(GPIOC_PIN12) |      \
677
                                     PIN_PUPDR_FLOATING(GPIOC_BUTTON) |     \
678
                                     PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) |   \
679
                                     PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
680
#define VAL_GPIOC_ODR               (PIN_ODR_HIGH(GPIOC_ARD_A5) |           \
681
                                     PIN_ODR_HIGH(GPIOC_ARD_A4) |           \
682
                                     PIN_ODR_HIGH(GPIOC_PIN2) |             \
683
                                     PIN_ODR_HIGH(GPIOC_PIN3) |             \
684
                                     PIN_ODR_HIGH(GPIOC_PIN4) |             \
685
                                     PIN_ODR_HIGH(GPIOC_PIN5) |             \
686
                                     PIN_ODR_HIGH(GPIOC_PIN6) |             \
687
                                     PIN_ODR_HIGH(GPIOC_ARD_D9) |           \
688
                                     PIN_ODR_HIGH(GPIOC_PIN8) |             \
689
                                     PIN_ODR_HIGH(GPIOC_PIN9) |             \
690
                                     PIN_ODR_HIGH(GPIOC_PIN10) |            \
691
                                     PIN_ODR_HIGH(GPIOC_PIN11) |            \
692
                                     PIN_ODR_HIGH(GPIOC_PIN12) |            \
693
                                     PIN_ODR_HIGH(GPIOC_BUTTON) |           \
694
                                     PIN_ODR_HIGH(GPIOC_OSC32_IN) |         \
695
                                     PIN_ODR_HIGH(GPIOC_OSC32_OUT))
696
#define VAL_GPIOC_AFRL              (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) |        \
697
                                     PIN_AFIO_AF(GPIOC_ARD_A4, 0U) |        \
698
                                     PIN_AFIO_AF(GPIOC_PIN2, 0U) |          \
699
                                     PIN_AFIO_AF(GPIOC_PIN3, 0U) |          \
700
                                     PIN_AFIO_AF(GPIOC_PIN4, 0U) |          \
701
                                     PIN_AFIO_AF(GPIOC_PIN5, 0U) |          \
702
                                     PIN_AFIO_AF(GPIOC_PIN6, 0U) |          \
703
                                     PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
704
#define VAL_GPIOC_AFRH              (PIN_AFIO_AF(GPIOC_PIN8, 0U) |          \
705
                                     PIN_AFIO_AF(GPIOC_PIN9, 0U) |          \
706
                                     PIN_AFIO_AF(GPIOC_PIN10, 0U) |         \
707
                                     PIN_AFIO_AF(GPIOC_PIN11, 0U) |         \
708
                                     PIN_AFIO_AF(GPIOC_PIN12, 0U) |         \
709
                                     PIN_AFIO_AF(GPIOC_BUTTON, 0U) |        \
710
                                     PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) |      \
711
                                     PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
712
#define VAL_GPIOC_ASCR              (PIN_ASCR_DISABLED(GPIOC_ARD_A5) |      \
713
                                     PIN_ASCR_DISABLED(GPIOC_ARD_A4) |      \
714
                                     PIN_ASCR_DISABLED(GPIOC_PIN2) |        \
715
                                     PIN_ASCR_DISABLED(GPIOC_PIN3) |        \
716
                                     PIN_ASCR_DISABLED(GPIOC_PIN4) |        \
717
                                     PIN_ASCR_DISABLED(GPIOC_PIN5) |        \
718
                                     PIN_ASCR_DISABLED(GPIOC_PIN6) |        \
719
                                     PIN_ASCR_DISABLED(GPIOC_ARD_D9) |      \
720
                                     PIN_ASCR_DISABLED(GPIOC_PIN8) |        \
721
                                     PIN_ASCR_DISABLED(GPIOC_PIN9) |        \
722
                                     PIN_ASCR_DISABLED(GPIOC_PIN10) |       \
723
                                     PIN_ASCR_DISABLED(GPIOC_PIN11) |       \
724
                                     PIN_ASCR_DISABLED(GPIOC_PIN12) |       \
725
                                     PIN_ASCR_DISABLED(GPIOC_BUTTON) |      \
726
                                     PIN_ASCR_DISABLED(GPIOC_OSC32_IN) |    \
727
                                     PIN_ASCR_DISABLED(GPIOC_OSC32_OUT))
728
#define VAL_GPIOC_LOCKR             (PIN_LOCKR_DISABLED(GPIOC_ARD_A5) |     \
729
                                     PIN_LOCKR_DISABLED(GPIOC_ARD_A4) |     \
730
                                     PIN_LOCKR_DISABLED(GPIOC_PIN2) |       \
731
                                     PIN_LOCKR_DISABLED(GPIOC_PIN3) |       \
732
                                     PIN_LOCKR_DISABLED(GPIOC_PIN4) |       \
733
                                     PIN_LOCKR_DISABLED(GPIOC_PIN5) |       \
734
                                     PIN_LOCKR_DISABLED(GPIOC_PIN6) |       \
735
                                     PIN_LOCKR_DISABLED(GPIOC_ARD_D9) |     \
736
                                     PIN_LOCKR_DISABLED(GPIOC_PIN8) |       \
737
                                     PIN_LOCKR_DISABLED(GPIOC_PIN9) |       \
738
                                     PIN_LOCKR_DISABLED(GPIOC_PIN10) |      \
739
                                     PIN_LOCKR_DISABLED(GPIOC_PIN11) |      \
740
                                     PIN_LOCKR_DISABLED(GPIOC_PIN12) |      \
741
                                     PIN_LOCKR_DISABLED(GPIOC_BUTTON) |     \
742
                                     PIN_LOCKR_DISABLED(GPIOC_OSC32_IN) |   \
743
                                     PIN_LOCKR_DISABLED(GPIOC_OSC32_OUT))
744

    
745
/*
746
 * GPIOD setup:
747
 *
748
 * PD0  - PIN0                      (analog).
749
 * PD1  - PIN1                      (analog).
750
 * PD2  - PIN2                      (analog).
751
 * PD3  - PIN3                      (analog).
752
 * PD4  - PIN4                      (analog).
753
 * PD5  - PIN5                      (analog).
754
 * PD6  - PIN6                      (analog).
755
 * PD7  - PIN7                      (analog).
756
 * PD8  - PIN8                      (analog).
757
 * PD9  - PIN9                      (analog).
758
 * PD10 - PIN10                     (analog).
759
 * PD11 - PIN11                     (analog).
760
 * PD12 - PIN12                     (analog).
761
 * PD13 - PIN13                     (analog).
762
 * PD14 - PIN14                     (analog).
763
 * PD15 - PIN15                     (analog).
764
 */
765
#define VAL_GPIOD_MODER             (PIN_MODE_ANALOG(GPIOD_PIN0) |          \
766
                                     PIN_MODE_ANALOG(GPIOD_PIN1) |          \
767
                                     PIN_MODE_ANALOG(GPIOD_PIN2) |          \
768
                                     PIN_MODE_ANALOG(GPIOD_PIN3) |          \
769
                                     PIN_MODE_ANALOG(GPIOD_PIN4) |          \
770
                                     PIN_MODE_ANALOG(GPIOD_PIN5) |          \
771
                                     PIN_MODE_ANALOG(GPIOD_PIN6) |          \
772
                                     PIN_MODE_ANALOG(GPIOD_PIN7) |          \
773
                                     PIN_MODE_ANALOG(GPIOD_PIN8) |          \
774
                                     PIN_MODE_ANALOG(GPIOD_PIN9) |          \
775
                                     PIN_MODE_ANALOG(GPIOD_PIN10) |         \
776
                                     PIN_MODE_ANALOG(GPIOD_PIN11) |         \
777
                                     PIN_MODE_ANALOG(GPIOD_PIN12) |         \
778
                                     PIN_MODE_ANALOG(GPIOD_PIN13) |         \
779
                                     PIN_MODE_ANALOG(GPIOD_PIN14) |         \
780
                                     PIN_MODE_ANALOG(GPIOD_PIN15))
781
#define VAL_GPIOD_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) |       \
782
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN1) |       \
783
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN2) |       \
784
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN3) |       \
785
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN4) |       \
786
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN5) |       \
787
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN6) |       \
788
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN7) |       \
789
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN8) |       \
790
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN9) |       \
791
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN10) |      \
792
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN11) |      \
793
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN12) |      \
794
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN13) |      \
795
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN14) |      \
796
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
797
#define VAL_GPIOD_OSPEEDR           (PIN_OSPEED_HIGH(GPIOD_PIN0) |          \
798
                                     PIN_OSPEED_HIGH(GPIOD_PIN1) |          \
799
                                     PIN_OSPEED_HIGH(GPIOD_PIN2) |          \
800
                                     PIN_OSPEED_HIGH(GPIOD_PIN3) |          \
801
                                     PIN_OSPEED_HIGH(GPIOD_PIN4) |          \
802
                                     PIN_OSPEED_HIGH(GPIOD_PIN5) |          \
803
                                     PIN_OSPEED_HIGH(GPIOD_PIN6) |          \
804
                                     PIN_OSPEED_HIGH(GPIOD_PIN7) |          \
805
                                     PIN_OSPEED_HIGH(GPIOD_PIN8) |          \
806
                                     PIN_OSPEED_HIGH(GPIOD_PIN9) |          \
807
                                     PIN_OSPEED_HIGH(GPIOD_PIN10) |         \
808
                                     PIN_OSPEED_HIGH(GPIOD_PIN11) |         \
809
                                     PIN_OSPEED_HIGH(GPIOD_PIN12) |         \
810
                                     PIN_OSPEED_HIGH(GPIOD_PIN13) |         \
811
                                     PIN_OSPEED_HIGH(GPIOD_PIN14) |         \
812
                                     PIN_OSPEED_HIGH(GPIOD_PIN15))
813
#define VAL_GPIOD_PUPDR             (PIN_PUPDR_FLOATING(GPIOD_PIN0) |       \
814
                                     PIN_PUPDR_FLOATING(GPIOD_PIN1) |       \
815
                                     PIN_PUPDR_FLOATING(GPIOD_PIN2) |       \
816
                                     PIN_PUPDR_FLOATING(GPIOD_PIN3) |       \
817
                                     PIN_PUPDR_FLOATING(GPIOD_PIN4) |       \
818
                                     PIN_PUPDR_FLOATING(GPIOD_PIN5) |       \
819
                                     PIN_PUPDR_FLOATING(GPIOD_PIN6) |       \
820
                                     PIN_PUPDR_FLOATING(GPIOD_PIN7) |       \
821
                                     PIN_PUPDR_FLOATING(GPIOD_PIN8) |       \
822
                                     PIN_PUPDR_FLOATING(GPIOD_PIN9) |       \
823
                                     PIN_PUPDR_FLOATING(GPIOD_PIN10) |      \
824
                                     PIN_PUPDR_FLOATING(GPIOD_PIN11) |      \
825
                                     PIN_PUPDR_FLOATING(GPIOD_PIN12) |      \
826
                                     PIN_PUPDR_FLOATING(GPIOD_PIN13) |      \
827
                                     PIN_PUPDR_FLOATING(GPIOD_PIN14) |      \
828
                                     PIN_PUPDR_FLOATING(GPIOD_PIN15))
829
#define VAL_GPIOD_ODR               (PIN_ODR_HIGH(GPIOD_PIN0) |             \
830
                                     PIN_ODR_HIGH(GPIOD_PIN1) |             \
831
                                     PIN_ODR_HIGH(GPIOD_PIN2) |             \
832
                                     PIN_ODR_HIGH(GPIOD_PIN3) |             \
833
                                     PIN_ODR_HIGH(GPIOD_PIN4) |             \
834
                                     PIN_ODR_HIGH(GPIOD_PIN5) |             \
835
                                     PIN_ODR_HIGH(GPIOD_PIN6) |             \
836
                                     PIN_ODR_HIGH(GPIOD_PIN7) |             \
837
                                     PIN_ODR_HIGH(GPIOD_PIN8) |             \
838
                                     PIN_ODR_HIGH(GPIOD_PIN9) |             \
839
                                     PIN_ODR_HIGH(GPIOD_PIN10) |            \
840
                                     PIN_ODR_HIGH(GPIOD_PIN11) |            \
841
                                     PIN_ODR_HIGH(GPIOD_PIN12) |            \
842
                                     PIN_ODR_HIGH(GPIOD_PIN13) |            \
843
                                     PIN_ODR_HIGH(GPIOD_PIN14) |            \
844
                                     PIN_ODR_HIGH(GPIOD_PIN15))
845
#define VAL_GPIOD_AFRL              (PIN_AFIO_AF(GPIOD_PIN0, 0U) |          \
846
                                     PIN_AFIO_AF(GPIOD_PIN1, 0U) |          \
847
                                     PIN_AFIO_AF(GPIOD_PIN2, 0U) |          \
848
                                     PIN_AFIO_AF(GPIOD_PIN3, 0U) |          \
849
                                     PIN_AFIO_AF(GPIOD_PIN4, 0U) |          \
850
                                     PIN_AFIO_AF(GPIOD_PIN5, 0U) |          \
851
                                     PIN_AFIO_AF(GPIOD_PIN6, 0U) |          \
852
                                     PIN_AFIO_AF(GPIOD_PIN7, 0U))
853
#define VAL_GPIOD_AFRH              (PIN_AFIO_AF(GPIOD_PIN8, 0U) |          \
854
                                     PIN_AFIO_AF(GPIOD_PIN9, 0U) |          \
855
                                     PIN_AFIO_AF(GPIOD_PIN10, 0U) |         \
856
                                     PIN_AFIO_AF(GPIOD_PIN11, 0U) |         \
857
                                     PIN_AFIO_AF(GPIOD_PIN12, 0U) |         \
858
                                     PIN_AFIO_AF(GPIOD_PIN13, 0U) |         \
859
                                     PIN_AFIO_AF(GPIOD_PIN14, 0U) |         \
860
                                     PIN_AFIO_AF(GPIOD_PIN15, 0U))
861
#define VAL_GPIOD_ASCR              (PIN_ASCR_DISABLED(GPIOD_PIN0) |        \
862
                                     PIN_ASCR_DISABLED(GPIOD_PIN1) |        \
863
                                     PIN_ASCR_DISABLED(GPIOD_PIN2) |        \
864
                                     PIN_ASCR_DISABLED(GPIOD_PIN3) |        \
865
                                     PIN_ASCR_DISABLED(GPIOD_PIN4) |        \
866
                                     PIN_ASCR_DISABLED(GPIOD_PIN5) |        \
867
                                     PIN_ASCR_DISABLED(GPIOD_PIN6) |        \
868
                                     PIN_ASCR_DISABLED(GPIOD_PIN7) |        \
869
                                     PIN_ASCR_DISABLED(GPIOD_PIN8) |        \
870
                                     PIN_ASCR_DISABLED(GPIOD_PIN9) |        \
871
                                     PIN_ASCR_DISABLED(GPIOD_PIN10) |       \
872
                                     PIN_ASCR_DISABLED(GPIOD_PIN11) |       \
873
                                     PIN_ASCR_DISABLED(GPIOD_PIN12) |       \
874
                                     PIN_ASCR_DISABLED(GPIOD_PIN13) |       \
875
                                     PIN_ASCR_DISABLED(GPIOD_PIN14) |       \
876
                                     PIN_ASCR_DISABLED(GPIOD_PIN15))
877
#define VAL_GPIOD_LOCKR             (PIN_LOCKR_DISABLED(GPIOD_PIN0) |       \
878
                                     PIN_LOCKR_DISABLED(GPIOD_PIN1) |       \
879
                                     PIN_LOCKR_DISABLED(GPIOD_PIN2) |       \
880
                                     PIN_LOCKR_DISABLED(GPIOD_PIN3) |       \
881
                                     PIN_LOCKR_DISABLED(GPIOD_PIN4) |       \
882
                                     PIN_LOCKR_DISABLED(GPIOD_PIN5) |       \
883
                                     PIN_LOCKR_DISABLED(GPIOD_PIN6) |       \
884
                                     PIN_LOCKR_DISABLED(GPIOD_PIN7) |       \
885
                                     PIN_LOCKR_DISABLED(GPIOD_PIN8) |       \
886
                                     PIN_LOCKR_DISABLED(GPIOD_PIN9) |       \
887
                                     PIN_LOCKR_DISABLED(GPIOD_PIN10) |      \
888
                                     PIN_LOCKR_DISABLED(GPIOD_PIN11) |      \
889
                                     PIN_LOCKR_DISABLED(GPIOD_PIN12) |      \
890
                                     PIN_LOCKR_DISABLED(GPIOD_PIN13) |      \
891
                                     PIN_LOCKR_DISABLED(GPIOD_PIN14) |      \
892
                                     PIN_LOCKR_DISABLED(GPIOD_PIN15))
893

    
894
/*
895
 * GPIOE setup:
896
 *
897
 * PE0  - PIN0                      (analog).
898
 * PE1  - PIN1                      (analog).
899
 * PE2  - PIN2                      (analog).
900
 * PE3  - PIN3                      (analog).
901
 * PE4  - PIN4                      (analog).
902
 * PE5  - PIN5                      (analog).
903
 * PE6  - PIN6                      (analog).
904
 * PE7  - PIN7                      (analog).
905
 * PE8  - PIN8                      (analog).
906
 * PE9  - PIN9                      (analog).
907
 * PE10 - PIN10                     (analog).
908
 * PE11 - PIN11                     (analog).
909
 * PE12 - PIN12                     (analog).
910
 * PE13 - PIN13                     (analog).
911
 * PE14 - PIN14                     (analog).
912
 * PE15 - PIN15                     (analog).
913
 */
914
#define VAL_GPIOE_MODER             (PIN_MODE_ANALOG(GPIOE_PIN0) |          \
915
                                     PIN_MODE_ANALOG(GPIOE_PIN1) |          \
916
                                     PIN_MODE_ANALOG(GPIOE_PIN2) |          \
917
                                     PIN_MODE_ANALOG(GPIOE_PIN3) |          \
918
                                     PIN_MODE_ANALOG(GPIOE_PIN4) |          \
919
                                     PIN_MODE_ANALOG(GPIOE_PIN5) |          \
920
                                     PIN_MODE_ANALOG(GPIOE_PIN6) |          \
921
                                     PIN_MODE_ANALOG(GPIOE_PIN7) |          \
922
                                     PIN_MODE_ANALOG(GPIOE_PIN8) |          \
923
                                     PIN_MODE_ANALOG(GPIOE_PIN9) |          \
924
                                     PIN_MODE_ANALOG(GPIOE_PIN10) |         \
925
                                     PIN_MODE_ANALOG(GPIOE_PIN11) |         \
926
                                     PIN_MODE_ANALOG(GPIOE_PIN12) |         \
927
                                     PIN_MODE_ANALOG(GPIOE_PIN13) |         \
928
                                     PIN_MODE_ANALOG(GPIOE_PIN14) |         \
929
                                     PIN_MODE_ANALOG(GPIOE_PIN15))
930
#define VAL_GPIOE_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) |       \
931
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN1) |       \
932
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |       \
933
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN3) |       \
934
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |       \
935
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |       \
936
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN6) |       \
937
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN7) |       \
938
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN8) |       \
939
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN9) |       \
940
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |      \
941
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN11) |      \
942
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN12) |      \
943
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN13) |      \
944
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |      \
945
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
946
#define VAL_GPIOE_OSPEEDR           (PIN_OSPEED_HIGH(GPIOE_PIN0) |          \
947
                                     PIN_OSPEED_HIGH(GPIOE_PIN1) |          \
948
                                     PIN_OSPEED_HIGH(GPIOE_PIN2) |          \
949
                                     PIN_OSPEED_HIGH(GPIOE_PIN3) |          \
950
                                     PIN_OSPEED_HIGH(GPIOE_PIN4) |          \
951
                                     PIN_OSPEED_HIGH(GPIOE_PIN5) |          \
952
                                     PIN_OSPEED_HIGH(GPIOE_PIN6) |          \
953
                                     PIN_OSPEED_HIGH(GPIOE_PIN7) |          \
954
                                     PIN_OSPEED_HIGH(GPIOE_PIN8) |          \
955
                                     PIN_OSPEED_HIGH(GPIOE_PIN9) |          \
956
                                     PIN_OSPEED_HIGH(GPIOE_PIN10) |         \
957
                                     PIN_OSPEED_HIGH(GPIOE_PIN11) |         \
958
                                     PIN_OSPEED_HIGH(GPIOE_PIN12) |         \
959
                                     PIN_OSPEED_HIGH(GPIOE_PIN13) |         \
960
                                     PIN_OSPEED_HIGH(GPIOE_PIN14) |         \
961
                                     PIN_OSPEED_HIGH(GPIOE_PIN15))
962
#define VAL_GPIOE_PUPDR             (PIN_PUPDR_FLOATING(GPIOE_PIN0) |       \
963
                                     PIN_PUPDR_FLOATING(GPIOE_PIN1) |       \
964
                                     PIN_PUPDR_FLOATING(GPIOE_PIN2) |       \
965
                                     PIN_PUPDR_FLOATING(GPIOE_PIN3) |       \
966
                                     PIN_PUPDR_FLOATING(GPIOE_PIN4) |       \
967
                                     PIN_PUPDR_FLOATING(GPIOE_PIN5) |       \
968
                                     PIN_PUPDR_FLOATING(GPIOE_PIN6) |       \
969
                                     PIN_PUPDR_FLOATING(GPIOE_PIN7) |       \
970
                                     PIN_PUPDR_FLOATING(GPIOE_PIN8) |       \
971
                                     PIN_PUPDR_FLOATING(GPIOE_PIN9) |       \
972
                                     PIN_PUPDR_FLOATING(GPIOE_PIN10) |      \
973
                                     PIN_PUPDR_FLOATING(GPIOE_PIN11) |      \
974
                                     PIN_PUPDR_FLOATING(GPIOE_PIN12) |      \
975
                                     PIN_PUPDR_FLOATING(GPIOE_PIN13) |      \
976
                                     PIN_PUPDR_FLOATING(GPIOE_PIN14) |      \
977
                                     PIN_PUPDR_FLOATING(GPIOE_PIN15))
978
#define VAL_GPIOE_ODR               (PIN_ODR_HIGH(GPIOE_PIN0) |             \
979
                                     PIN_ODR_HIGH(GPIOE_PIN1) |             \
980
                                     PIN_ODR_HIGH(GPIOE_PIN2) |             \
981
                                     PIN_ODR_HIGH(GPIOE_PIN3) |             \
982
                                     PIN_ODR_HIGH(GPIOE_PIN4) |             \
983
                                     PIN_ODR_HIGH(GPIOE_PIN5) |             \
984
                                     PIN_ODR_HIGH(GPIOE_PIN6) |             \
985
                                     PIN_ODR_HIGH(GPIOE_PIN7) |             \
986
                                     PIN_ODR_HIGH(GPIOE_PIN8) |             \
987
                                     PIN_ODR_HIGH(GPIOE_PIN9) |             \
988
                                     PIN_ODR_HIGH(GPIOE_PIN10) |            \
989
                                     PIN_ODR_HIGH(GPIOE_PIN11) |            \
990
                                     PIN_ODR_HIGH(GPIOE_PIN12) |            \
991
                                     PIN_ODR_HIGH(GPIOE_PIN13) |            \
992
                                     PIN_ODR_HIGH(GPIOE_PIN14) |            \
993
                                     PIN_ODR_HIGH(GPIOE_PIN15))
994
#define VAL_GPIOE_AFRL              (PIN_AFIO_AF(GPIOE_PIN0, 0U) |          \
995
                                     PIN_AFIO_AF(GPIOE_PIN1, 0U) |          \
996
                                     PIN_AFIO_AF(GPIOE_PIN2, 0U) |          \
997
                                     PIN_AFIO_AF(GPIOE_PIN3, 0U) |          \
998
                                     PIN_AFIO_AF(GPIOE_PIN4, 0U) |          \
999
                                     PIN_AFIO_AF(GPIOE_PIN5, 0U) |          \
1000
                                     PIN_AFIO_AF(GPIOE_PIN6, 0U) |          \
1001
                                     PIN_AFIO_AF(GPIOE_PIN7, 0U))
1002
#define VAL_GPIOE_AFRH              (PIN_AFIO_AF(GPIOE_PIN8, 0U) |          \
1003
                                     PIN_AFIO_AF(GPIOE_PIN9, 0U) |          \
1004
                                     PIN_AFIO_AF(GPIOE_PIN10, 0U) |         \
1005
                                     PIN_AFIO_AF(GPIOE_PIN11, 0U) |         \
1006
                                     PIN_AFIO_AF(GPIOE_PIN12, 0U) |         \
1007
                                     PIN_AFIO_AF(GPIOE_PIN13, 0U) |         \
1008
                                     PIN_AFIO_AF(GPIOE_PIN14, 0U) |         \
1009
                                     PIN_AFIO_AF(GPIOE_PIN15, 0U))
1010
#define VAL_GPIOE_ASCR              (PIN_ASCR_DISABLED(GPIOE_PIN0) |        \
1011
                                     PIN_ASCR_DISABLED(GPIOE_PIN1) |        \
1012
                                     PIN_ASCR_DISABLED(GPIOE_PIN2) |        \
1013
                                     PIN_ASCR_DISABLED(GPIOE_PIN3) |        \
1014
                                     PIN_ASCR_DISABLED(GPIOE_PIN4) |        \
1015
                                     PIN_ASCR_DISABLED(GPIOE_PIN5) |        \
1016
                                     PIN_ASCR_DISABLED(GPIOE_PIN6) |        \
1017
                                     PIN_ASCR_DISABLED(GPIOE_PIN7) |        \
1018
                                     PIN_ASCR_DISABLED(GPIOE_PIN8) |        \
1019
                                     PIN_ASCR_DISABLED(GPIOE_PIN9) |        \
1020
                                     PIN_ASCR_DISABLED(GPIOE_PIN10) |       \
1021
                                     PIN_ASCR_DISABLED(GPIOE_PIN11) |       \
1022
                                     PIN_ASCR_DISABLED(GPIOE_PIN12) |       \
1023
                                     PIN_ASCR_DISABLED(GPIOE_PIN13) |       \
1024
                                     PIN_ASCR_DISABLED(GPIOE_PIN14) |       \
1025
                                     PIN_ASCR_DISABLED(GPIOE_PIN15))
1026
#define VAL_GPIOE_LOCKR             (PIN_LOCKR_DISABLED(GPIOE_PIN0) |       \
1027
                                     PIN_LOCKR_DISABLED(GPIOE_PIN1) |       \
1028
                                     PIN_LOCKR_DISABLED(GPIOE_PIN2) |       \
1029
                                     PIN_LOCKR_DISABLED(GPIOE_PIN3) |       \
1030
                                     PIN_LOCKR_DISABLED(GPIOE_PIN4) |       \
1031
                                     PIN_LOCKR_DISABLED(GPIOE_PIN5) |       \
1032
                                     PIN_LOCKR_DISABLED(GPIOE_PIN6) |       \
1033
                                     PIN_LOCKR_DISABLED(GPIOE_PIN7) |       \
1034
                                     PIN_LOCKR_DISABLED(GPIOE_PIN8) |       \
1035
                                     PIN_LOCKR_DISABLED(GPIOE_PIN9) |       \
1036
                                     PIN_LOCKR_DISABLED(GPIOE_PIN10) |      \
1037
                                     PIN_LOCKR_DISABLED(GPIOE_PIN11) |      \
1038
                                     PIN_LOCKR_DISABLED(GPIOE_PIN12) |      \
1039
                                     PIN_LOCKR_DISABLED(GPIOE_PIN13) |      \
1040
                                     PIN_LOCKR_DISABLED(GPIOE_PIN14) |      \
1041
                                     PIN_LOCKR_DISABLED(GPIOE_PIN15))
1042

    
1043
/*
1044
 * GPIOF setup:
1045
 *
1046
 * PF0  - PIN0                      (analog).
1047
 * PF1  - PIN1                      (analog).
1048
 * PF2  - PIN2                      (analog).
1049
 * PF3  - PIN3                      (analog).
1050
 * PF4  - PIN4                      (analog).
1051
 * PF5  - PIN5                      (analog).
1052
 * PF6  - PIN6                      (analog).
1053
 * PF7  - PIN7                      (analog).
1054
 * PF8  - PIN8                      (analog).
1055
 * PF9  - PIN9                      (analog).
1056
 * PF10 - PIN10                     (analog).
1057
 * PF11 - PIN11                     (analog).
1058
 * PF12 - PIN12                     (analog).
1059
 * PF13 - PIN13                     (analog).
1060
 * PF14 - PIN14                     (analog).
1061
 * PF15 - PIN15                     (analog).
1062
 */
1063
#define VAL_GPIOF_MODER             (PIN_MODE_ANALOG(GPIOF_PIN0) |          \
1064
                                     PIN_MODE_ANALOG(GPIOF_PIN1) |          \
1065
                                     PIN_MODE_ANALOG(GPIOF_PIN2) |          \
1066
                                     PIN_MODE_ANALOG(GPIOF_PIN3) |          \
1067
                                     PIN_MODE_ANALOG(GPIOF_PIN4) |          \
1068
                                     PIN_MODE_ANALOG(GPIOF_PIN5) |          \
1069
                                     PIN_MODE_ANALOG(GPIOF_PIN6) |          \
1070
                                     PIN_MODE_ANALOG(GPIOF_PIN7) |          \
1071
                                     PIN_MODE_ANALOG(GPIOF_PIN8) |          \
1072
                                     PIN_MODE_ANALOG(GPIOF_PIN9) |          \
1073
                                     PIN_MODE_ANALOG(GPIOF_PIN10) |         \
1074
                                     PIN_MODE_ANALOG(GPIOF_PIN11) |         \
1075
                                     PIN_MODE_ANALOG(GPIOF_PIN12) |         \
1076
                                     PIN_MODE_ANALOG(GPIOF_PIN13) |         \
1077
                                     PIN_MODE_ANALOG(GPIOF_PIN14) |         \
1078
                                     PIN_MODE_ANALOG(GPIOF_PIN15))
1079
#define VAL_GPIOF_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) |       \
1080
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN1) |       \
1081
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN2) |       \
1082
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN3) |       \
1083
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN4) |       \
1084
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN5) |       \
1085
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN6) |       \
1086
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN7) |       \
1087
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN8) |       \
1088
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN9) |       \
1089
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN10) |      \
1090
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN11) |      \
1091
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN12) |      \
1092
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN13) |      \
1093
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN14) |      \
1094
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
1095
#define VAL_GPIOF_OSPEEDR           (PIN_OSPEED_HIGH(GPIOF_PIN0) |          \
1096
                                     PIN_OSPEED_HIGH(GPIOF_PIN1) |          \
1097
                                     PIN_OSPEED_HIGH(GPIOF_PIN2) |          \
1098
                                     PIN_OSPEED_HIGH(GPIOF_PIN3) |          \
1099
                                     PIN_OSPEED_HIGH(GPIOF_PIN4) |          \
1100
                                     PIN_OSPEED_HIGH(GPIOF_PIN5) |          \
1101
                                     PIN_OSPEED_HIGH(GPIOF_PIN6) |          \
1102
                                     PIN_OSPEED_HIGH(GPIOF_PIN7) |          \
1103
                                     PIN_OSPEED_HIGH(GPIOF_PIN8) |          \
1104
                                     PIN_OSPEED_HIGH(GPIOF_PIN9) |          \
1105
                                     PIN_OSPEED_HIGH(GPIOF_PIN10) |         \
1106
                                     PIN_OSPEED_HIGH(GPIOF_PIN11) |         \
1107
                                     PIN_OSPEED_HIGH(GPIOF_PIN12) |         \
1108
                                     PIN_OSPEED_HIGH(GPIOF_PIN13) |         \
1109
                                     PIN_OSPEED_HIGH(GPIOF_PIN14) |         \
1110
                                     PIN_OSPEED_HIGH(GPIOF_PIN15))
1111
#define VAL_GPIOF_PUPDR             (PIN_PUPDR_FLOATING(GPIOF_PIN0) |       \
1112
                                     PIN_PUPDR_FLOATING(GPIOF_PIN1) |       \
1113
                                     PIN_PUPDR_FLOATING(GPIOF_PIN2) |       \
1114
                                     PIN_PUPDR_FLOATING(GPIOF_PIN3) |       \
1115
                                     PIN_PUPDR_FLOATING(GPIOF_PIN4) |       \
1116
                                     PIN_PUPDR_FLOATING(GPIOF_PIN5) |       \
1117
                                     PIN_PUPDR_FLOATING(GPIOF_PIN6) |       \
1118
                                     PIN_PUPDR_FLOATING(GPIOF_PIN7) |       \
1119
                                     PIN_PUPDR_FLOATING(GPIOF_PIN8) |       \
1120
                                     PIN_PUPDR_FLOATING(GPIOF_PIN9) |       \
1121
                                     PIN_PUPDR_FLOATING(GPIOF_PIN10) |      \
1122
                                     PIN_PUPDR_FLOATING(GPIOF_PIN11) |      \
1123
                                     PIN_PUPDR_FLOATING(GPIOF_PIN12) |      \
1124
                                     PIN_PUPDR_FLOATING(GPIOF_PIN13) |      \
1125
                                     PIN_PUPDR_FLOATING(GPIOF_PIN14) |      \
1126
                                     PIN_PUPDR_FLOATING(GPIOF_PIN15))
1127
#define VAL_GPIOF_ODR               (PIN_ODR_HIGH(GPIOF_PIN0) |             \
1128
                                     PIN_ODR_HIGH(GPIOF_PIN1) |             \
1129
                                     PIN_ODR_HIGH(GPIOF_PIN2) |             \
1130
                                     PIN_ODR_HIGH(GPIOF_PIN3) |             \
1131
                                     PIN_ODR_HIGH(GPIOF_PIN4) |             \
1132
                                     PIN_ODR_HIGH(GPIOF_PIN5) |             \
1133
                                     PIN_ODR_HIGH(GPIOF_PIN6) |             \
1134
                                     PIN_ODR_HIGH(GPIOF_PIN7) |             \
1135
                                     PIN_ODR_HIGH(GPIOF_PIN8) |             \
1136
                                     PIN_ODR_HIGH(GPIOF_PIN9) |             \
1137
                                     PIN_ODR_HIGH(GPIOF_PIN10) |            \
1138
                                     PIN_ODR_HIGH(GPIOF_PIN11) |            \
1139
                                     PIN_ODR_HIGH(GPIOF_PIN12) |            \
1140
                                     PIN_ODR_HIGH(GPIOF_PIN13) |            \
1141
                                     PIN_ODR_HIGH(GPIOF_PIN14) |            \
1142
                                     PIN_ODR_HIGH(GPIOF_PIN15))
1143
#define VAL_GPIOF_AFRL              (PIN_AFIO_AF(GPIOF_PIN0, 0U) |          \
1144
                                     PIN_AFIO_AF(GPIOF_PIN1, 0U) |          \
1145
                                     PIN_AFIO_AF(GPIOF_PIN2, 0U) |          \
1146
                                     PIN_AFIO_AF(GPIOF_PIN3, 0U) |          \
1147
                                     PIN_AFIO_AF(GPIOF_PIN4, 0U) |          \
1148
                                     PIN_AFIO_AF(GPIOF_PIN5, 0U) |          \
1149
                                     PIN_AFIO_AF(GPIOF_PIN6, 0U) |          \
1150
                                     PIN_AFIO_AF(GPIOF_PIN7, 0U))
1151
#define VAL_GPIOF_AFRH              (PIN_AFIO_AF(GPIOF_PIN8, 0U) |          \
1152
                                     PIN_AFIO_AF(GPIOF_PIN9, 0U) |          \
1153
                                     PIN_AFIO_AF(GPIOF_PIN10, 0U) |         \
1154
                                     PIN_AFIO_AF(GPIOF_PIN11, 0U) |         \
1155
                                     PIN_AFIO_AF(GPIOF_PIN12, 0U) |         \
1156
                                     PIN_AFIO_AF(GPIOF_PIN13, 0U) |         \
1157
                                     PIN_AFIO_AF(GPIOF_PIN14, 0U) |         \
1158
                                     PIN_AFIO_AF(GPIOF_PIN15, 0U))
1159
#define VAL_GPIOF_ASCR              (PIN_ASCR_DISABLED(GPIOF_PIN0) |        \
1160
                                     PIN_ASCR_DISABLED(GPIOF_PIN1) |        \
1161
                                     PIN_ASCR_DISABLED(GPIOF_PIN2) |        \
1162
                                     PIN_ASCR_DISABLED(GPIOF_PIN3) |        \
1163
                                     PIN_ASCR_DISABLED(GPIOF_PIN4) |        \
1164
                                     PIN_ASCR_DISABLED(GPIOF_PIN5) |        \
1165
                                     PIN_ASCR_DISABLED(GPIOF_PIN6) |        \
1166
                                     PIN_ASCR_DISABLED(GPIOF_PIN7) |        \
1167
                                     PIN_ASCR_DISABLED(GPIOF_PIN8) |        \
1168
                                     PIN_ASCR_DISABLED(GPIOF_PIN9) |        \
1169
                                     PIN_ASCR_DISABLED(GPIOF_PIN10) |       \
1170
                                     PIN_ASCR_DISABLED(GPIOF_PIN11) |       \
1171
                                     PIN_ASCR_DISABLED(GPIOF_PIN12) |       \
1172
                                     PIN_ASCR_DISABLED(GPIOF_PIN13) |       \
1173
                                     PIN_ASCR_DISABLED(GPIOF_PIN14) |       \
1174
                                     PIN_ASCR_DISABLED(GPIOF_PIN15))
1175
#define VAL_GPIOF_LOCKR             (PIN_LOCKR_DISABLED(GPIOF_PIN0) |       \
1176
                                     PIN_LOCKR_DISABLED(GPIOF_PIN1) |       \
1177
                                     PIN_LOCKR_DISABLED(GPIOF_PIN2) |       \
1178
                                     PIN_LOCKR_DISABLED(GPIOF_PIN3) |       \
1179
                                     PIN_LOCKR_DISABLED(GPIOF_PIN4) |       \
1180
                                     PIN_LOCKR_DISABLED(GPIOF_PIN5) |       \
1181
                                     PIN_LOCKR_DISABLED(GPIOF_PIN6) |       \
1182
                                     PIN_LOCKR_DISABLED(GPIOF_PIN7) |       \
1183
                                     PIN_LOCKR_DISABLED(GPIOF_PIN8) |       \
1184
                                     PIN_LOCKR_DISABLED(GPIOF_PIN9) |       \
1185
                                     PIN_LOCKR_DISABLED(GPIOF_PIN10) |      \
1186
                                     PIN_LOCKR_DISABLED(GPIOF_PIN11) |      \
1187
                                     PIN_LOCKR_DISABLED(GPIOF_PIN12) |      \
1188
                                     PIN_LOCKR_DISABLED(GPIOF_PIN13) |      \
1189
                                     PIN_LOCKR_DISABLED(GPIOF_PIN14) |      \
1190
                                     PIN_LOCKR_DISABLED(GPIOF_PIN15))
1191

    
1192
/*
1193
 * GPIOG setup:
1194
 *
1195
 * PG0  - PIN0                      (analog).
1196
 * PG1  - PIN1                      (analog).
1197
 * PG2  - PIN2                      (analog).
1198
 * PG3  - PIN3                      (analog).
1199
 * PG4  - PIN4                      (analog).
1200
 * PG5  - PIN5                      (analog).
1201
 * PG6  - PIN6                      (analog).
1202
 * PG7  - PIN7                      (analog).
1203
 * PG8  - PIN8                      (analog).
1204
 * PG9  - PIN9                      (analog).
1205
 * PG10 - PIN10                     (analog).
1206
 * PG11 - PIN11                     (analog).
1207
 * PG12 - PIN12                     (analog).
1208
 * PG13 - PIN13                     (analog).
1209
 * PG14 - PIN14                     (analog).
1210
 * PG15 - PIN15                     (analog).
1211
 */
1212
#define VAL_GPIOG_MODER             (PIN_MODE_ANALOG(GPIOG_PIN0) |          \
1213
                                     PIN_MODE_ANALOG(GPIOG_PIN1) |          \
1214
                                     PIN_MODE_ANALOG(GPIOG_PIN2) |          \
1215
                                     PIN_MODE_ANALOG(GPIOG_PIN3) |          \
1216
                                     PIN_MODE_ANALOG(GPIOG_PIN4) |          \
1217
                                     PIN_MODE_ANALOG(GPIOG_PIN5) |          \
1218
                                     PIN_MODE_ANALOG(GPIOG_PIN6) |          \
1219
                                     PIN_MODE_ANALOG(GPIOG_PIN7) |          \
1220
                                     PIN_MODE_ANALOG(GPIOG_PIN8) |          \
1221
                                     PIN_MODE_ANALOG(GPIOG_PIN9) |          \
1222
                                     PIN_MODE_ANALOG(GPIOG_PIN10) |         \
1223
                                     PIN_MODE_ANALOG(GPIOG_PIN11) |         \
1224
                                     PIN_MODE_ANALOG(GPIOG_PIN12) |         \
1225
                                     PIN_MODE_ANALOG(GPIOG_PIN13) |         \
1226
                                     PIN_MODE_ANALOG(GPIOG_PIN14) |         \
1227
                                     PIN_MODE_ANALOG(GPIOG_PIN15))
1228
#define VAL_GPIOG_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) |       \
1229
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN1) |       \
1230
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN2) |       \
1231
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN3) |       \
1232
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN4) |       \
1233
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN5) |       \
1234
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN6) |       \
1235
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN7) |       \
1236
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN8) |       \
1237
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN9) |       \
1238
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN10) |      \
1239
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN11) |      \
1240
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN12) |      \
1241
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN13) |      \
1242
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN14) |      \
1243
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1244
#define VAL_GPIOG_OSPEEDR           (PIN_OSPEED_VERYLOW(GPIOG_PIN0) |       \
1245
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN1) |       \
1246
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN2) |       \
1247
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN3) |       \
1248
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN4) |       \
1249
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN5) |       \
1250
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN6) |       \
1251
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN7) |       \
1252
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN8) |       \
1253
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN9) |       \
1254
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN10) |      \
1255
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN11) |      \
1256
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN12) |      \
1257
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN13) |      \
1258
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN14) |      \
1259
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN15))
1260
#define VAL_GPIOG_PUPDR             (PIN_PUPDR_FLOATING(GPIOG_PIN0) |       \
1261
                                     PIN_PUPDR_FLOATING(GPIOG_PIN1) |       \
1262
                                     PIN_PUPDR_FLOATING(GPIOG_PIN2) |       \
1263
                                     PIN_PUPDR_FLOATING(GPIOG_PIN3) |       \
1264
                                     PIN_PUPDR_FLOATING(GPIOG_PIN4) |       \
1265
                                     PIN_PUPDR_FLOATING(GPIOG_PIN5) |       \
1266
                                     PIN_PUPDR_FLOATING(GPIOG_PIN6) |       \
1267
                                     PIN_PUPDR_FLOATING(GPIOG_PIN7) |       \
1268
                                     PIN_PUPDR_FLOATING(GPIOG_PIN8) |       \
1269
                                     PIN_PUPDR_FLOATING(GPIOG_PIN9) |       \
1270
                                     PIN_PUPDR_FLOATING(GPIOG_PIN10) |      \
1271
                                     PIN_PUPDR_FLOATING(GPIOG_PIN11) |      \
1272
                                     PIN_PUPDR_FLOATING(GPIOG_PIN12) |      \
1273
                                     PIN_PUPDR_FLOATING(GPIOG_PIN13) |      \
1274
                                     PIN_PUPDR_FLOATING(GPIOG_PIN14) |      \
1275
                                     PIN_PUPDR_FLOATING(GPIOG_PIN15))
1276
#define VAL_GPIOG_ODR               (PIN_ODR_HIGH(GPIOG_PIN0) |             \
1277
                                     PIN_ODR_HIGH(GPIOG_PIN1) |             \
1278
                                     PIN_ODR_HIGH(GPIOG_PIN2) |             \
1279
                                     PIN_ODR_HIGH(GPIOG_PIN3) |             \
1280
                                     PIN_ODR_HIGH(GPIOG_PIN4) |             \
1281
                                     PIN_ODR_HIGH(GPIOG_PIN5) |             \
1282
                                     PIN_ODR_HIGH(GPIOG_PIN6) |             \
1283
                                     PIN_ODR_HIGH(GPIOG_PIN7) |             \
1284
                                     PIN_ODR_HIGH(GPIOG_PIN8) |             \
1285
                                     PIN_ODR_HIGH(GPIOG_PIN9) |             \
1286
                                     PIN_ODR_HIGH(GPIOG_PIN10) |            \
1287
                                     PIN_ODR_HIGH(GPIOG_PIN11) |            \
1288
                                     PIN_ODR_HIGH(GPIOG_PIN12) |            \
1289
                                     PIN_ODR_HIGH(GPIOG_PIN13) |            \
1290
                                     PIN_ODR_HIGH(GPIOG_PIN14) |            \
1291
                                     PIN_ODR_HIGH(GPIOG_PIN15))
1292
#define VAL_GPIOG_AFRL              (PIN_AFIO_AF(GPIOG_PIN0, 0U) |          \
1293
                                     PIN_AFIO_AF(GPIOG_PIN1, 0U) |          \
1294
                                     PIN_AFIO_AF(GPIOG_PIN2, 0U) |          \
1295
                                     PIN_AFIO_AF(GPIOG_PIN3, 0U) |          \
1296
                                     PIN_AFIO_AF(GPIOG_PIN4, 0U) |          \
1297
                                     PIN_AFIO_AF(GPIOG_PIN5, 0U) |          \
1298
                                     PIN_AFIO_AF(GPIOG_PIN6, 0U) |          \
1299
                                     PIN_AFIO_AF(GPIOG_PIN7, 0U))
1300
#define VAL_GPIOG_AFRH              (PIN_AFIO_AF(GPIOG_PIN8, 0U) |          \
1301
                                     PIN_AFIO_AF(GPIOG_PIN9, 0U) |          \
1302
                                     PIN_AFIO_AF(GPIOG_PIN10, 0U) |         \
1303
                                     PIN_AFIO_AF(GPIOG_PIN11, 0U) |         \
1304
                                     PIN_AFIO_AF(GPIOG_PIN12, 0U) |         \
1305
                                     PIN_AFIO_AF(GPIOG_PIN13, 0U) |         \
1306
                                     PIN_AFIO_AF(GPIOG_PIN14, 0U) |         \
1307
                                     PIN_AFIO_AF(GPIOG_PIN15, 0U))
1308
#define VAL_GPIOG_ASCR              (PIN_ASCR_DISABLED(GPIOG_PIN0) |        \
1309
                                     PIN_ASCR_DISABLED(GPIOG_PIN1) |        \
1310
                                     PIN_ASCR_DISABLED(GPIOG_PIN2) |        \
1311
                                     PIN_ASCR_DISABLED(GPIOG_PIN3) |        \
1312
                                     PIN_ASCR_DISABLED(GPIOG_PIN4) |        \
1313
                                     PIN_ASCR_DISABLED(GPIOG_PIN5) |        \
1314
                                     PIN_ASCR_DISABLED(GPIOG_PIN6) |        \
1315
                                     PIN_ASCR_DISABLED(GPIOG_PIN7) |        \
1316
                                     PIN_ASCR_DISABLED(GPIOG_PIN8) |        \
1317
                                     PIN_ASCR_DISABLED(GPIOG_PIN9) |        \
1318
                                     PIN_ASCR_DISABLED(GPIOG_PIN10) |       \
1319
                                     PIN_ASCR_DISABLED(GPIOG_PIN11) |       \
1320
                                     PIN_ASCR_DISABLED(GPIOG_PIN12) |       \
1321
                                     PIN_ASCR_DISABLED(GPIOG_PIN13) |       \
1322
                                     PIN_ASCR_DISABLED(GPIOG_PIN14) |       \
1323
                                     PIN_ASCR_DISABLED(GPIOG_PIN15))
1324
#define VAL_GPIOG_LOCKR             (PIN_LOCKR_DISABLED(GPIOG_PIN0) |       \
1325
                                     PIN_LOCKR_DISABLED(GPIOG_PIN1) |       \
1326
                                     PIN_LOCKR_DISABLED(GPIOG_PIN2) |       \
1327
                                     PIN_LOCKR_DISABLED(GPIOG_PIN3) |       \
1328
                                     PIN_LOCKR_DISABLED(GPIOG_PIN4) |       \
1329
                                     PIN_LOCKR_DISABLED(GPIOG_PIN5) |       \
1330
                                     PIN_LOCKR_DISABLED(GPIOG_PIN6) |       \
1331
                                     PIN_LOCKR_DISABLED(GPIOG_PIN7) |       \
1332
                                     PIN_LOCKR_DISABLED(GPIOG_PIN8) |       \
1333
                                     PIN_LOCKR_DISABLED(GPIOG_PIN9) |       \
1334
                                     PIN_LOCKR_DISABLED(GPIOG_PIN10) |      \
1335
                                     PIN_LOCKR_DISABLED(GPIOG_PIN11) |      \
1336
                                     PIN_LOCKR_DISABLED(GPIOG_PIN12) |      \
1337
                                     PIN_LOCKR_DISABLED(GPIOG_PIN13) |      \
1338
                                     PIN_LOCKR_DISABLED(GPIOG_PIN14) |      \
1339
                                     PIN_LOCKR_DISABLED(GPIOG_PIN15))
1340

    
1341
/*
1342
 * GPIOH setup:
1343
 *
1344
 * PH0  - OSC_IN                    (input floating).
1345
 * PH1  - OSC_OUT                   (input floating).
1346
 * PH2  - PIN2                      (analog).
1347
 * PH3  - PIN3                      (analog).
1348
 * PH4  - PIN4                      (analog).
1349
 * PH5  - PIN5                      (analog).
1350
 * PH6  - PIN6                      (analog).
1351
 * PH7  - PIN7                      (analog).
1352
 * PH8  - PIN8                      (analog).
1353
 * PH9  - PIN9                      (analog).
1354
 * PH10 - PIN10                     (analog).
1355
 * PH11 - PIN11                     (analog).
1356
 * PH12 - PIN12                     (analog).
1357
 * PH13 - PIN13                     (analog).
1358
 * PH14 - PIN14                     (analog).
1359
 * PH15 - PIN15                     (analog).
1360
 */
1361
#define VAL_GPIOH_MODER             (PIN_MODE_INPUT(GPIOH_OSC_IN) |         \
1362
                                     PIN_MODE_INPUT(GPIOH_OSC_OUT) |        \
1363
                                     PIN_MODE_ANALOG(GPIOH_PIN2) |          \
1364
                                     PIN_MODE_ANALOG(GPIOH_PIN3) |          \
1365
                                     PIN_MODE_ANALOG(GPIOH_PIN4) |          \
1366
                                     PIN_MODE_ANALOG(GPIOH_PIN5) |          \
1367
                                     PIN_MODE_ANALOG(GPIOH_PIN6) |          \
1368
                                     PIN_MODE_ANALOG(GPIOH_PIN7) |          \
1369
                                     PIN_MODE_ANALOG(GPIOH_PIN8) |          \
1370
                                     PIN_MODE_ANALOG(GPIOH_PIN9) |          \
1371
                                     PIN_MODE_ANALOG(GPIOH_PIN10) |         \
1372
                                     PIN_MODE_ANALOG(GPIOH_PIN11) |         \
1373
                                     PIN_MODE_ANALOG(GPIOH_PIN12) |         \
1374
                                     PIN_MODE_ANALOG(GPIOH_PIN13) |         \
1375
                                     PIN_MODE_ANALOG(GPIOH_PIN14) |         \
1376
                                     PIN_MODE_ANALOG(GPIOH_PIN15))
1377
#define VAL_GPIOH_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) |     \
1378
                                     PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) |    \
1379
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN2) |       \
1380
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN3) |       \
1381
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN4) |       \
1382
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN5) |       \
1383
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN6) |       \
1384
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN7) |       \
1385
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN8) |       \
1386
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN9) |       \
1387
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN10) |      \
1388
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN11) |      \
1389
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN12) |      \
1390
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN13) |      \
1391
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN14) |      \
1392
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1393
#define VAL_GPIOH_OSPEEDR           (PIN_OSPEED_HIGH(GPIOH_OSC_IN) |        \
1394
                                     PIN_OSPEED_HIGH(GPIOH_OSC_OUT) |       \
1395
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN2) |       \
1396
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN3) |       \
1397
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN4) |       \
1398
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN5) |       \
1399
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN6) |       \
1400
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN7) |       \
1401
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN8) |       \
1402
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN9) |       \
1403
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN10) |      \
1404
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN11) |      \
1405
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN12) |      \
1406
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN13) |      \
1407
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN14) |      \
1408
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN15))
1409
#define VAL_GPIOH_PUPDR             (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) |     \
1410
                                     PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) |    \
1411
                                     PIN_PUPDR_FLOATING(GPIOH_PIN2) |       \
1412
                                     PIN_PUPDR_FLOATING(GPIOH_PIN3) |       \
1413
                                     PIN_PUPDR_FLOATING(GPIOH_PIN4) |       \
1414
                                     PIN_PUPDR_FLOATING(GPIOH_PIN5) |       \
1415
                                     PIN_PUPDR_FLOATING(GPIOH_PIN6) |       \
1416
                                     PIN_PUPDR_FLOATING(GPIOH_PIN7) |       \
1417
                                     PIN_PUPDR_FLOATING(GPIOH_PIN8) |       \
1418
                                     PIN_PUPDR_FLOATING(GPIOH_PIN9) |       \
1419
                                     PIN_PUPDR_FLOATING(GPIOH_PIN10) |      \
1420
                                     PIN_PUPDR_FLOATING(GPIOH_PIN11) |      \
1421
                                     PIN_PUPDR_FLOATING(GPIOH_PIN12) |      \
1422
                                     PIN_PUPDR_FLOATING(GPIOH_PIN13) |      \
1423
                                     PIN_PUPDR_FLOATING(GPIOH_PIN14) |      \
1424
                                     PIN_PUPDR_FLOATING(GPIOH_PIN15))
1425
#define VAL_GPIOH_ODR               (PIN_ODR_HIGH(GPIOH_OSC_IN) |           \
1426
                                     PIN_ODR_HIGH(GPIOH_OSC_OUT) |          \
1427
                                     PIN_ODR_HIGH(GPIOH_PIN2) |             \
1428
                                     PIN_ODR_HIGH(GPIOH_PIN3) |             \
1429
                                     PIN_ODR_HIGH(GPIOH_PIN4) |             \
1430
                                     PIN_ODR_HIGH(GPIOH_PIN5) |             \
1431
                                     PIN_ODR_HIGH(GPIOH_PIN6) |             \
1432
                                     PIN_ODR_HIGH(GPIOH_PIN7) |             \
1433
                                     PIN_ODR_HIGH(GPIOH_PIN8) |             \
1434
                                     PIN_ODR_HIGH(GPIOH_PIN9) |             \
1435
                                     PIN_ODR_HIGH(GPIOH_PIN10) |            \
1436
                                     PIN_ODR_HIGH(GPIOH_PIN11) |            \
1437
                                     PIN_ODR_HIGH(GPIOH_PIN12) |            \
1438
                                     PIN_ODR_HIGH(GPIOH_PIN13) |            \
1439
                                     PIN_ODR_HIGH(GPIOH_PIN14) |            \
1440
                                     PIN_ODR_HIGH(GPIOH_PIN15))
1441
#define VAL_GPIOH_AFRL              (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) |        \
1442
                                     PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) |       \
1443
                                     PIN_AFIO_AF(GPIOH_PIN2, 0U) |          \
1444
                                     PIN_AFIO_AF(GPIOH_PIN3, 0U) |          \
1445
                                     PIN_AFIO_AF(GPIOH_PIN4, 0U) |          \
1446
                                     PIN_AFIO_AF(GPIOH_PIN5, 0U) |          \
1447
                                     PIN_AFIO_AF(GPIOH_PIN6, 0U) |          \
1448
                                     PIN_AFIO_AF(GPIOH_PIN7, 0U))
1449
#define VAL_GPIOH_AFRH              (PIN_AFIO_AF(GPIOH_PIN8, 0U) |          \
1450
                                     PIN_AFIO_AF(GPIOH_PIN9, 0U) |          \
1451
                                     PIN_AFIO_AF(GPIOH_PIN10, 0U) |         \
1452
                                     PIN_AFIO_AF(GPIOH_PIN11, 0U) |         \
1453
                                     PIN_AFIO_AF(GPIOH_PIN12, 0U) |         \
1454
                                     PIN_AFIO_AF(GPIOH_PIN13, 0U) |         \
1455
                                     PIN_AFIO_AF(GPIOH_PIN14, 0U) |         \
1456
                                     PIN_AFIO_AF(GPIOH_PIN15, 0U))
1457
#define VAL_GPIOH_ASCR              (PIN_ASCR_DISABLED(GPIOH_OSC_IN) |      \
1458
                                     PIN_ASCR_DISABLED(GPIOH_OSC_OUT) |     \
1459
                                     PIN_ASCR_DISABLED(GPIOH_PIN2) |        \
1460
                                     PIN_ASCR_DISABLED(GPIOH_PIN3) |        \
1461
                                     PIN_ASCR_DISABLED(GPIOH_PIN4) |        \
1462
                                     PIN_ASCR_DISABLED(GPIOH_PIN5) |        \
1463
                                     PIN_ASCR_DISABLED(GPIOH_PIN6) |        \
1464
                                     PIN_ASCR_DISABLED(GPIOH_PIN7) |        \
1465
                                     PIN_ASCR_DISABLED(GPIOH_PIN8) |        \
1466
                                     PIN_ASCR_DISABLED(GPIOH_PIN9) |        \
1467
                                     PIN_ASCR_DISABLED(GPIOH_PIN10) |       \
1468
                                     PIN_ASCR_DISABLED(GPIOH_PIN11) |       \
1469
                                     PIN_ASCR_DISABLED(GPIOH_PIN12) |       \
1470
                                     PIN_ASCR_DISABLED(GPIOH_PIN13) |       \
1471
                                     PIN_ASCR_DISABLED(GPIOH_PIN14) |       \
1472
                                     PIN_ASCR_DISABLED(GPIOH_PIN15))
1473
#define VAL_GPIOH_LOCKR             (PIN_LOCKR_DISABLED(GPIOH_OSC_IN) |     \
1474
                                     PIN_LOCKR_DISABLED(GPIOH_OSC_OUT) |    \
1475
                                     PIN_LOCKR_DISABLED(GPIOH_PIN2) |       \
1476
                                     PIN_LOCKR_DISABLED(GPIOH_PIN3) |       \
1477
                                     PIN_LOCKR_DISABLED(GPIOH_PIN4) |       \
1478
                                     PIN_LOCKR_DISABLED(GPIOH_PIN5) |       \
1479
                                     PIN_LOCKR_DISABLED(GPIOH_PIN6) |       \
1480
                                     PIN_LOCKR_DISABLED(GPIOH_PIN7) |       \
1481
                                     PIN_LOCKR_DISABLED(GPIOH_PIN8) |       \
1482
                                     PIN_LOCKR_DISABLED(GPIOH_PIN9) |       \
1483
                                     PIN_LOCKR_DISABLED(GPIOH_PIN10) |      \
1484
                                     PIN_LOCKR_DISABLED(GPIOH_PIN11) |      \
1485
                                     PIN_LOCKR_DISABLED(GPIOH_PIN12) |      \
1486
                                     PIN_LOCKR_DISABLED(GPIOH_PIN13) |      \
1487
                                     PIN_LOCKR_DISABLED(GPIOH_PIN14) |      \
1488
                                     PIN_LOCKR_DISABLED(GPIOH_PIN15))
1489

    
1490
/*===========================================================================*/
1491
/* External declarations.                                                    */
1492
/*===========================================================================*/
1493

    
1494
#if !defined(_FROM_ASM_)
1495
#ifdef __cplusplus
1496
extern "C" {
1497
#endif
1498
  void boardInit(void);
1499
#ifdef __cplusplus
1500
}
1501
#endif
1502
#endif /* _FROM_ASM_ */
1503

    
1504
#endif /* BOARD_H */