Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / NUCLEO-L476RG / board.h @ cacd990c

History | View | Annotate | Download (97.05 KB)

1 27d0378b Simon Welzel
/*
2 0f60c8ad Thomas Schöpping
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3 96621a83 Thomas Schöpping
Copyright (C) 2016..2020  Thomas Schöpping et al.
4 27d0378b Simon Welzel

5 0f60c8ad Thomas Schöpping
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 27d0378b Simon Welzel

10 0f60c8ad Thomas Schöpping
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 27d0378b Simon Welzel

15 0f60c8ad Thomas Schöpping
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 27d0378b Simon Welzel
*/
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 4c72a54c Thomas Schöpping
 * Identifiers for optional peripherals.
64
 */
65
#define BOARD_MPU6050_CONNECTED     false
66
67
68
/*
69 27d0378b Simon Welzel
 * IO pins assignments.
70
 */
71
#define GPIOA_ARD_A0                0U
72 3106e8cc Thomas Schöpping
#define GPIOA_ADC12_IN5             0U
73 27d0378b Simon Welzel
#define GPIOA_ARD_A1                1U
74 3106e8cc Thomas Schöpping
#define GPIOA_ADC12_IN6             1U
75 27d0378b Simon Welzel
#define GPIOA_ARD_D1                2U
76
#define GPIOA_USART2_TX             2U
77
#define GPIOA_ARD_D0                3U
78
#define GPIOA_USART2_RX             3U
79
#define GPIOA_ARD_A2                4U
80 3106e8cc Thomas Schöpping
#define GPIOA_ADC12_IN9             4U
81 27d0378b Simon Welzel
#define GPIOA_ARD_D13               5U
82
#define GPIOA_LED_GREEN             5U
83
#define GPIOA_ARD_D12               6U
84
#define GPIOA_ARD_D11               7U
85
#define GPIOA_ARD_D7                8U
86
#define GPIOA_ARD_D8                9U
87
#define GPIOA_ARD_D2                10U
88
#define GPIOA_PIN11                 11U
89
#define GPIOA_PIN12                 12U
90
#define GPIOA_SWDIO                 13U
91
#define GPIOA_SWCLK                 14U
92
#define GPIOA_PIN15                 15U
93
94
#define GPIOB_ARD_A3                0U
95 3106e8cc Thomas Schöpping
#define GPIOB_ADC12_IN15            0U
96 27d0378b Simon Welzel
#define GPIOB_PIN1                  1U
97
#define GPIOB_PIN2                  2U
98
#define GPIOB_ARD_D3                3U
99
#define GPIOB_SWO                   3U
100
#define GPIOB_ARD_D5                4U
101
#define GPIOB_ARD_D4                5U
102
#define GPIOB_ARD_D10               6U
103
#define GPIOB_PIN7                  7U
104
#define GPIOB_ARD_D15               8U
105
#define GPIOB_ARD_D14               9U
106
#define GPIOB_ARD_D6                10U
107
#define GPIOB_PIN11                 11U
108
#define GPIOB_PIN12                 12U
109
#define GPIOB_PIN13                 13U
110
#define GPIOB_PIN14                 14U
111
#define GPIOB_PIN15                 15U
112
113
#define GPIOC_ARD_A5                0U
114 3106e8cc Thomas Schöpping
#define GPIOC_ADC123_IN1            0U
115 27d0378b Simon Welzel
#define GPIOC_ARD_A4                1U
116 3106e8cc Thomas Schöpping
#define GPIOC_ADC123_IN2            1U
117 27d0378b Simon Welzel
#define GPIOC_PIN2                  2U
118
#define GPIOC_PIN3                  3U
119
#define GPIOC_PIN4                  4U
120
#define GPIOC_PIN5                  5U
121
#define GPIOC_PIN6                  6U
122
#define GPIOC_ARD_D9                7U
123
#define GPIOC_PIN8                  8U
124
#define GPIOC_PIN9                  9U
125
#define GPIOC_PIN10                 10U
126
#define GPIOC_PIN11                 11U
127
#define GPIOC_PIN12                 12U
128
#define GPIOC_BUTTON                13U
129
#define GPIOC_OSC32_IN              14U
130
#define GPIOC_OSC32_OUT             15U
131
132
#define GPIOD_PIN0                  0U
133
#define GPIOD_PIN1                  1U
134
#define GPIOD_PIN2                  2U
135
#define GPIOD_PIN3                  3U
136
#define GPIOD_PIN4                  4U
137
#define GPIOD_PIN5                  5U
138
#define GPIOD_PIN6                  6U
139
#define GPIOD_PIN7                  7U
140
#define GPIOD_PIN8                  8U
141
#define GPIOD_PIN9                  9U
142
#define GPIOD_PIN10                 10U
143
#define GPIOD_PIN11                 11U
144
#define GPIOD_PIN12                 12U
145
#define GPIOD_PIN13                 13U
146
#define GPIOD_PIN14                 14U
147
#define GPIOD_PIN15                 15U
148
149
#define GPIOE_PIN0                  0U
150
#define GPIOE_PIN1                  1U
151
#define GPIOE_PIN2                  2U
152
#define GPIOE_PIN3                  3U
153
#define GPIOE_PIN4                  4U
154
#define GPIOE_PIN5                  5U
155
#define GPIOE_PIN6                  6U
156
#define GPIOE_PIN7                  7U
157
#define GPIOE_PIN8                  8U
158
#define GPIOE_PIN9                  9U
159
#define GPIOE_PIN10                 10U
160
#define GPIOE_PIN11                 11U
161
#define GPIOE_PIN12                 12U
162
#define GPIOE_PIN13                 13U
163
#define GPIOE_PIN14                 14U
164
#define GPIOE_PIN15                 15U
165
166
#define GPIOF_PIN0                  0U
167
#define GPIOF_PIN1                  1U
168
#define GPIOF_PIN2                  2U
169
#define GPIOF_PIN3                  3U
170
#define GPIOF_PIN4                  4U
171
#define GPIOF_PIN5                  5U
172
#define GPIOF_PIN6                  6U
173
#define GPIOF_PIN7                  7U
174
#define GPIOF_PIN8                  8U
175
#define GPIOF_PIN9                  9U
176
#define GPIOF_PIN10                 10U
177
#define GPIOF_PIN11                 11U
178
#define GPIOF_PIN12                 12U
179
#define GPIOF_PIN13                 13U
180
#define GPIOF_PIN14                 14U
181
#define GPIOF_PIN15                 15U
182
183
#define GPIOG_PIN0                  0U
184
#define GPIOG_PIN1                  1U
185
#define GPIOG_PIN2                  2U
186
#define GPIOG_PIN3                  3U
187
#define GPIOG_PIN4                  4U
188
#define GPIOG_PIN5                  5U
189
#define GPIOG_PIN6                  6U
190
#define GPIOG_PIN7                  7U
191
#define GPIOG_PIN8                  8U
192
#define GPIOG_PIN9                  9U
193
#define GPIOG_PIN10                 10U
194
#define GPIOG_PIN11                 11U
195
#define GPIOG_PIN12                 12U
196
#define GPIOG_PIN13                 13U
197
#define GPIOG_PIN14                 14U
198
#define GPIOG_PIN15                 15U
199
200
#define GPIOH_OSC_IN                0U
201
#define GPIOH_OSC_OUT               1U
202
#define GPIOH_PIN2                  2U
203
#define GPIOH_PIN3                  3U
204
#define GPIOH_PIN4                  4U
205
#define GPIOH_PIN5                  5U
206
#define GPIOH_PIN6                  6U
207
#define GPIOH_PIN7                  7U
208
#define GPIOH_PIN8                  8U
209
#define GPIOH_PIN9                  9U
210
#define GPIOH_PIN10                 10U
211
#define GPIOH_PIN11                 11U
212
#define GPIOH_PIN12                 12U
213
#define GPIOH_PIN13                 13U
214
#define GPIOH_PIN14                 14U
215
#define GPIOH_PIN15                 15U
216
217
/*
218
 * IO lines assignments.
219
 */
220 3106e8cc Thomas Schöpping
#define LINE_ARD_A0                 PAL_LINE(GPIOA, GPIOA_ARD_A0)
221
#define LINE_ADC12_IN5              PAL_LINE(GPIOA, GPIOA_ADC12_IN5)
222
#define LINE_ARD_A1                 PAL_LINE(GPIOA, GPIOA_ARD_A1)
223
#define LINE_ADC12_IN6              PAL_LINE(GPIOA, GPIOA_ADC12_IN6)
224
#define LINE_ARD_D1                 PAL_LINE(GPIOA, GPIOA_ARD_D1)
225
#define LINE_USART2_TX              PAL_LINE(GPIOA, GPIOA_USART2_TX)
226
#define LINE_ARD_D0                 PAL_LINE(GPIOA, GPIOA_ARD_D0)
227
#define LINE_USART2_RX              PAL_LINE(GPIOA, GPIOA_USART2_RX)
228
#define LINE_ARD_A2                 PAL_LINE(GPIOA, GPIOA_ARD_A2)
229
#define LINE_ADC12_IN9              PAL_LINE(GPIOA, GPIOA_ADC12_IN9)
230
#define LINE_ARD_D13                PAL_LINE(GPIOA, GPIOA_ARD_D13)
231
#define LINE_LED_GREEN              PAL_LINE(GPIOA, GPIOA_LED_GREEN)
232
#define LINE_ARD_D12                PAL_LINE(GPIOA, GPIOA_ARD_D12)
233
#define LINE_ARD_D11                PAL_LINE(GPIOA, GPIOA_ARD_D11)
234
#define LINE_ARD_D7                 PAL_LINE(GPIOA, GPIOA_ARD_D7)
235
#define LINE_ARD_D8                 PAL_LINE(GPIOA, GPIOA_ARD_D8)
236
#define LINE_ARD_D2                 PAL_LINE(GPIOA, GPIOA_ARD_D2)
237
#define LINE_SWDIO                  PAL_LINE(GPIOA, GPIOA_SWDIO)
238
#define LINE_SWCLK                  PAL_LINE(GPIOA, GPIOA_SWCLK)
239
240
#define LINE_ARD_A3                 PAL_LINE(GPIOB, GPIOB_ARD_A3)
241
#define LINE_ADC12_IN15             PAL_LINE(GPIOB, GPIOB_ADC12_IN15)
242
#define LINE_ARD_D3                 PAL_LINE(GPIOB, GPIOB_ARD_D3)
243
#define LINE_SWO                    PAL_LINE(GPIOB, GPIOB_SWO)
244
#define LINE_ARD_D5                 PAL_LINE(GPIOB, GPIOB_ARD_D5)
245
#define LINE_ARD_D4                 PAL_LINE(GPIOB, GPIOB_ARD_D4)
246
#define LINE_ARD_D10                PAL_LINE(GPIOB, GPIOB_ARD_D10)
247
#define LINE_ARD_D15                PAL_LINE(GPIOB, GPIOB_ARD_D15)
248
#define LINE_ARD_D14                PAL_LINE(GPIOB, GPIOB_ARD_D14)
249
#define LINE_ARD_D6                 PAL_LINE(GPIOB, GPIOB_ARD_D6)
250
251
#define LINE_ARD_A5                 PAL_LINE(GPIOC, GPIOC_ARD_A5)
252
#define LINE_ADC123_IN1             PAL_LINE(GPIOC, GPIOC_ADC123_IN1)
253
#define LINE_ARD_A4                 PAL_LINE(GPIOC, GPIOC_ARD_A4)
254
#define LINE_ADC123_IN2             PAL_LINE(GPIOC, GPIOC_ADC123_IN2)
255
#define LINE_ARD_D9                 PAL_LINE(GPIOC, GPIOC_ARD_D9)
256
#define LINE_BUTTON                 PAL_LINE(GPIOC, GPIOC_BUTTON)
257
#define LINE_OSC32_IN               PAL_LINE(GPIOC, GPIOC_OSC32_IN)
258
#define LINE_OSC32_OUT              PAL_LINE(GPIOC, GPIOC_OSC32_OUT)
259
#define LINE_OSC_IN                 PAL_LINE(GPIOH, GPIOH_OSC_IN)
260
#define LINE_OSC_OUT                PAL_LINE(GPIOH, GPIOH_OSC_OUT)
261 27d0378b Simon Welzel
262
/*===========================================================================*/
263
/* Driver pre-compile time settings.                                         */
264
/*===========================================================================*/
265
266
/*===========================================================================*/
267
/* Derived constants and error checks.                                       */
268
/*===========================================================================*/
269
270
/*===========================================================================*/
271
/* Driver data structures and types.                                         */
272
/*===========================================================================*/
273
274
/*===========================================================================*/
275
/* Driver macros.                                                            */
276
/*===========================================================================*/
277
278
/*
279
 * I/O ports initial setup, this configuration is established soon after reset
280
 * in the initialization code.
281
 * Please refer to the STM32 Reference Manual for details.
282
 */
