Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / NUCLEO-L476RG / board.h @ 849b383a

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