Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / STM32L476RG-NUCLEO64 / board.h @ ae448fac

History | View | Annotate | Download (96.6 KB)

1
/*
2
    ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3

4
    Licensed under the Apache License, Version 2.0 (the "License");
5
    you may not use this file except in compliance with the License.
6
    You may obtain a copy of the License at
7

8
        http://www.apache.org/licenses/LICENSE-2.0
9

10
    Unless required by applicable law or agreed to in writing, software
11
    distributed under the License is distributed on an "AS IS" BASIS,
12
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
    See the License for the specific language governing permissions and
14
    limitations under the License.
15
*/
16

    
17
/*
18
 * This file has been automatically generated using ChibiStudio board
19
 * generator plugin. Do not edit manually.
20
 */
21

    
22
#ifndef BOARD_H
23
#define BOARD_H
24

    
25
/*===========================================================================*/
26
/* Driver constants.                                                         */
27
/*===========================================================================*/
28

    
29
/*
30
 * Setup for STMicroelectronics STM32 Nucleo64-L476RG board.
31
 */
32

    
33
/*
34
 * Board identifier.
35
 */
36
#define BOARD_ST_NUCLEO64_L476RG
37
#define BOARD_NAME                  "STMicroelectronics STM32 Nucleo64-L476RG"
38
#define BOARD_VERSION           "1.0"
39

    
40
/*
41
 * Board oscillators-related settings.
42
 */
43
#if !defined(STM32_LSECLK)
44
#define STM32_LSECLK                32768U
45
#endif
46

    
47
#define STM32_LSEDRV                (3U << 3U)
48

    
49
#if !defined(STM32_HSECLK)
50
#define STM32_HSECLK                8000000U
51
#endif
52

    
53
#define STM32_HSE_BYPASS
54

    
55
/*
56
 * Board voltages.
57
 * Required for performance limits calculation.
58
 */
59
#define STM32_VDD                   300U
60

    
61
/*
62
 * MCU type as defined in the ST header.
63
 */
64
#define STM32L476xx
65

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

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

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

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

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

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

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

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

    
215
/*
216
 * IO lines assignments.
217
 */
218
#define LINE_ARD_A0                 PAL_LINE(GPIOA, 0U)
219
#define LINE_ACD12_IN5              PAL_LINE(GPIOA, 0U)
220
#define LINE_ARD_A1                 PAL_LINE(GPIOA, 1U)
221
#define LINE_ACD12_IN6              PAL_LINE(GPIOA, 1U)
222
#define LINE_ARD_D1                 PAL_LINE(GPIOA, 2U)
223
#define LINE_USART2_TX              PAL_LINE(GPIOA, 2U)
224
#define LINE_ARD_D0                 PAL_LINE(GPIOA, 3U)
225
#define LINE_USART2_RX              PAL_LINE(GPIOA, 3U)
226
#define LINE_ARD_A2                 PAL_LINE(GPIOA, 4U)
227
#define LINE_ACD12_IN9              PAL_LINE(GPIOA, 4U)
228
#define LINE_ARD_D13                PAL_LINE(GPIOA, 5U)
229
#define LINE_LED_GREEN              PAL_LINE(GPIOA, 5U)
230
#define LINE_ARD_D12                PAL_LINE(GPIOA, 6U)
231
#define LINE_ARD_D11                PAL_LINE(GPIOA, 7U)
232
#define LINE_ARD_D7                 PAL_LINE(GPIOA, 8U)
233
#define LINE_ARD_D8                 PAL_LINE(GPIOA, 9U)
234
#define LINE_ARD_D2                 PAL_LINE(GPIOA, 10U)
235
#define LINE_SWDIO                  PAL_LINE(GPIOA, 13U)
236
#define LINE_SWCLK                  PAL_LINE(GPIOA, 14U)
237
#define LINE_ARD_A3                 PAL_LINE(GPIOB, 0U)
238
#define LINE_ACD12_IN15             PAL_LINE(GPIOB, 0U)
239
#define LINE_ARD_D3                 PAL_LINE(GPIOB, 3U)
240
#define LINE_SWO                    PAL_LINE(GPIOB, 3U)
241
#define LINE_ARD_D5                 PAL_LINE(GPIOB, 4U)
242
#define LINE_ARD_D4                 PAL_LINE(GPIOB, 5U)
243
#define LINE_ARD_D10                PAL_LINE(GPIOB, 6U)
244
#define LINE_ARD_D15                PAL_LINE(GPIOB, 8U)
245
#define LINE_ARD_D14                PAL_LINE(GPIOB, 9U)
246
#define LINE_ARD_D6                 PAL_LINE(GPIOB, 10U)
247
#define LINE_ARD_A5                 PAL_LINE(GPIOC, 0U)
248
#define LINE_ACD123_IN1             PAL_LINE(GPIOC, 0U)
249
#define LINE_ARD_A4                 PAL_LINE(GPIOC, 1U)
250
#define LINE_ACD123_IN2             PAL_LINE(GPIOC, 1U)
251
#define LINE_ARD_D9                 PAL_LINE(GPIOC, 7U)
252
#define LINE_BUTTON                 PAL_LINE(GPIOC, 13U)
253
#define LINE_OSC32_IN               PAL_LINE(GPIOC, 14U)
254
#define LINE_OSC32_OUT              PAL_LINE(GPIOC, 15U)
255
#define LINE_OSC_IN                 PAL_LINE(GPIOH, 0U)
256
#define LINE_OSC_OUT                PAL_LINE(GPIOH, 1U)
257

    
258
/*===========================================================================*/
259
/* Driver pre-compile time settings.                                         */
260
/*===========================================================================*/
261

    
262
/*===========================================================================*/
263
/* Derived constants and error checks.                                       */
264
/*===========================================================================*/
265

    
266
/*===========================================================================*/
267
/* Driver data structures and types.                                         */
268
/*===========================================================================*/
269

    
270
/*===========================================================================*/
271
/* Driver macros.                                                            */
272
/*===========================================================================*/
273

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

    
300
/*
301
 * GPIOA setup:
302
 *
303
 * PA0  - ARD_A0 ACD12_IN5          (analog).
304
 * PA1  - ARD_A1 ACD12_IN6          (analog).
305
 * PA2  - ARD_D1 USART2_TX          (alternate 7).
306
 * PA3  - ARD_D0 USART2_RX          (alternate 7).
307
 * PA4  - ARD_A2 ACD12_IN9          (analog).
308
 * PA5  - ARD_D13 LED_GREEN         (output pushpull maximum).
309
 * PA6  - ARD_D12                   (analog).
310
 * PA7  - ARD_D11                   (analog).
311
 * PA8  - ARD_D7                    (analog).
312
 * PA9  - ARD_D8                    (analog).
313
 * PA10 - ARD_D2                    (analog).
314
 * PA11 - PIN11                     (analog).
315
 * PA12 - PIN12                     (analog).
316
 * PA13 - SWDIO                     (alternate 0).
317
 * PA14 - SWCLK                     (alternate 0).
318
 * PA15 - PIN15                     (analog).
319