283
#define PIN_MODE_INPUT(n)           (0U << ((n) * 2U))
284
#define PIN_MODE_OUTPUT(n)          (1U << ((n) * 2U))
285
#define PIN_MODE_ALTERNATE(n)       (2U << ((n) * 2U))
286
#define PIN_MODE_ANALOG(n)          (3U << ((n) * 2U))
287
#define PIN_ODR_LOW(n)              (0U << (n))
288
#define PIN_ODR_HIGH(n)             (1U << (n))
289
#define PIN_OTYPE_PUSHPULL(n)       (0U << (n))
290
#define PIN_OTYPE_OPENDRAIN(n)      (1U << (n))
291
#define PIN_OSPEED_VERYLOW(n)       (0U << ((n) * 2U))
292
#define PIN_OSPEED_LOW(n)           (1U << ((n) * 2U))
293
#define PIN_OSPEED_MEDIUM(n)        (2U << ((n) * 2U))
294
#define PIN_OSPEED_HIGH(n)          (3U << ((n) * 2U))
295
#define PIN_PUPDR_FLOATING(n)       (0U << ((n) * 2U))
296
#define PIN_PUPDR_PULLUP(n)         (1U << ((n) * 2U))
297
#define PIN_PUPDR_PULLDOWN(n)       (2U << ((n) * 2U))
298
#define PIN_AFIO_AF(n, v)           ((v) << (((n) % 8U) * 4U))
299
#define PIN_ASCR_DISABLED(n)        (0U << (n))
300
#define PIN_ASCR_ENABLED(n)         (1U << (n))
301
#define PIN_LOCKR_DISABLED(n)       (0U << (n))
302
#define PIN_LOCKR_ENABLED(n)        (1U << (n))
303
304
/*
305
 * GPIOA setup:
306
 *
307
 * PA0  - ARD_A0 ACD12_IN5          (analog).
308
 * PA1  - ARD_A1 ACD12_IN6          (analog).
309
 * PA2  - ARD_D1 USART2_TX          (alternate 7).
310
 * PA3  - ARD_D0 USART2_RX          (alternate 7).
311
 * PA4  - ARD_A2 ACD12_IN9          (analog).
312
 * PA5  - ARD_D13 LED_GREEN         (output pushpull maximum).
313
 * PA6  - ARD_D12                   (analog).
314
 * PA7  - ARD_D11                   (analog).
315
 * PA8  - ARD_D7                    (analog).
316
 * PA9  - ARD_D8                    (analog).
317
 * PA10 - ARD_D2                    (analog).
318
 * PA11 - PIN11                     (analog).
319
 * PA12 - PIN12                     (analog).
320
 * PA13 - SWDIO                     (alternate 0).
321
 * PA14 - SWCLK                     (alternate 0).
322
 * PA15 - PIN15                     (analog).
323
 */
324
#define VAL_GPIOA_MODER             (PIN_MODE_ANALOG(GPIOA_ARD_A0) |        \
325
                                     PIN_MODE_ANALOG(GPIOA_ARD_A1) |        \
326
                                     PIN_MODE_ALTERNATE(GPIOA_ARD_D1) |     \
327
                                     PIN_MODE_ALTERNATE(GPIOA_ARD_D0) |     \
328
                                     PIN_MODE_ANALOG(GPIOA_ARD_A2) |        \
329
                                     PIN_MODE_OUTPUT(GPIOA_ARD_D13) |       \
330
                                     PIN_MODE_ANALOG(GPIOA_ARD_D12) |       \
331
                                     PIN_MODE_ANALOG(GPIOA_ARD_D11) |       \
332
                                     PIN_MODE_ANALOG(GPIOA_ARD_D7) |        \
333
                                     PIN_MODE_ANALOG(GPIOA_ARD_D8) |        \
334
                                     PIN_MODE_ANALOG(GPIOA_ARD_D2) |        \
335
                                     PIN_MODE_ANALOG(GPIOA_PIN11) |         \
336
                                     PIN_MODE_ANALOG(GPIOA_PIN12) |         \
337
                                     PIN_MODE_ALTERNATE(GPIOA_SWDIO) |      \
338
                                     PIN_MODE_ALTERNATE(GPIOA_SWCLK) |      \
339
                                     PIN_MODE_ANALOG(GPIOA_PIN15))
340
#define VAL_GPIOA_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) |     \
341
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) |     \
342
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) |     \
343
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) |     \
344
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) |     \
345
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D13) |    \
346
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) |    \
347
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) |    \
348
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) |     \
349
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) |     \
350
                                     PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) |     \
351
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN11) |      \
352
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN12) |      \
353
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) |      \
354
                                     PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) |      \
355
                                     PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
356
#define VAL_GPIOA_OSPEEDR           (PIN_OSPEED_HIGH(GPIOA_ARD_A0) |        \
357
                                     PIN_OSPEED_HIGH(GPIOA_ARD_A1) |        \
358
                                     PIN_OSPEED_MEDIUM(GPIOA_ARD_D1) |      \
359
                                     PIN_OSPEED_MEDIUM(GPIOA_ARD_D0) |      \
360
                                     PIN_OSPEED_HIGH(GPIOA_ARD_A2) |        \
361
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D13) |       \
362
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D12) |       \
363
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D11) |       \
364
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D7) |        \
365
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D8) |        \
366
                                     PIN_OSPEED_HIGH(GPIOA_ARD_D2) |        \
367
                                     PIN_OSPEED_HIGH(GPIOA_PIN11) |         \
368
                                     PIN_OSPEED_HIGH(GPIOA_PIN12) |         \
369
                                     PIN_OSPEED_HIGH(GPIOA_SWDIO) |         \
370
                                     PIN_OSPEED_HIGH(GPIOA_SWCLK) |         \
371
                                     PIN_OSPEED_HIGH(GPIOA_PIN15))
372
#define VAL_GPIOA_PUPDR             (PIN_PUPDR_FLOATING(GPIOA_ARD_A0) |     \
373
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_A1) |     \
374
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D1) |     \
375
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D0) |     \
376
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_A2) |     \
377
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D13) |    \
378
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D12) |    \
379
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D11) |    \
380
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D7) |     \
381
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D8) |     \
382
                                     PIN_PUPDR_FLOATING(GPIOA_ARD_D2) |     \
383
                                     PIN_PUPDR_FLOATING(GPIOA_PIN11) |      \
384
                                     PIN_PUPDR_FLOATING(GPIOA_PIN12) |      \
385
                                     PIN_PUPDR_PULLUP(GPIOA_SWDIO) |        \
386
                                     PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) |      \
387
                                     PIN_PUPDR_FLOATING(GPIOA_PIN15))
388
#define VAL_GPIOA_ODR               (PIN_ODR_HIGH(GPIOA_ARD_A0) |           \
389
                                     PIN_ODR_HIGH(GPIOA_ARD_A1) |           \
390
                                     PIN_ODR_HIGH(GPIOA_ARD_D1) |           \
391
                                     PIN_ODR_HIGH(GPIOA_ARD_D0) |           \
392
                                     PIN_ODR_HIGH(GPIOA_ARD_A2) |           \
393
                                     PIN_ODR_LOW(GPIOA_ARD_D13) |           \
394
                                     PIN_ODR_HIGH(GPIOA_ARD_D12) |          \
395
                                     PIN_ODR_HIGH(GPIOA_ARD_D11) |          \
396
                                     PIN_ODR_HIGH(GPIOA_ARD_D7) |           \
397
                                     PIN_ODR_HIGH(GPIOA_ARD_D8) |           \
398
                                     PIN_ODR_HIGH(GPIOA_ARD_D2) |           \
399
                                     PIN_ODR_HIGH(GPIOA_PIN11) |            \
400
                                     PIN_ODR_HIGH(GPIOA_PIN12) |            \
401
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |            \
402
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |            \
403
                                     PIN_ODR_HIGH(GPIOA_PIN15))
404
#define VAL_GPIOA_AFRL              (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) |        \
405
                                     PIN_AFIO_AF(GPIOA_ARD_A1, 0U) |        \
406
                                     PIN_AFIO_AF(GPIOA_ARD_D1, 7U) |        \
407
                                     PIN_AFIO_AF(GPIOA_ARD_D0, 7U) |        \
408
                                     PIN_AFIO_AF(GPIOA_ARD_A2, 0U) |        \
409
                                     PIN_AFIO_AF(GPIOA_ARD_D13, 0U) |       \
410
                                     PIN_AFIO_AF(GPIOA_ARD_D12, 0U) |       \
411
                                     PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
412
#define VAL_GPIOA_AFRH              (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) |        \
413
                                     PIN_AFIO_AF(GPIOA_ARD_D8, 0U) |        \
414
                                     PIN_AFIO_AF(GPIOA_ARD_D2, 0U) |        \
415
                                     PIN_AFIO_AF(GPIOA_PIN11, 0U) |         \
416
                                     PIN_AFIO_AF(GPIOA_PIN12, 0U) |         \
417
                                     PIN_AFIO_AF(GPIOA_SWDIO, 0U) |         \
418
                                     PIN_AFIO_AF(GPIOA_SWCLK, 0U) |         \
419
                                     PIN_AFIO_AF(GPIOA_PIN15, 0U))
420
#define VAL_GPIOA_ASCR              (PIN_ASCR_DISABLED(GPIOA_ARD_A0) |      \
421
                                     PIN_ASCR_DISABLED(GPIOA_ARD_A1) |      \
422
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D1) |      \
423
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D0) |      \
424
                                     PIN_ASCR_DISABLED(GPIOA_ARD_A2) |      \
425
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D13) |     \
426
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D12) |     \
427
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D11) |     \
428
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D7) |      \
429
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D8) |      \
430
                                     PIN_ASCR_DISABLED(GPIOA_ARD_D2) |      \
431
                                     PIN_ASCR_DISABLED(GPIOA_PIN11) |       \
432
                                     PIN_ASCR_DISABLED(GPIOA_PIN12) |       \
433
                                     PIN_ASCR_DISABLED(GPIOA_SWDIO) |       \
434
                                     PIN_ASCR_DISABLED(GPIOA_SWCLK) |       \
435
                                     PIN_ASCR_DISABLED(GPIOA_PIN15))
436
#define VAL_GPIOA_LOCKR             (PIN_LOCKR_DISABLED(GPIOA_ARD_A0) |     \
437
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_A1) |     \
438
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D1) |     \
439
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D0) |     \
440
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_A2) |     \
441
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D13) |    \
442
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D12) |    \
443
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D11) |    \
444
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D7) |     \
445
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D8) |     \
446
                                     PIN_LOCKR_DISABLED(GPIOA_ARD_D2) |     \
447
                                     PIN_LOCKR_DISABLED(GPIOA_PIN11) |      \
448
                                     PIN_LOCKR_DISABLED(GPIOA_PIN12) |      \
449
                                     PIN_LOCKR_DISABLED(GPIOA_SWDIO) |      \
450
                                     PIN_LOCKR_DISABLED(GPIOA_SWCLK) |      \
451
                                     PIN_LOCKR_DISABLED(GPIOA_PIN15))
452
453
/*
454
 * GPIOB setup:
455
 *
456
 * PB0  - ARD_A3 ACD12_IN15         (analog).
457
 * PB1  - PIN1                      (analog).
458
 * PB2  - PIN2                      (analog).
459
 * PB3  - ARD_D3 SWO                (analog).
460
 * PB4  - ARD_D5                    (analog).
461
 * PB5  - ARD_D4                    (analog).
462
 * PB6  - ARD_D10                   (analog).
463
 * PB7  - PIN7                      (analog).
464
 * PB8  - ARD_D15                   (analog).
465
 * PB9  - ARD_D14                   (analog).
466
 * PB10 - ARD_D6                    (analog).
467
 * PB11 - PIN11                     (analog).
468
 * PB12 - PIN12                     (analog).
469
 * PB13 - PIN13                     (analog).
470
 * PB14 - PIN14                     (analog).
471
 * PB15 - PIN15                     (analog).
472
 */
473
#define VAL_GPIOB_MODER             (PIN_MODE_ANALOG(GPIOB_ARD_A3) |        \
474
                                     PIN_MODE_ANALOG(GPIOB_PIN1) |          \
475
                                     PIN_MODE_ANALOG(GPIOB_PIN2) |          \
476
                                     PIN_MODE_ANALOG(GPIOB_ARD_D3) |        \
477
                                     PIN_MODE_ANALOG(GPIOB_ARD_D5) |        \
478
                                     PIN_MODE_ANALOG(GPIOB_ARD_D4) |        \
479
                                     PIN_MODE_ANALOG(GPIOB_ARD_D10) |       \
480
                                     PIN_MODE_ANALOG(GPIOB_PIN7) |          \
481
                                     PIN_MODE_ANALOG(GPIOB_ARD_D15) |       \
482
                                     PIN_MODE_ANALOG(GPIOB_ARD_D14) |       \
483
                                     PIN_MODE_ANALOG(GPIOB_ARD_D6) |        \
484
                                     PIN_MODE_ANALOG(GPIOB_PIN11) |         \
485
                                     PIN_MODE_ANALOG(GPIOB_PIN12) |         \
486
                                     PIN_MODE_ANALOG(GPIOB_PIN13) |         \
487
                                     PIN_MODE_ANALOG(GPIOB_PIN14) |         \
488
                                     PIN_MODE_ANALOG(GPIOB_PIN15))
489
#define VAL_GPIOB_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) |     \
490
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN1) |       \
491
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN2) |       \
492
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D3) |     \
493
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) |     \
494
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) |     \
495
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) |    \
496
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN7) |       \
497
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) |    \
498
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) |    \
499
                                     PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) |     \
500
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN11) |      \
501
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN12) |      \
502
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN13) |      \
503
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN14) |      \
504
                                     PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
505
#define VAL_GPIOB_OSPEEDR           (PIN_OSPEED_HIGH(GPIOB_ARD_A3) |        \
506
                                     PIN_OSPEED_HIGH(GPIOB_PIN1) |          \
507
                                     PIN_OSPEED_HIGH(GPIOB_PIN2) |          \
508
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D3) |        \
509
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D5) |        \
510
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D4) |        \
511
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D10) |       \
512
                                     PIN_OSPEED_HIGH(GPIOB_PIN7) |          \
513
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D15) |       \
514
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D14) |       \
515
                                     PIN_OSPEED_HIGH(GPIOB_ARD_D6) |        \
516
                                     PIN_OSPEED_HIGH(GPIOB_PIN11) |         \
517
                                     PIN_OSPEED_HIGH(GPIOB_PIN12) |         \
518
                                     PIN_OSPEED_HIGH(GPIOB_PIN13) |         \
519
                                     PIN_OSPEED_HIGH(GPIOB_PIN14) |         \
520
                                     PIN_OSPEED_HIGH(GPIOB_PIN15))
521
#define VAL_GPIOB_PUPDR             (PIN_PUPDR_FLOATING(GPIOB_ARD_A3) |     \
522
                                     PIN_PUPDR_FLOATING(GPIOB_PIN1) |       \
523
                                     PIN_PUPDR_FLOATING(GPIOB_PIN2) |       \
524
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D3) |     \
525
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D5) |     \
526
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D4) |     \
527
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D10) |    \
528
                                     PIN_PUPDR_FLOATING(GPIOB_PIN7) |       \
529
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D15) |    \
530
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D14) |    \
531
                                     PIN_PUPDR_FLOATING(GPIOB_ARD_D6) |     \
532
                                     PIN_PUPDR_FLOATING(GPIOB_PIN11) |      \
533
                                     PIN_PUPDR_FLOATING(GPIOB_PIN12) |      \
534
                                     PIN_PUPDR_FLOATING(GPIOB_PIN13) |      \
535
                                     PIN_PUPDR_FLOATING(GPIOB_PIN14) |      \
536
                                     PIN_PUPDR_FLOATING(GPIOB_PIN15))
537
#define VAL_GPIOB_ODR               (PIN_ODR_HIGH(GPIOB_ARD_A3) |           \
538
                                     PIN_ODR_HIGH(GPIOB_PIN1) |             \
539
                                     PIN_ODR_HIGH(GPIOB_PIN2) |             \
540
                                     PIN_ODR_HIGH(GPIOB_ARD_D3) |           \
541
                                     PIN_ODR_HIGH(GPIOB_ARD_D5) |           \
542
                                     PIN_ODR_HIGH(GPIOB_ARD_D4) |           \
543
                                     PIN_ODR_HIGH(GPIOB_ARD_D10) |          \
544
                                     PIN_ODR_HIGH(GPIOB_PIN7) |             \
545
                                     PIN_ODR_HIGH(GPIOB_ARD_D15) |          \
546
                                     PIN_ODR_HIGH(GPIOB_ARD_D14) |          \
547
                                     PIN_ODR_HIGH(GPIOB_ARD_D6) |           \
548
                                     PIN_ODR_HIGH(GPIOB_PIN11) |            \
549
                                     PIN_ODR_HIGH(GPIOB_PIN12) |            \
550
                                     PIN_ODR_HIGH(GPIOB_PIN13) |            \
551
                                     PIN_ODR_HIGH(GPIOB_PIN14) |            \
552
                                     PIN_ODR_HIGH(GPIOB_PIN15))
553
#define VAL_GPIOB_AFRL              (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) |        \
554
                                     PIN_AFIO_AF(GPIOB_PIN1, 0U) |          \
555
                                     PIN_AFIO_AF(GPIOB_PIN2, 0U) |          \
556
                                     PIN_AFIO_AF(GPIOB_ARD_D3, 0U) |        \
557
                                     PIN_AFIO_AF(GPIOB_ARD_D5, 0U) |        \
558
                                     PIN_AFIO_AF(GPIOB_ARD_D4, 0U) |        \
559
                                     PIN_AFIO_AF(GPIOB_ARD_D10, 0U) |       \
560
                                     PIN_AFIO_AF(GPIOB_PIN7, 0U))
561
#define VAL_GPIOB_AFRH              (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) |       \
562
                                     PIN_AFIO_AF(GPIOB_ARD_D14, 0U) |       \
563
                                     PIN_AFIO_AF(GPIOB_ARD_D6, 0U) |        \
564
                                     PIN_AFIO_AF(GPIOB_PIN11, 0U) |         \
565
                                     PIN_AFIO_AF(GPIOB_PIN12, 0U) |         \
566
                                     PIN_AFIO_AF(GPIOB_PIN13, 0U) |         \
567
                                     PIN_AFIO_AF(GPIOB_PIN14, 0U) |         \
568
                                     PIN_AFIO_AF(GPIOB_PIN15, 0U))
569
#define VAL_GPIOB_ASCR              (PIN_ASCR_DISABLED(GPIOB_ARD_A3) |      \
570
                                     PIN_ASCR_DISABLED(GPIOB_PIN1) |        \
571
                                     PIN_ASCR_DISABLED(GPIOB_PIN2) |        \
572
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D3) |      \
573
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D5) |      \
574
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D4) |      \
575
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D10) |     \
576
                                     PIN_ASCR_DISABLED(GPIOB_PIN7) |        \
577
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D15) |     \
578
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D14) |     \
579
                                     PIN_ASCR_DISABLED(GPIOB_ARD_D6) |      \
580
                                     PIN_ASCR_DISABLED(GPIOB_PIN11) |       \
581
                                     PIN_ASCR_DISABLED(GPIOB_PIN12) |       \
582
                                     PIN_ASCR_DISABLED(GPIOB_PIN13) |       \
583
                                     PIN_ASCR_DISABLED(GPIOB_PIN14) |       \
584
                                     PIN_ASCR_DISABLED(GPIOB_PIN15))
585
#define VAL_GPIOB_LOCKR             (PIN_LOCKR_DISABLED(GPIOB_ARD_A3) |     \
586
                                     PIN_LOCKR_DISABLED(GPIOB_PIN1) |       \
587
                                     PIN_LOCKR_DISABLED(GPIOB_PIN2) |       \
588
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D3) |     \
589
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D5) |     \
590
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D4) |     \
591
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D10) |    \
592
                                     PIN_LOCKR_DISABLED(GPIOB_PIN7) |       \
593
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D15) |    \
594
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D14) |    \
595
                                     PIN_LOCKR_DISABLED(GPIOB_ARD_D6) |     \
596
                                     PIN_LOCKR_DISABLED(GPIOB_PIN11) |      \
597
                                     PIN_LOCKR_DISABLED(GPIOB_PIN12) |      \
598
                                     PIN_LOCKR_DISABLED(GPIOB_PIN13) |      \
599
                                     PIN_LOCKR_DISABLED(GPIOB_PIN14) |      \
600
                                     PIN_LOCKR_DISABLED(GPIOB_PIN15))
601
602
/*
603
 * GPIOC setup:
604
 *
605
 * PC0  - ARD_A5 ACD123_IN1         (analog).
606
 * PC1  - ARD_A4 ACD123_IN2         (analog).
607
 * PC2  - PIN2                      (analog).
608
 * PC3  - PIN3                      (analog).
609
 * PC4  - PIN4                      (analog).
610
 * PC5  - PIN5                      (analog).
611
 * PC6  - PIN6                      (analog).
612
 * PC7  - ARD_D9                    (analog).
613
 * PC8  - PIN8                      (analog).
614
 * PC9  - PIN9                      (analog).
615
 * PC10 - PIN10                     (analog).
616
 * PC11 - PIN11                     (analog).
617
 * PC12 - PIN12                     (analog).
618
 * PC13 - BUTTON                    (input floating).
619
 * PC14 - OSC32_IN                  (input floating).
620
 * PC15 - OSC32_OUT                 (input floating).
621
 */
622
#define VAL_GPIOC_MODER             (PIN_MODE_ANALOG(GPIOC_ARD_A5) |        \
623
                                     PIN_MODE_ANALOG(GPIOC_ARD_A4) |        \
624
                                     PIN_MODE_ANALOG(GPIOC_PIN2) |          \
625
                                     PIN_MODE_ANALOG(GPIOC_PIN3) |          \
626
                                     PIN_MODE_ANALOG(GPIOC_PIN4) |          \
627
                                     PIN_MODE_ANALOG(GPIOC_PIN5) |          \
628
                                     PIN_MODE_ANALOG(GPIOC_PIN6) |          \
629
                                     PIN_MODE_ANALOG(GPIOC_ARD_D9) |        \
630
                                     PIN_MODE_ANALOG(GPIOC_PIN8) |          \
631
                                     PIN_MODE_ANALOG(GPIOC_PIN9) |          \
632
                                     PIN_MODE_ANALOG(GPIOC_PIN10) |         \
633
                                     PIN_MODE_ANALOG(GPIOC_PIN11) |         \
634
                                     PIN_MODE_ANALOG(GPIOC_PIN12) |         \
635
                                     PIN_MODE_INPUT(GPIOC_BUTTON) |         \
636
                                     PIN_MODE_INPUT(GPIOC_OSC32_IN) |       \
637
                                     PIN_MODE_INPUT(GPIOC_OSC32_OUT))
638
#define VAL_GPIOC_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) |     \
639
                                     PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) |     \
640
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN2) |       \
641
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN3) |       \
642
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN4) |       \
643
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN5) |       \
644
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN6) |       \
645
                                     PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) |     \
646
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN8) |       \
647
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN9) |       \
648
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN10) |      \
649
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN11) |      \
650
                                     PIN_OTYPE_PUSHPULL(GPIOC_PIN12) |      \
651
                                     PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) |     \
652
                                     PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) |   \
653
                                     PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
654
#define VAL_GPIOC_OSPEEDR           (PIN_OSPEED_HIGH(GPIOC_ARD_A5) |        \
655
                                     PIN_OSPEED_HIGH(GPIOC_ARD_A4) |        \
656
                                     PIN_OSPEED_HIGH(GPIOC_PIN2) |          \
657
                                     PIN_OSPEED_HIGH(GPIOC_PIN3) |          \
658
                                     PIN_OSPEED_HIGH(GPIOC_PIN4) |          \
659
                                     PIN_OSPEED_HIGH(GPIOC_PIN5) |          \
660
                                     PIN_OSPEED_HIGH(GPIOC_PIN6) |          \
661
                                     PIN_OSPEED_HIGH(GPIOC_ARD_D9) |        \
662
                                     PIN_OSPEED_HIGH(GPIOC_PIN8) |          \
663
                                     PIN_OSPEED_HIGH(GPIOC_PIN9) |          \
664
                                     PIN_OSPEED_HIGH(GPIOC_PIN10) |         \
665
                                     PIN_OSPEED_HIGH(GPIOC_PIN11) |         \
666
                                     PIN_OSPEED_HIGH(GPIOC_PIN12) |         \
667
                                     PIN_OSPEED_HIGH(GPIOC_BUTTON) |        \
668
                                     PIN_OSPEED_HIGH(GPIOC_OSC32_IN) |      \
669
                                     PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
670
#define VAL_GPIOC_PUPDR             (PIN_PUPDR_FLOATING(GPIOC_ARD_A5) |     \
671
                                     PIN_PUPDR_FLOATING(GPIOC_ARD_A4) |     \
672
                                     PIN_PUPDR_FLOATING(GPIOC_PIN2) |       \
673
                                     PIN_PUPDR_FLOATING(GPIOC_PIN3) |       \
674
                                     PIN_PUPDR_FLOATING(GPIOC_PIN4) |       \
675
                                     PIN_PUPDR_FLOATING(GPIOC_PIN5) |       \
676
                                     PIN_PUPDR_FLOATING(GPIOC_PIN6) |       \
677
                                     PIN_PUPDR_FLOATING(GPIOC_ARD_D9) |     \
678
                                     PIN_PUPDR_FLOATING(GPIOC_PIN8) |       \
679
                                     PIN_PUPDR_FLOATING(GPIOC_PIN9) |       \
680
                                     PIN_PUPDR_FLOATING(GPIOC_PIN10) |      \
681
                                     PIN_PUPDR_FLOATING(GPIOC_PIN11) |      \
682
                                     PIN_PUPDR_FLOATING(GPIOC_PIN12) |      \
683
                                     PIN_PUPDR_FLOATING(GPIOC_BUTTON) |     \
684
                                     PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) |   \
685
                                     PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
686
#define VAL_GPIOC_ODR               (PIN_ODR_HIGH(GPIOC_ARD_A5) |           \
687
                                     PIN_ODR_HIGH(GPIOC_ARD_A4) |           \
688
                                     PIN_ODR_HIGH(GPIOC_PIN2) |             \
689
                                     PIN_ODR_HIGH(GPIOC_PIN3) |             \
690
                                     PIN_ODR_HIGH(GPIOC_PIN4) |             \
691
                                     PIN_ODR_HIGH(GPIOC_PIN5) |             \
692
                                     PIN_ODR_HIGH(GPIOC_PIN6) |             \
693
                                     PIN_ODR_HIGH(GPIOC_ARD_D9) |           \
694
                                     PIN_ODR_HIGH(GPIOC_PIN8) |             \
695
                                     PIN_ODR_HIGH(GPIOC_PIN9) |             \
696
                                     PIN_ODR_HIGH(GPIOC_PIN10) |            \
697
                                     PIN_ODR_HIGH(GPIOC_PIN11) |            \
698
                                     PIN_ODR_HIGH(GPIOC_PIN12) |            \
699
                                     PIN_ODR_HIGH(GPIOC_BUTTON) |           \
700
                                     PIN_ODR_HIGH(GPIOC_OSC32_IN) |         \
701
                                     PIN_ODR_HIGH(GPIOC_OSC32_OUT))
702
#define VAL_GPIOC_AFRL              (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) |        \
703
                                     PIN_AFIO_AF(GPIOC_ARD_A4, 0U) |        \
704
                                     PIN_AFIO_AF(GPIOC_PIN2, 0U) |          \
705
                                     PIN_AFIO_AF(GPIOC_PIN3, 0U) |          \
706
                                     PIN_AFIO_AF(GPIOC_PIN4, 0U) |          \
707
                                     PIN_AFIO_AF(GPIOC_PIN5, 0U) |          \
708
                                     PIN_AFIO_AF(GPIOC_PIN6, 0U) |          \
709
                                     PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
710
#define VAL_GPIOC_AFRH              (PIN_AFIO_AF(GPIOC_PIN8, 0U) |          \
711
                                     PIN_AFIO_AF(GPIOC_PIN9, 0U) |          \
712
                                     PIN_AFIO_AF(GPIOC_PIN10, 0U) |         \
713
                                     PIN_AFIO_AF(GPIOC_PIN11, 0U) |         \
714
                                     PIN_AFIO_AF(GPIOC_PIN12, 0U) |         \
715
                                     PIN_AFIO_AF(GPIOC_BUTTON, 0U) |        \
716
                                     PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) |      \
717
                                     PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
718
#define VAL_GPIOC_ASCR              (PIN_ASCR_DISABLED(GPIOC_ARD_A5) |      \
719
                                     PIN_ASCR_DISABLED(GPIOC_ARD_A4) |      \
720
                                     PIN_ASCR_DISABLED(GPIOC_PIN2) |        \
721
                                     PIN_ASCR_DISABLED(GPIOC_PIN3) |        \
722
                                     PIN_ASCR_DISABLED(GPIOC_PIN4) |        \
723
                                     PIN_ASCR_DISABLED(GPIOC_PIN5) |        \
724
                                     PIN_ASCR_DISABLED(GPIOC_PIN6) |        \
725
                                     PIN_ASCR_DISABLED(GPIOC_ARD_D9) |      \
726
                                     PIN_ASCR_DISABLED(GPIOC_PIN8) |        \
727
                                     PIN_ASCR_DISABLED(GPIOC_PIN9) |        \
728
                                     PIN_ASCR_DISABLED(GPIOC_PIN10) |       \
729
                                     PIN_ASCR_DISABLED(GPIOC_PIN11) |       \
730
                                     PIN_ASCR_DISABLED(GPIOC_PIN12) |       \
731
                                     PIN_ASCR_DISABLED(GPIOC_BUTTON) |      \
732
                                     PIN_ASCR_DISABLED(GPIOC_OSC32_IN) |    \
733
                                     PIN_ASCR_DISABLED(GPIOC_OSC32_OUT))
734
#define VAL_GPIOC_LOCKR             (PIN_LOCKR_DISABLED(GPIOC_ARD_A5) |     \
735
                                     PIN_LOCKR_DISABLED(GPIOC_ARD_A4) |     \
736
                                     PIN_LOCKR_DISABLED(GPIOC_PIN2) |       \
737
                                     PIN_LOCKR_DISABLED(GPIOC_PIN3) |       \
738
                                     PIN_LOCKR_DISABLED(GPIOC_PIN4) |       \
739
                                     PIN_LOCKR_DISABLED(GPIOC_PIN5) |       \
740
                                     PIN_LOCKR_DISABLED(GPIOC_PIN6) |       \
741
                                     PIN_LOCKR_DISABLED(GPIOC_ARD_D9) |     \
742
                                     PIN_LOCKR_DISABLED(GPIOC_PIN8) |       \
743
                                     PIN_LOCKR_DISABLED(GPIOC_PIN9) |       \
744
                                     PIN_LOCKR_DISABLED(GPIOC_PIN10) |      \
745
                                     PIN_LOCKR_DISABLED(GPIOC_PIN11) |      \
746
                                     PIN_LOCKR_DISABLED(GPIOC_PIN12) |      \
747
                                     PIN_LOCKR_DISABLED(GPIOC_BUTTON) |     \
748
                                     PIN_LOCKR_DISABLED(GPIOC_OSC32_IN) |   \
749
                                     PIN_LOCKR_DISABLED(GPIOC_OSC32_OUT))
750
751
/*
752
 * GPIOD setup:
753
 *
754
 * PD0  - PIN0                      (analog).
755
 * PD1  - PIN1                      (analog).
756
 * PD2  - PIN2                      (analog).
757
 * PD3  - PIN3                      (analog).
758
 * PD4  - PIN4                      (analog).
759
 * PD5  - PIN5                      (analog).
760
 * PD6  - PIN6                      (analog).
761
 * PD7  - PIN7                      (analog).
762
 * PD8  - PIN8                      (analog).
763
 * PD9  - PIN9                      (analog).
764
 * PD10 - PIN10                     (analog).
765
 * PD11 - PIN11                     (analog).
766
 * PD12 - PIN12                     (analog).
767
 * PD13 - PIN13                     (analog).
768
 * PD14 - PIN14                     (analog).
769
 * PD15 - PIN15                     (analog).
770
 */
771
#define VAL_GPIOD_MODER             (PIN_MODE_ANALOG(GPIOD_PIN0) |          \
772
                                     PIN_MODE_ANALOG(GPIOD_PIN1) |          \
773
                                     PIN_MODE_ANALOG(GPIOD_PIN2) |          \
774
                                     PIN_MODE_ANALOG(GPIOD_PIN3) |          \
775
                                     PIN_MODE_ANALOG(GPIOD_PIN4) |          \
776
                                     PIN_MODE_ANALOG(GPIOD_PIN5) |          \
777
                                     PIN_MODE_ANALOG(GPIOD_PIN6) |          \
778
                                     PIN_MODE_ANALOG(GPIOD_PIN7) |          \
779
                                     PIN_MODE_ANALOG(GPIOD_PIN8) |          \
780
                                     PIN_MODE_ANALOG(GPIOD_PIN9) |          \
781
                                     PIN_MODE_ANALOG(GPIOD_PIN10) |         \
782
                                     PIN_MODE_ANALOG(GPIOD_PIN11) |         \
783
                                     PIN_MODE_ANALOG(GPIOD_PIN12) |         \
784
                                     PIN_MODE_ANALOG(GPIOD_PIN13) |         \
785
                                     PIN_MODE_ANALOG(GPIOD_PIN14) |         \
786
                                     PIN_MODE_ANALOG(GPIOD_PIN15))
787
#define VAL_GPIOD_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) |       \
788
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN1) |       \
789
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN2) |       \
790
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN3) |       \
791
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN4) |       \
792
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN5) |       \
793
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN6) |       \
794
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN7) |       \
795
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN8) |       \
796
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN9) |       \
797
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN10) |      \
798
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN11) |      \
799
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN12) |      \
800
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN13) |      \
801
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN14) |      \
802
                                     PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
803
#define VAL_GPIOD_OSPEEDR           (PIN_OSPEED_HIGH(GPIOD_PIN0) |          \
804
                                     PIN_OSPEED_HIGH(GPIOD_PIN1) |          \
805
                                     PIN_OSPEED_HIGH(GPIOD_PIN2) |          \
806
                                     PIN_OSPEED_HIGH(GPIOD_PIN3) |          \
807
                                     PIN_OSPEED_HIGH(GPIOD_PIN4) |          \
808
                                     PIN_OSPEED_HIGH(GPIOD_PIN5) |          \
809
                                     PIN_OSPEED_HIGH(GPIOD_PIN6) |          \
810
                                     PIN_OSPEED_HIGH(GPIOD_PIN7) |          \
811
                                     PIN_OSPEED_HIGH(GPIOD_PIN8) |          \
812
                                     PIN_OSPEED_HIGH(GPIOD_PIN9) |          \
813
                                     PIN_OSPEED_HIGH(GPIOD_PIN10) |         \
814
                                     PIN_OSPEED_HIGH(GPIOD_PIN11) |         \
815
                                     PIN_OSPEED_HIGH(GPIOD_PIN12) |         \
816
                                     PIN_OSPEED_HIGH(GPIOD_PIN13) |         \
817
                                     PIN_OSPEED_HIGH(GPIOD_PIN14) |         \
818
                                     PIN_OSPEED_HIGH(GPIOD_PIN15))
819
#define VAL_GPIOD_PUPDR             (PIN_PUPDR_FLOATING(GPIOD_PIN0) |       \
820
                                     PIN_PUPDR_FLOATING(GPIOD_PIN1) |       \
821
                                     PIN_PUPDR_FLOATING(GPIOD_PIN2) |       \
822
                                     PIN_PUPDR_FLOATING(GPIOD_PIN3) |       \
823
                                     PIN_PUPDR_FLOATING(GPIOD_PIN4) |       \
824
                                     PIN_PUPDR_FLOATING(GPIOD_PIN5) |       \
825
                                     PIN_PUPDR_FLOATING(GPIOD_PIN6) |       \
826
                                     PIN_PUPDR_FLOATING(GPIOD_PIN7) |       \
827
                                     PIN_PUPDR_FLOATING(GPIOD_PIN8) |       \
828
                                     PIN_PUPDR_FLOATING(GPIOD_PIN9) |       \
829
                                     PIN_PUPDR_FLOATING(GPIOD_PIN10) |      \
830
                                     PIN_PUPDR_FLOATING(GPIOD_PIN11) |      \
831
                                     PIN_PUPDR_FLOATING(GPIOD_PIN12) |      \
832
                                     PIN_PUPDR_FLOATING(GPIOD_PIN13) |      \
833
                                     PIN_PUPDR_FLOATING(GPIOD_PIN14) |      \
834
                                     PIN_PUPDR_FLOATING(GPIOD_PIN15))
835
#define VAL_GPIOD_ODR               (PIN_ODR_HIGH(GPIOD_PIN0) |             \
836
                                     PIN_ODR_HIGH(GPIOD_PIN1) |             \
837
                                     PIN_ODR_HIGH(GPIOD_PIN2) |             \
838
                                     PIN_ODR_HIGH(GPIOD_PIN3) |             \
839
                                     PIN_ODR_HIGH(GPIOD_PIN4) |             \
840
                                     PIN_ODR_HIGH(GPIOD_PIN5) |             \
841
                                     PIN_ODR_HIGH(GPIOD_PIN6) |             \
842
                                     PIN_ODR_HIGH(GPIOD_PIN7) |             \
843
                                     PIN_ODR_HIGH(GPIOD_PIN8) |             \
844
                                     PIN_ODR_HIGH(GPIOD_PIN9) |             \
845
                                     PIN_ODR_HIGH(GPIOD_PIN10) |            \
846
                                     PIN_ODR_HIGH(GPIOD_PIN11) |            \
847
                                     PIN_ODR_HIGH(GPIOD_PIN12) |            \
848
                                     PIN_ODR_HIGH(GPIOD_PIN13) |            \
849
                                     PIN_ODR_HIGH(GPIOD_PIN14) |            \
850
                                     PIN_ODR_HIGH(GPIOD_PIN15))
851
#define VAL_GPIOD_AFRL              (PIN_AFIO_AF(GPIOD_PIN0, 0U) |          \
852
                                     PIN_AFIO_AF(GPIOD_PIN1, 0U) |          \
853
                                     PIN_AFIO_AF(GPIOD_PIN2, 0U) |          \
854
                                     PIN_AFIO_AF(GPIOD_PIN3, 0U) |          \
855
                                     PIN_AFIO_AF(GPIOD_PIN4, 0U) |          \
856
                                     PIN_AFIO_AF(GPIOD_PIN5, 0U) |          \
857
                                     PIN_AFIO_AF(GPIOD_PIN6, 0U) |          \
858
                                     PIN_AFIO_AF(GPIOD_PIN7, 0U))
859
#define VAL_GPIOD_AFRH              (PIN_AFIO_AF(GPIOD_PIN8, 0U) |          \
860
                                     PIN_AFIO_AF(GPIOD_PIN9, 0U) |          \
861
                                     PIN_AFIO_AF(GPIOD_PIN10, 0U) |         \
862
                                     PIN_AFIO_AF(GPIOD_PIN11, 0U) |         \
863
                                     PIN_AFIO_AF(GPIOD_PIN12, 0U) |         \
864
                                     PIN_AFIO_AF(GPIOD_PIN13, 0U) |         \
865
                                     PIN_AFIO_AF(GPIOD_PIN14, 0U) |         \
866
                                     PIN_AFIO_AF(GPIOD_PIN15, 0U))
867
#define VAL_GPIOD_ASCR              (PIN_ASCR_DISABLED(GPIOD_PIN0) |        \
868
                                     PIN_ASCR_DISABLED(GPIOD_PIN1) |        \
869
                                     PIN_ASCR_DISABLED(GPIOD_PIN2) |        \
870
                                     PIN_ASCR_DISABLED(GPIOD_PIN3) |        \
871
                                     PIN_ASCR_DISABLED(GPIOD_PIN4) |        \
872
                                     PIN_ASCR_DISABLED(GPIOD_PIN5) |        \
873
                                     PIN_ASCR_DISABLED(GPIOD_PIN6) |        \
874
                                     PIN_ASCR_DISABLED(GPIOD_PIN7) |        \
875
                                     PIN_ASCR_DISABLED(GPIOD_PIN8) |        \
876
                                     PIN_ASCR_DISABLED(GPIOD_PIN9) |        \
877
                                     PIN_ASCR_DISABLED(GPIOD_PIN10) |       \
878
                                     PIN_ASCR_DISABLED(GPIOD_PIN11) |       \
879
                                     PIN_ASCR_DISABLED(GPIOD_PIN12) |       \
880
                                     PIN_ASCR_DISABLED(GPIOD_PIN13) |       \
881
                                     PIN_ASCR_DISABLED(GPIOD_PIN14) |       \
882
                                     PIN_ASCR_DISABLED(GPIOD_PIN15))
883
#define VAL_GPIOD_LOCKR             (PIN_LOCKR_DISABLED(GPIOD_PIN0) |       \
884
                                     PIN_LOCKR_DISABLED(GPIOD_PIN1) |       \
885
                                     PIN_LOCKR_DISABLED(GPIOD_PIN2) |       \
886
                                     PIN_LOCKR_DISABLED(GPIOD_PIN3) |       \
887
                                     PIN_LOCKR_DISABLED(GPIOD_PIN4) |       \
888
                                     PIN_LOCKR_DISABLED(GPIOD_PIN5) |       \
889
                                     PIN_LOCKR_DISABLED(GPIOD_PIN6) |       \
890
                                     PIN_LOCKR_DISABLED(GPIOD_PIN7) |       \
891
                                     PIN_LOCKR_DISABLED(GPIOD_PIN8) |       \
892
                                     PIN_LOCKR_DISABLED(GPIOD_PIN9) |       \
893
                                     PIN_LOCKR_DISABLED(GPIOD_PIN10) |      \
894
                                     PIN_LOCKR_DISABLED(GPIOD_PIN11) |      \
895
                                     PIN_LOCKR_DISABLED(GPIOD_PIN12) |      \
896
                                     PIN_LOCKR_DISABLED(GPIOD_PIN13) |      \
897
                                     PIN_LOCKR_DISABLED(GPIOD_PIN14) |      \
898
                                     PIN_LOCKR_DISABLED(GPIOD_PIN15))
899
900
/*
901
 * GPIOE setup:
902
 *
903
 * PE0  - PIN0                      (analog).
904
 * PE1  - PIN1                      (analog).
905
 * PE2  - PIN2                      (analog).
906
 * PE3  - PIN3                      (analog).
907
 * PE4  - PIN4                      (analog).
908
 * PE5  - PIN5                      (analog).
909
 * PE6  - PIN6                      (analog).
910
 * PE7  - PIN7                      (analog).
911
 * PE8  - PIN8                      (analog).
912
 * PE9  - PIN9                      (analog).
913
 * PE10 - PIN10                     (analog).
914
 * PE11 - PIN11                     (analog).
915
 * PE12 - PIN12                     (analog).
916
 * PE13 - PIN13                     (analog).
917
 * PE14 - PIN14                     (analog).
918
 * PE15 - PIN15                     (analog).
919
 */
920
#define VAL_GPIOE_MODER             (PIN_MODE_ANALOG(GPIOE_PIN0) |          \
921
                                     PIN_MODE_ANALOG(GPIOE_PIN1) |          \
922
                                     PIN_MODE_ANALOG(GPIOE_PIN2) |          \
923
                                     PIN_MODE_ANALOG(GPIOE_PIN3) |          \
924
                                     PIN_MODE_ANALOG(GPIOE_PIN4) |          \
925
                                     PIN_MODE_ANALOG(GPIOE_PIN5) |          \
926
                                     PIN_MODE_ANALOG(GPIOE_PIN6) |          \
927
                                     PIN_MODE_ANALOG(GPIOE_PIN7) |          \
928
                                     PIN_MODE_ANALOG(GPIOE_PIN8) |          \
929
                                     PIN_MODE_ANALOG(GPIOE_PIN9) |          \
930
                                     PIN_MODE_ANALOG(GPIOE_PIN10) |         \
931
                                     PIN_MODE_ANALOG(GPIOE_PIN11) |         \
932
                                     PIN_MODE_ANALOG(GPIOE_PIN12) |         \
933
                                     PIN_MODE_ANALOG(GPIOE_PIN13) |         \
934
                                     PIN_MODE_ANALOG(GPIOE_PIN14) |         \
935
                                     PIN_MODE_ANALOG(GPIOE_PIN15))
936
#define VAL_GPIOE_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) |       \
937
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN1) |       \
938
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |       \
939
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN3) |       \
940
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |       \
941
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |       \
942
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN6) |       \
943
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN7) |       \
944
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN8) |       \
945
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN9) |       \
946
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |      \
947
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN11) |      \
948
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN12) |      \
949
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN13) |      \
950
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |      \
951
                                     PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
952
#define VAL_GPIOE_OSPEEDR           (PIN_OSPEED_HIGH(GPIOE_PIN0) |          \
953
                                     PIN_OSPEED_HIGH(GPIOE_PIN1) |          \
954
                                     PIN_OSPEED_HIGH(GPIOE_PIN2) |          \
955
                                     PIN_OSPEED_HIGH(GPIOE_PIN3) |          \
956
                                     PIN_OSPEED_HIGH(GPIOE_PIN4) |          \
957
                                     PIN_OSPEED_HIGH(GPIOE_PIN5) |          \
958
                                     PIN_OSPEED_HIGH(GPIOE_PIN6) |          \
959
                                     PIN_OSPEED_HIGH(GPIOE_PIN7) |          \
960
                                     PIN_OSPEED_HIGH(GPIOE_PIN8) |          \
961
                                     PIN_OSPEED_HIGH(GPIOE_PIN9) |          \
962
                                     PIN_OSPEED_HIGH(GPIOE_PIN10) |         \
963
                                     PIN_OSPEED_HIGH(GPIOE_PIN11) |         \
964
                                     PIN_OSPEED_HIGH(GPIOE_PIN12) |         \
965
                                     PIN_OSPEED_HIGH(GPIOE_PIN13) |         \
966
                                     PIN_OSPEED_HIGH(GPIOE_PIN14) |         \
967
                                     PIN_OSPEED_HIGH(GPIOE_PIN15))
968
#define VAL_GPIOE_PUPDR             (PIN_PUPDR_FLOATING(GPIOE_PIN0) |       \
969
                                     PIN_PUPDR_FLOATING(GPIOE_PIN1) |       \
970
                                     PIN_PUPDR_FLOATING(GPIOE_PIN2) |       \
971
                                     PIN_PUPDR_FLOATING(GPIOE_PIN3) |       \
972
                                     PIN_PUPDR_FLOATING(GPIOE_PIN4) |       \
973
                                     PIN_PUPDR_FLOATING(GPIOE_PIN5) |       \
974
                                     PIN_PUPDR_FLOATING(GPIOE_PIN6) |       \
975
                                     PIN_PUPDR_FLOATING(GPIOE_PIN7) |       \
976
                                     PIN_PUPDR_FLOATING(GPIOE_PIN8) |       \
977
                                     PIN_PUPDR_FLOATING(GPIOE_PIN9) |       \
978
                                     PIN_PUPDR_FLOATING(GPIOE_PIN10) |      \
979
                                     PIN_PUPDR_FLOATING(GPIOE_PIN11) |      \
980
                                     PIN_PUPDR_FLOATING(GPIOE_PIN12) |      \
981
                                     PIN_PUPDR_FLOATING(GPIOE_PIN13) |      \
982
                                     PIN_PUPDR_FLOATING(GPIOE_PIN14) |      \
983
                                     PIN_PUPDR_FLOATING(GPIOE_PIN15))
984
#define VAL_GPIOE_ODR               (PIN_ODR_HIGH(GPIOE_PIN0) |             \
985
                                     PIN_ODR_HIGH(GPIOE_PIN1) |             \
986
                                     PIN_ODR_HIGH(GPIOE_PIN2) |             \
987
                                     PIN_ODR_HIGH(GPIOE_PIN3) |             \
988
                                     PIN_ODR_HIGH(GPIOE_PIN4) |             \
989
                                     PIN_ODR_HIGH(GPIOE_PIN5) |             \
990
                                     PIN_ODR_HIGH(GPIOE_PIN6) |             \
991
                                     PIN_ODR_HIGH(GPIOE_PIN7) |             \
992
                                     PIN_ODR_HIGH(GPIOE_PIN8) |             \
993
                                     PIN_ODR_HIGH(GPIOE_PIN9) |             \
994
                                     PIN_ODR_HIGH(GPIOE_PIN10) |            \
995
                                     PIN_ODR_HIGH(GPIOE_PIN11) |            \
996
                                     PIN_ODR_HIGH(GPIOE_PIN12) |            \
997
                                     PIN_ODR_HIGH(GPIOE_PIN13) |            \
998
                                     PIN_ODR_HIGH(GPIOE_PIN14) |            \
999
                                     PIN_ODR_HIGH(GPIOE_PIN15))
1000
#define VAL_GPIOE_AFRL              (PIN_AFIO_AF(GPIOE_PIN0, 0U) |          \
1001
                                     PIN_AFIO_AF(GPIOE_PIN1, 0U) |          \
1002
                                     PIN_AFIO_AF(GPIOE_PIN2, 0U) |          \
1003
                                     PIN_AFIO_AF(GPIOE_PIN3, 0U) |          \
1004
                                     PIN_AFIO_AF(GPIOE_PIN4, 0U) |          \
1005
                                     PIN_AFIO_AF(GPIOE_PIN5, 0U) |          \
1006
                                     PIN_AFIO_AF(GPIOE_PIN6, 0U) |          \
1007
                                     PIN_AFIO_AF(GPIOE_PIN7, 0U))
1008
#define VAL_GPIOE_AFRH              (PIN_AFIO_AF(GPIOE_PIN8, 0U) |          \
1009
                                     PIN_AFIO_AF(GPIOE_PIN9, 0U) |          \
1010
                                     PIN_AFIO_AF(GPIOE_PIN10, 0U) |         \
1011
                                     PIN_AFIO_AF(GPIOE_PIN11, 0U) |         \
1012
                                     PIN_AFIO_AF(GPIOE_PIN12, 0U) |         \
1013
                                     PIN_AFIO_AF(GPIOE_PIN13, 0U) |         \
1014
                                     PIN_AFIO_AF(GPIOE_PIN14, 0U) |         \
1015
                                     PIN_AFIO_AF(GPIOE_PIN15, 0U))
1016
#define VAL_GPIOE_ASCR              (PIN_ASCR_DISABLED(GPIOE_PIN0) |        \
1017
                                     PIN_ASCR_DISABLED(GPIOE_PIN1) |        \
1018
                                     PIN_ASCR_DISABLED(GPIOE_PIN2) |        \
1019
                                     PIN_ASCR_DISABLED(GPIOE_PIN3) |        \
1020
                                     PIN_ASCR_DISABLED(GPIOE_PIN4) |        \
1021
                                     PIN_ASCR_DISABLED(GPIOE_PIN5) |        \
1022
                                     PIN_ASCR_DISABLED(GPIOE_PIN6) |        \
1023
                                     PIN_ASCR_DISABLED(GPIOE_PIN7) |        \
1024
                                     PIN_ASCR_DISABLED(GPIOE_PIN8) |        \
1025
                                     PIN_ASCR_DISABLED(GPIOE_PIN9) |        \
1026
                                     PIN_ASCR_DISABLED(GPIOE_PIN10) |       \
1027
                                     PIN_ASCR_DISABLED(GPIOE_PIN11) |       \
1028
                                     PIN_ASCR_DISABLED(GPIOE_PIN12) |       \
1029
                                     PIN_ASCR_DISABLED(GPIOE_PIN13) |       \
1030
                                     PIN_ASCR_DISABLED(GPIOE_PIN14) |       \
1031
                                     PIN_ASCR_DISABLED(GPIOE_PIN15))
1032
#define VAL_GPIOE_LOCKR             (PIN_LOCKR_DISABLED(GPIOE_PIN0) |       \
1033
                                     PIN_LOCKR_DISABLED(GPIOE_PIN1) |       \
1034
                                     PIN_LOCKR_DISABLED(GPIOE_PIN2) |       \
1035
                                     PIN_LOCKR_DISABLED(GPIOE_PIN3) |       \
1036
                                     PIN_LOCKR_DISABLED(GPIOE_PIN4) |       \
1037
                                     PIN_LOCKR_DISABLED(GPIOE_PIN5) |       \
1038
                                     PIN_LOCKR_DISABLED(GPIOE_PIN6) |       \
1039
                                     PIN_LOCKR_DISABLED(GPIOE_PIN7) |       \
1040
                                     PIN_LOCKR_DISABLED(GPIOE_PIN8) |       \
1041
                                     PIN_LOCKR_DISABLED(GPIOE_PIN9) |       \
1042
                                     PIN_LOCKR_DISABLED(GPIOE_PIN10) |      \
1043
                                     PIN_LOCKR_DISABLED(GPIOE_PIN11) |      \
1044
                                     PIN_LOCKR_DISABLED(GPIOE_PIN12) |      \
1045
                                     PIN_LOCKR_DISABLED(GPIOE_PIN13) |      \
1046
                                     PIN_LOCKR_DISABLED(GPIOE_PIN14) |      \
1047
                                     PIN_LOCKR_DISABLED(GPIOE_PIN15))
1048
1049
/*
1050
 * GPIOF setup:
1051
 *
1052
 * PF0  - PIN0                      (analog).
1053
 * PF1  - PIN1                      (analog).
1054
 * PF2  - PIN2                      (analog).
1055
 * PF3  - PIN3                      (analog).
1056
 * PF4  - PIN4                      (analog).
1057
 * PF5  - PIN5                      (analog).
1058
 * PF6  - PIN6                      (analog).
1059
 * PF7  - PIN7                      (analog).
1060
 * PF8  - PIN8                      (analog).
1061
 * PF9  - PIN9                      (analog).
1062
 * PF10 - PIN10                     (analog).
1063
 * PF11 - PIN11                     (analog).
1064
 * PF12 - PIN12                     (analog).
1065
 * PF13 - PIN13                     (analog).
1066
 * PF14 - PIN14                     (analog).
1067
 * PF15 - PIN15                     (analog).
1068
 */
1069
#define VAL_GPIOF_MODER             (PIN_MODE_ANALOG(GPIOF_PIN0) |          \
1070
                                     PIN_MODE_ANALOG(GPIOF_PIN1) |          \
1071
                                     PIN_MODE_ANALOG(GPIOF_PIN2) |          \
1072
                                     PIN_MODE_ANALOG(GPIOF_PIN3) |          \
1073
                                     PIN_MODE_ANALOG(GPIOF_PIN4) |          \
1074
                                     PIN_MODE_ANALOG(GPIOF_PIN5) |          \
1075
                                     PIN_MODE_ANALOG(GPIOF_PIN6) |          \
1076
                                     PIN_MODE_ANALOG(GPIOF_PIN7) |          \
1077
                                     PIN_MODE_ANALOG(GPIOF_PIN8) |          \
1078
                                     PIN_MODE_ANALOG(GPIOF_PIN9) |          \
1079
                                     PIN_MODE_ANALOG(GPIOF_PIN10) |         \
1080
                                     PIN_MODE_ANALOG(GPIOF_PIN11) |         \
1081
                                     PIN_MODE_ANALOG(GPIOF_PIN12) |         \
1082
                                     PIN_MODE_ANALOG(GPIOF_PIN13) |         \
1083
                                     PIN_MODE_ANALOG(GPIOF_PIN14) |         \
1084
                                     PIN_MODE_ANALOG(GPIOF_PIN15))
1085
#define VAL_GPIOF_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) |       \
1086
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN1) |       \
1087
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN2) |       \
1088
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN3) |       \
1089
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN4) |       \
1090
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN5) |       \
1091
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN6) |       \
1092
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN7) |       \
1093
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN8) |       \
1094
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN9) |       \
1095
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN10) |      \
1096
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN11) |      \
1097
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN12) |      \
1098
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN13) |      \
1099
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN14) |      \
1100
                                     PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
1101
#define VAL_GPIOF_OSPEEDR           (PIN_OSPEED_HIGH(GPIOF_PIN0) |          \
1102
                                     PIN_OSPEED_HIGH(GPIOF_PIN1) |          \
1103
                                     PIN_OSPEED_HIGH(GPIOF_PIN2) |          \
1104
                                     PIN_OSPEED_HIGH(GPIOF_PIN3) |          \
1105
                                     PIN_OSPEED_HIGH(GPIOF_PIN4) |          \
1106
                                     PIN_OSPEED_HIGH(GPIOF_PIN5) |          \
1107
                                     PIN_OSPEED_HIGH(GPIOF_PIN6) |          \
1108
                                     PIN_OSPEED_HIGH(GPIOF_PIN7) |          \
1109
                                     PIN_OSPEED_HIGH(GPIOF_PIN8) |          \
1110
                                     PIN_OSPEED_HIGH(GPIOF_PIN9) |          \
1111
                                     PIN_OSPEED_HIGH(GPIOF_PIN10) |         \
1112
                                     PIN_OSPEED_HIGH(GPIOF_PIN11) |         \
1113
                                     PIN_OSPEED_HIGH(GPIOF_PIN12) |         \
1114
                                     PIN_OSPEED_HIGH(GPIOF_PIN13) |         \
1115
                                     PIN_OSPEED_HIGH(GPIOF_PIN14) |         \
1116
                                     PIN_OSPEED_HIGH(GPIOF_PIN15))
1117
#define VAL_GPIOF_PUPDR             (PIN_PUPDR_FLOATING(GPIOF_PIN0) |       \
1118
                                     PIN_PUPDR_FLOATING(GPIOF_PIN1) |       \
1119
                                     PIN_PUPDR_FLOATING(GPIOF_PIN2) |       \
1120
                                     PIN_PUPDR_FLOATING(GPIOF_PIN3) |       \
1121
                                     PIN_PUPDR_FLOATING(GPIOF_PIN4) |       \
1122
                                     PIN_PUPDR_FLOATING(GPIOF_PIN5) |       \
1123
                                     PIN_PUPDR_FLOATING(GPIOF_PIN6) |       \
1124
                                     PIN_PUPDR_FLOATING(GPIOF_PIN7) |       \
1125
                                     PIN_PUPDR_FLOATING(GPIOF_PIN8) |       \
1126
                                     PIN_PUPDR_FLOATING(GPIOF_PIN9) |       \
1127
                                     PIN_PUPDR_FLOATING(GPIOF_PIN10) |      \
1128
                                     PIN_PUPDR_FLOATING(GPIOF_PIN11) |      \
1129
                                     PIN_PUPDR_FLOATING(GPIOF_PIN12) |      \
1130
                                     PIN_PUPDR_FLOATING(GPIOF_PIN13) |      \
1131
                                     PIN_PUPDR_FLOATING(GPIOF_PIN14) |      \
1132
                                     PIN_PUPDR_FLOATING(GPIOF_PIN15))
1133
#define VAL_GPIOF_ODR               (PIN_ODR_HIGH(GPIOF_PIN0) |             \
1134
                                     PIN_ODR_HIGH(GPIOF_PIN1) |             \
1135
                                     PIN_ODR_HIGH(GPIOF_PIN2) |             \
1136
                                     PIN_ODR_HIGH(GPIOF_PIN3) |             \
1137
                                     PIN_ODR_HIGH(GPIOF_PIN4) |             \
1138
                                     PIN_ODR_HIGH(GPIOF_PIN5) |             \
1139
                                     PIN_ODR_HIGH(GPIOF_PIN6) |             \
1140
                                     PIN_ODR_HIGH(GPIOF_PIN7) |             \
1141
                                     PIN_ODR_HIGH(GPIOF_PIN8) |             \
1142
                                     PIN_ODR_HIGH(GPIOF_PIN9) |             \
1143
                                     PIN_ODR_HIGH(GPIOF_PIN10) |            \
1144
                                     PIN_ODR_HIGH(GPIOF_PIN11) |            \
1145
                                     PIN_ODR_HIGH(GPIOF_PIN12) |            \
1146
                                     PIN_ODR_HIGH(GPIOF_PIN13) |            \
1147
                                     PIN_ODR_HIGH(GPIOF_PIN14) |            \
1148
                                     PIN_ODR_HIGH(GPIOF_PIN15))
1149
#define VAL_GPIOF_AFRL              (PIN_AFIO_AF(GPIOF_PIN0, 0U) |          \
1150
                                     PIN_AFIO_AF(GPIOF_PIN1, 0U) |          \
1151
                                     PIN_AFIO_AF(GPIOF_PIN2, 0U) |          \
1152
                                     PIN_AFIO_AF(GPIOF_PIN3, 0U) |          \
1153
                                     PIN_AFIO_AF(GPIOF_PIN4, 0U) |          \
1154
                                     PIN_AFIO_AF(GPIOF_PIN5, 0U) |          \
1155
                                     PIN_AFIO_AF(GPIOF_PIN6, 0U) |          \
1156
                                     PIN_AFIO_AF(GPIOF_PIN7, 0U))
1157
#define VAL_GPIOF_AFRH              (PIN_AFIO_AF(GPIOF_PIN8, 0U) |          \
1158
                                     PIN_AFIO_AF(GPIOF_PIN9, 0U) |          \
1159
                                     PIN_AFIO_AF(GPIOF_PIN10, 0U) |         \
1160
                                     PIN_AFIO_AF(GPIOF_PIN11, 0U) |         \
1161
                                     PIN_AFIO_AF(GPIOF_PIN12, 0U) |         \
1162
                                     PIN_AFIO_AF(GPIOF_PIN13, 0U) |         \
1163
                                     PIN_AFIO_AF(GPIOF_PIN14, 0U) |         \
1164
                                     PIN_AFIO_AF(GPIOF_PIN15, 0U))
1165
#define VAL_GPIOF_ASCR              (PIN_ASCR_DISABLED(GPIOF_PIN0) |        \
1166
                                     PIN_ASCR_DISABLED(GPIOF_PIN1) |        \
1167
                                     PIN_ASCR_DISABLED(GPIOF_PIN2) |        \
1168
                                     PIN_ASCR_DISABLED(GPIOF_PIN3) |        \
1169
                                     PIN_ASCR_DISABLED(GPIOF_PIN4) |        \
1170
                                     PIN_ASCR_DISABLED(GPIOF_PIN5) |        \
1171
                                     PIN_ASCR_DISABLED(GPIOF_PIN6) |        \
1172
                                     PIN_ASCR_DISABLED(GPIOF_PIN7) |        \
1173
                                     PIN_ASCR_DISABLED(GPIOF_PIN8) |        \
1174
                                     PIN_ASCR_DISABLED(GPIOF_PIN9) |        \
1175
                                     PIN_ASCR_DISABLED(GPIOF_PIN10) |       \
1176
                                     PIN_ASCR_DISABLED(GPIOF_PIN11) |       \
1177
                                     PIN_ASCR_DISABLED(GPIOF_PIN12) |       \
1178
                                     PIN_ASCR_DISABLED(GPIOF_PIN13) |       \
1179
                                     PIN_ASCR_DISABLED(GPIOF_PIN14) |       \
1180
                                     PIN_ASCR_DISABLED(GPIOF_PIN15))
1181
#define VAL_GPIOF_LOCKR             (PIN_LOCKR_DISABLED(GPIOF_PIN0) |       \
1182
                                     PIN_LOCKR_DISABLED(GPIOF_PIN1) |       \
1183
                                     PIN_LOCKR_DISABLED(GPIOF_PIN2) |       \
1184
                                     PIN_LOCKR_DISABLED(GPIOF_PIN3) |       \
1185
                                     PIN_LOCKR_DISABLED(GPIOF_PIN4) |       \
1186
                                     PIN_LOCKR_DISABLED(GPIOF_PIN5) |       \
1187
                                     PIN_LOCKR_DISABLED(GPIOF_PIN6) |       \
1188
                                     PIN_LOCKR_DISABLED(GPIOF_PIN7) |       \
1189
                                     PIN_LOCKR_DISABLED(GPIOF_PIN8) |       \
1190
                                     PIN_LOCKR_DISABLED(GPIOF_PIN9) |       \
1191
                                     PIN_LOCKR_DISABLED(GPIOF_PIN10) |      \
1192
                                     PIN_LOCKR_DISABLED(GPIOF_PIN11) |      \
1193
                                     PIN_LOCKR_DISABLED(GPIOF_PIN12) |      \
1194
                                     PIN_LOCKR_DISABLED(GPIOF_PIN13) |      \
1195
                                     PIN_LOCKR_DISABLED(GPIOF_PIN14) |      \
1196
                                     PIN_LOCKR_DISABLED(GPIOF_PIN15))
1197
1198
/*
1199
 * GPIOG setup:
1200
 *
1201
 * PG0  - PIN0                      (analog).
1202
 * PG1  - PIN1                      (analog).
1203
 * PG2  - PIN2                      (analog).
1204
 * PG3  - PIN3                      (analog).
1205
 * PG4  - PIN4                      (analog).
1206
 * PG5  - PIN5                      (analog).
1207
 * PG6  - PIN6                      (analog).
1208
 * PG7  - PIN7                      (analog).
1209
 * PG8  - PIN8                      (analog).
1210
 * PG9  - PIN9                      (analog).
1211
 * PG10 - PIN10                     (analog).
1212
 * PG11 - PIN11                     (analog).
1213
 * PG12 - PIN12                     (analog).
1214
 * PG13 - PIN13                     (analog).
1215
 * PG14 - PIN14                     (analog).
1216
 * PG15 - PIN15                     (analog).
1217
 */
1218
#define VAL_GPIOG_MODER             (PIN_MODE_ANALOG(GPIOG_PIN0) |          \
1219
                                     PIN_MODE_ANALOG(GPIOG_PIN1) |          \
1220
                                     PIN_MODE_ANALOG(GPIOG_PIN2) |          \
1221
                                     PIN_MODE_ANALOG(GPIOG_PIN3) |          \
1222
                                     PIN_MODE_ANALOG(GPIOG_PIN4) |          \
1223
                                     PIN_MODE_ANALOG(GPIOG_PIN5) |          \
1224
                                     PIN_MODE_ANALOG(GPIOG_PIN6) |          \
1225
                                     PIN_MODE_ANALOG(GPIOG_PIN7) |          \
1226
                                     PIN_MODE_ANALOG(GPIOG_PIN8) |          \
1227
                                     PIN_MODE_ANALOG(GPIOG_PIN9) |          \
1228
                                     PIN_MODE_ANALOG(GPIOG_PIN10) |         \
1229
                                     PIN_MODE_ANALOG(GPIOG_PIN11) |         \
1230
                                     PIN_MODE_ANALOG(GPIOG_PIN12) |         \
1231
                                     PIN_MODE_ANALOG(GPIOG_PIN13) |         \
1232
                                     PIN_MODE_ANALOG(GPIOG_PIN14) |         \
1233
                                     PIN_MODE_ANALOG(GPIOG_PIN15))
1234
#define VAL_GPIOG_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) |       \
1235
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN1) |       \
1236
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN2) |       \
1237
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN3) |       \
1238
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN4) |       \
1239
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN5) |       \
1240
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN6) |       \
1241
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN7) |       \
1242
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN8) |       \
1243
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN9) |       \
1244
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN10) |      \
1245
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN11) |      \
1246
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN12) |      \
1247
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN13) |      \
1248
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN14) |      \
1249
                                     PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1250
#define VAL_GPIOG_OSPEEDR           (PIN_OSPEED_VERYLOW(GPIOG_PIN0) |       \
1251
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN1) |       \
1252
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN2) |       \
1253
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN3) |       \
1254
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN4) |       \
1255
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN5) |       \
1256
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN6) |       \
1257
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN7) |       \
1258
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN8) |       \
1259
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN9) |       \
1260
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN10) |      \
1261
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN11) |      \
1262
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN12) |      \
1263
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN13) |      \
1264
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN14) |      \
1265
                                     PIN_OSPEED_VERYLOW(GPIOG_PIN15))
1266
#define VAL_GPIOG_PUPDR             (PIN_PUPDR_FLOATING(GPIOG_PIN0) |       \
1267
                                     PIN_PUPDR_FLOATING(GPIOG_PIN1) |       \
1268
                                     PIN_PUPDR_FLOATING(GPIOG_PIN2) |       \
1269
                                     PIN_PUPDR_FLOATING(GPIOG_PIN3) |       \
1270
                                     PIN_PUPDR_FLOATING(GPIOG_PIN4) |       \
1271
                                     PIN_PUPDR_FLOATING(GPIOG_PIN5) |       \
1272
                                     PIN_PUPDR_FLOATING(GPIOG_PIN6) |       \
1273
                                     PIN_PUPDR_FLOATING(GPIOG_PIN7) |       \
1274
                                     PIN_PUPDR_FLOATING(GPIOG_PIN8) |       \
1275
                                     PIN_PUPDR_FLOATING(GPIOG_PIN9) |       \
1276
                                     PIN_PUPDR_FLOATING(GPIOG_PIN10) |      \
1277
                                     PIN_PUPDR_FLOATING(GPIOG_PIN11) |      \
1278
                                     PIN_PUPDR_FLOATING(GPIOG_PIN12) |      \
1279
                                     PIN_PUPDR_FLOATING(GPIOG_PIN13) |      \
1280
                                     PIN_PUPDR_FLOATING(GPIOG_PIN14) |      \
1281
                                     PIN_PUPDR_FLOATING(GPIOG_PIN15))
1282
#define VAL_GPIOG_ODR               (PIN_ODR_HIGH(GPIOG_PIN0) |             \
1283
                                     PIN_ODR_HIGH(GPIOG_PIN1) |             \
1284
                                     PIN_ODR_HIGH(GPIOG_PIN2) |             \
1285
                                     PIN_ODR_HIGH(GPIOG_PIN3) |             \
1286
                                     PIN_ODR_HIGH(GPIOG_PIN4) |             \
1287
                                     PIN_ODR_HIGH(GPIOG_PIN5) |             \
1288
                                     PIN_ODR_HIGH(GPIOG_PIN6) |             \
1289
                                     PIN_ODR_HIGH(GPIOG_PIN7) |             \
1290
                                     PIN_ODR_HIGH(GPIOG_PIN8) |             \
1291
                                     PIN_ODR_HIGH(GPIOG_PIN9) |             \
1292
                                     PIN_ODR_HIGH(GPIOG_PIN10) |            \
1293
                                     PIN_ODR_HIGH(GPIOG_PIN11) |            \
1294
                                     PIN_ODR_HIGH(GPIOG_PIN12) |            \
1295
                                     PIN_ODR_HIGH(GPIOG_PIN13) |            \
1296
                                     PIN_ODR_HIGH(GPIOG_PIN14) |            \
1297
                                     PIN_ODR_HIGH(GPIOG_PIN15))
1298
#define VAL_GPIOG_AFRL              (PIN_AFIO_AF(GPIOG_PIN0, 0U) |          \
1299
                                     PIN_AFIO_AF(GPIOG_PIN1, 0U) |          \
1300
                                     PIN_AFIO_AF(GPIOG_PIN2, 0U) |          \
1301
                                     PIN_AFIO_AF(GPIOG_PIN3, 0U) |          \
1302
                                     PIN_AFIO_AF(GPIOG_PIN4, 0U) |          \
1303
                                     PIN_AFIO_AF(GPIOG_PIN5, 0U) |          \
1304
                                     PIN_AFIO_AF(GPIOG_PIN6, 0U) |          \
1305
                                     PIN_AFIO_AF(GPIOG_PIN7, 0U))
1306
#define VAL_GPIOG_AFRH              (PIN_AFIO_AF(GPIOG_PIN8, 0U) |          \
1307
                                     PIN_AFIO_AF(GPIOG_PIN9, 0U) |          \
1308
                                     PIN_AFIO_AF(GPIOG_PIN10, 0U) |         \
1309
                                     PIN_AFIO_AF(GPIOG_PIN11, 0U) |         \
1310
                                     PIN_AFIO_AF(GPIOG_PIN12, 0U) |         \
1311
                                     PIN_AFIO_AF(GPIOG_PIN13, 0U) |         \
1312
                                     PIN_AFIO_AF(GPIOG_PIN14, 0U) |         \
1313
                                     PIN_AFIO_AF(GPIOG_PIN15, 0U))
1314
#define VAL_GPIOG_ASCR              (PIN_ASCR_DISABLED(GPIOG_PIN0) |        \
1315
                                     PIN_ASCR_DISABLED(GPIOG_PIN1) |        \
1316
                                     PIN_ASCR_DISABLED(GPIOG_PIN2) |        \
1317
                                     PIN_ASCR_DISABLED(GPIOG_PIN3) |        \
1318
                                     PIN_ASCR_DISABLED(GPIOG_PIN4) |        \
1319
                                     PIN_ASCR_DISABLED(GPIOG_PIN5) |        \
1320
                                     PIN_ASCR_DISABLED(GPIOG_PIN6) |        \
1321
                                     PIN_ASCR_DISABLED(GPIOG_PIN7) |        \
1322
                                     PIN_ASCR_DISABLED(GPIOG_PIN8) |        \
1323
                                     PIN_ASCR_DISABLED(GPIOG_PIN9) |        \
1324
                                     PIN_ASCR_DISABLED(GPIOG_PIN10) |       \
1325
                                     PIN_ASCR_DISABLED(GPIOG_PIN11) |       \
1326
                                     PIN_ASCR_DISABLED(GPIOG_PIN12) |       \
1327
                                     PIN_ASCR_DISABLED(GPIOG_PIN13) |       \
1328
                                     PIN_ASCR_DISABLED(GPIOG_PIN14) |       \
1329
                                     PIN_ASCR_DISABLED(GPIOG_PIN15))
1330
#define VAL_GPIOG_LOCKR             (PIN_LOCKR_DISABLED(GPIOG_PIN0) |       \
1331
                                     PIN_LOCKR_DISABLED(GPIOG_PIN1) |       \
1332
                                     PIN_LOCKR_DISABLED(GPIOG_PIN2) |       \
1333
                                     PIN_LOCKR_DISABLED(GPIOG_PIN3) |       \
1334
                                     PIN_LOCKR_DISABLED(GPIOG_PIN4) |       \
1335
                                     PIN_LOCKR_DISABLED(GPIOG_PIN5) |       \
1336
                                     PIN_LOCKR_DISABLED(GPIOG_PIN6) |       \
1337
                                     PIN_LOCKR_DISABLED(GPIOG_PIN7) |       \
1338
                                     PIN_LOCKR_DISABLED(GPIOG_PIN8) |       \
1339
                                     PIN_LOCKR_DISABLED(GPIOG_PIN9) |       \
1340
                                     PIN_LOCKR_DISABLED(GPIOG_PIN10) |      \
1341
                                     PIN_LOCKR_DISABLED(GPIOG_PIN11) |      \
1342
                                     PIN_LOCKR_DISABLED(GPIOG_PIN12) |      \
1343
                                     PIN_LOCKR_DISABLED(GPIOG_PIN13) |      \
1344
                                     PIN_LOCKR_DISABLED(GPIOG_PIN14) |      \
1345
                                     PIN_LOCKR_DISABLED(GPIOG_PIN15))
1346
1347
/*
1348
 * GPIOH setup:
1349
 *
1350
 * PH0  - OSC_IN                    (input floating).
1351
 * PH1  - OSC_OUT                   (input floating).
1352
 * PH2  - PIN2                      (analog).
1353
 * PH3  - PIN3                      (analog).
1354
 * PH4  - PIN4                      (analog).
1355
 * PH5  - PIN5                      (analog).
1356
 * PH6  - PIN6                      (analog).
1357
 * PH7  - PIN7                      (analog).
1358
 * PH8  - PIN8                      (analog).
1359
 * PH9  - PIN9                      (analog).
1360
 * PH10 - PIN10                     (analog).
1361
 * PH11 - PIN11                     (analog).
1362
 * PH12 - PIN12                     (analog).
1363
 * PH13 - PIN13                     (analog).
1364
 * PH14 - PIN14                     (analog).
1365
 * PH15 - PIN15                     (analog).
1366
 */
1367
#define VAL_GPIOH_MODER             (PIN_MODE_INPUT(GPIOH_OSC_IN) |         \
1368
                                     PIN_MODE_INPUT(GPIOH_OSC_OUT) |        \
1369
                                     PIN_MODE_ANALOG(GPIOH_PIN2) |          \
1370
                                     PIN_MODE_ANALOG(GPIOH_PIN3) |          \
1371
                                     PIN_MODE_ANALOG(GPIOH_PIN4) |          \
1372
                                     PIN_MODE_ANALOG(GPIOH_PIN5) |          \
1373
                                     PIN_MODE_ANALOG(GPIOH_PIN6) |          \
1374
                                     PIN_MODE_ANALOG(GPIOH_PIN7) |          \
1375
                                     PIN_MODE_ANALOG(GPIOH_PIN8) |          \
1376
                                     PIN_MODE_ANALOG(GPIOH_PIN9) |          \
1377
                                     PIN_MODE_ANALOG(GPIOH_PIN10) |         \
1378
                                     PIN_MODE_ANALOG(GPIOH_PIN11) |         \
1379
                                     PIN_MODE_ANALOG(GPIOH_PIN12) |         \
1380
                                     PIN_MODE_ANALOG(GPIOH_PIN13) |         \
1381
                                     PIN_MODE_ANALOG(GPIOH_PIN14) |         \
1382
                                     PIN_MODE_ANALOG(GPIOH_PIN15))
1383
#define VAL_GPIOH_OTYPER            (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) |     \
1384
                                     PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) |    \
1385
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN2) |       \
1386
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN3) |       \
1387
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN4) |       \
1388
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN5) |       \
1389
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN6) |       \
1390
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN7) |       \
1391
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN8) |       \
1392
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN9) |       \
1393
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN10) |      \
1394
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN11) |      \
1395
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN12) |      \
1396
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN13) |      \
1397
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN14) |      \
1398
                                     PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1399
#define VAL_GPIOH_OSPEEDR           (PIN_OSPEED_HIGH(GPIOH_OSC_IN) |        \
1400
                                     PIN_OSPEED_HIGH(GPIOH_OSC_OUT) |       \
1401
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN2) |       \
1402
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN3) |       \
1403
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN4) |       \
1404
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN5) |       \
1405
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN6) |       \
1406
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN7) |       \
1407
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN8) |       \
1408
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN9) |       \
1409
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN10) |      \
1410
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN11) |      \
1411
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN12) |      \
1412
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN13) |      \
1413
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN14) |      \
1414
                                     PIN_OSPEED_VERYLOW(GPIOH_PIN15))
1415
#define VAL_GPIOH_PUPDR             (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) |     \
1416
                                     PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) |    \
1417
                                     PIN_PUPDR_FLOATING(GPIOH_PIN2) |       \
1418
                                     PIN_PUPDR_FLOATING(GPIOH_PIN3) |       \
1419
                                     PIN_PUPDR_FLOATING(GPIOH_PIN4) |       \
1420
                                     PIN_PUPDR_FLOATING(GPIOH_PIN5) |       \
1421
                                     PIN_PUPDR_FLOATING(GPIOH_PIN6) |       \
1422
                                     PIN_PUPDR_FLOATING(GPIOH_PIN7) |       \
1423
                                     PIN_PUPDR_FLOATING(GPIOH_PIN8) |       \
1424
                                     PIN_PUPDR_FLOATING(GPIOH_PIN9) |       \
1425
                                     PIN_PUPDR_FLOATING(GPIOH_PIN10) |      \
1426
                                     PIN_PUPDR_FLOATING(GPIOH_PIN11) |      \
1427
                                     PIN_PUPDR_FLOATING(GPIOH_PIN12) |      \
1428
                                     PIN_PUPDR_FLOATING(GPIOH_PIN13) |      \
1429
                                     PIN_PUPDR_FLOATING(GPIOH_PIN14) |      \
1430
                                     PIN_PUPDR_FLOATING(GPIOH_PIN15))
1431
#define VAL_GPIOH_ODR               (PIN_ODR_HIGH(GPIOH_OSC_IN) |           \
1432
                                     PIN_ODR_HIGH(GPIOH_OSC_OUT) |          \
1433
                                     PIN_ODR_HIGH(GPIOH_PIN2) |             \
1434
                                     PIN_ODR_HIGH(GPIOH_PIN3) |             \
1435
                                     PIN_ODR_HIGH(GPIOH_PIN4) |             \
1436
                                     PIN_ODR_HIGH(GPIOH_PIN5) |             \
1437
                                     PIN_ODR_HIGH(GPIOH_PIN6) |             \
1438
                                     PIN_ODR_HIGH(GPIOH_PIN7) |             \
1439
                                     PIN_ODR_HIGH(GPIOH_PIN8) |             \
1440
                                     PIN_ODR_HIGH(GPIOH_PIN9) |             \
1441
                                     PIN_ODR_HIGH(GPIOH_PIN10) |            \
1442
                                     PIN_ODR_HIGH(GPIOH_PIN11) |            \
1443
                                     PIN_ODR_HIGH(GPIOH_PIN12) |            \
1444
                                     PIN_ODR_HIGH(GPIOH_PIN13) |            \
1445
                                     PIN_ODR_HIGH(GPIOH_PIN14) |            \
1446
                                     PIN_ODR_HIGH(GPIOH_PIN15))
1447
#define VAL_GPIOH_AFRL              (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) |        \
1448
                                     PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) |       \
1449
                                     PIN_AFIO_AF(GPIOH_PIN2, 0U) |          \
1450
                                     PIN_AFIO_AF(GPIOH_PIN3, 0U) |          \
1451
                                     PIN_AFIO_AF(GPIOH_PIN4, 0U) |          \
1452
                                     PIN_AFIO_AF(GPIOH_PIN5, 0U) |          \
1453
                                     PIN_AFIO_AF(GPIOH_PIN6, 0U) |          \
1454
                                     PIN_AFIO_AF(GPIOH_PIN7, 0U))
1455
#define VAL_GPIOH_AFRH              (PIN_AFIO_AF(GPIOH_PIN8, 0U) |          \
1456
                                     PIN_AFIO_AF(GPIOH_PIN9, 0U) |          \
1457
                                     PIN_AFIO_AF(GPIOH_PIN10, 0U) |         \
1458
                                     PIN_AFIO_AF(GPIOH_PIN11, 0U) |         \
1459
                                     PIN_AFIO_AF(GPIOH_PIN12, 0U) |         \
1460
                                     PIN_AFIO_AF(GPIOH_PIN13, 0U) |         \
1461
                                     PIN_AFIO_AF(GPIOH_PIN14, 0U) |         \
1462
                                     PIN_AFIO_AF(GPIOH_PIN15, 0U))
1463
#define VAL_GPIOH_ASCR              (PIN_ASCR_DISABLED(GPIOH_OSC_IN) |      \
1464
                                     PIN_ASCR_DISABLED(GPIOH_OSC_OUT) |     \
1465
                                     PIN_ASCR_DISABLED(GPIOH_PIN2) |        \
1466
                                     PIN_ASCR_DISABLED(GPIOH_PIN3) |        \
1467
                                     PIN_ASCR_DISABLED(GPIOH_PIN4) |        \
1468
                                     PIN_ASCR_DISABLED(GPIOH_PIN5) |        \
1469
                                     PIN_ASCR_DISABLED(GPIOH_PIN6) |        \
1470
                                     PIN_ASCR_DISABLED(GPIOH_PIN7) |        \
1471
                                     PIN_ASCR_DISABLED(GPIOH_PIN8) |        \
1472
                                     PIN_ASCR_DISABLED(GPIOH_PIN9) |        \
1473
                                     PIN_ASCR_DISABLED(GPIOH_PIN10) |       \
1474
                                     PIN_ASCR_DISABLED(GPIOH_PIN11) |       \
1475
                                     PIN_ASCR_DISABLED(GPIOH_PIN12) |       \
1476
                                     PIN_ASCR_DISABLED(GPIOH_PIN13) |       \
1477
                                     PIN_ASCR_DISABLED(GPIOH_PIN14) |       \
1478
                                     PIN_ASCR_DISABLED(GPIOH_PIN15))
1479
#define VAL_GPIOH_LOCKR             (PIN_LOCKR_DISABLED(GPIOH_OSC_IN) |     \
1480
                                     PIN_LOCKR_DISABLED(GPIOH_OSC_OUT) |    \
1481
                                     PIN_LOCKR_DISABLED(GPIOH_PIN2) |       \
1482
                                     PIN_LOCKR_DISABLED(GPIOH_PIN3) |       \
1483
                                     PIN_LOCKR_DISABLED(GPIOH_PIN4) |       \
1484
                                     PIN_LOCKR_DISABLED(GPIOH_PIN5) |       \
1485
                                     PIN_LOCKR_DISABLED(GPIOH_PIN6) |       \
1486
                                     PIN_LOCKR_DISABLED(GPIOH_PIN7) |       \
1487
                                     PIN_LOCKR_DISABLED(GPIOH_PIN8) |       \
1488
                                     PIN_LOCKR_DISABLED(GPIOH_PIN9) |       \
1489
                                     PIN_LOCKR_DISABLED(GPIOH_PIN10) |      \
1490
                                     PIN_LOCKR_DISABLED(GPIOH_PIN11) |      \
1491
                                     PIN_LOCKR_DISABLED(GPIOH_PIN12) |      \
1492
                                     PIN_LOCKR_DISABLED(GPIOH_PIN13) |      \
1493
                                     PIN_LOCKR_DISABLED(GPIOH_PIN14) |      \
1494
                                     PIN_LOCKR_DISABLED(GPIOH_PIN15))
1495
1496
/*===========================================================================*/
1497
/* External declarations.                                                    */
1498
/*===========================================================================*/
1499
1500
#if !defined(_FROM_ASM_)
1501
#ifdef __cplusplus
1502
extern "C" {
1503
#endif
1504
  void boardInit(void);
1505
#ifdef __cplusplus
1506
}
1507
#endif
1508
#endif /* _FROM_ASM_ */
1509
1510
#endif /* BOARD_H */