amiro-os / modules / LightRing_1-0 / board.h @ 8cbe3240
History | View | Annotate | Download (39.849 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
/**
|
20 |
* @file
|
21 |
* @brief LightRing v1.0 Board specific macros.
|
22 |
*
|
23 |
* @addtogroup lightring_board
|
24 |
* @{
|
25 |
*/
|
26 |
|
27 |
#ifndef BOARD_H
|
28 |
#define BOARD_H
|
29 |
|
30 |
/*
|
31 |
* Setup for AMiRo LightRing v1.0 board.
|
32 |
*/
|
33 |
|
34 |
/*
|
35 |
* Board identifier.
|
36 |
*/
|
37 |
#define BOARD_LIGHTRING_1_0
|
38 |
#define BOARD_NAME "AMiRo LightRing v1.0" |
39 |
|
40 |
/*
|
41 |
* Board oscillators-related settings.
|
42 |
* NOTE: LSE not fitted.
|
43 |
*/
|
44 |
#if !defined(STM32_LSECLK)
|
45 |
#define STM32_LSECLK 0U |
46 |
#endif
|
47 |
|
48 |
#if !defined(STM32_HSECLK)
|
49 |
#define STM32_HSECLK 8000000U |
50 |
#endif
|
51 |
|
52 |
/*
|
53 |
* Board voltages.
|
54 |
* Required for performance limits calculation.
|
55 |
*/
|
56 |
#define STM32_VDD 330U |
57 |
|
58 |
/*
|
59 |
* MCU type as defined in the ST header.
|
60 |
*/
|
61 |
#define STM32F103xE
|
62 |
|
63 |
/*
|
64 |
* IO pins assignments.
|
65 |
*/
|
66 |
#define GPIOA_PIN0 0U |
67 |
#define GPIOA_PIN1 1U |
68 |
#define GPIOA_LASER_RX 2U |
69 |
#define GPIOA_LASER_TX 3U |
70 |
#define GPIOA_LIGHT_BLANK 4U |
71 |
#define GPIOA_LIGHT_SCLK 5U |
72 |
#define GPIOA_PIN6 6U |
73 |
#define GPIOA_LIGHT_MOSI 7U |
74 |
#define GPIOA_PIN8 8U |
75 |
#define GPIOA_PROG_RX 9U |
76 |
#define GPIOA_PROG_TX 10U |
77 |
#define GPIOA_CAN_RX 11U |
78 |
#define GPIOA_CAN_TX 12U |
79 |
#define GPIOA_SWDIO 13U |
80 |
#define GPIOA_SWCLK 14U |
81 |
#define GPIOA_PIN15 15U |
82 |
|
83 |
#define GPIOB_PIN0 0U |
84 |
#define GPIOB_PIN1 1U |
85 |
#define GPIOB_LASER_EN 2U |
86 |
#define GPIOB_PIN3 3U |
87 |
#define GPIOB_PIN4 4U |
88 |
#define GPIOB_LASER_OC_N 5U |
89 |
#define GPIOB_SYS_UART_DN 6U |
90 |
#define GPIOB_PIN7 7U |
91 |
#define GPIOB_WL_GDO2 8U |
92 |
#define GPIOB_WL_GDO0 9U |
93 |
#define GPIOB_MEM_SCL 10U |
94 |
#define GPIOB_MEM_SDA 11U |
95 |
#define GPIOB_WL_SS_N 12U |
96 |
#define GPIOB_WL_SCLK 13U |
97 |
#define GPIOB_WL_MISO 14U |
98 |
#define GPIOB_WL_MOSI 15U |
99 |
|
100 |
#define GPIOC_PIN0 0U |
101 |
#define GPIOC_PIN1 1U |
102 |
#define GPIOC_PIN2 2U |
103 |
#define GPIOC_PIN3 3U |
104 |
#define GPIOC_LIGHT_XLAT 4U |
105 |
#define GPIOC_PIN5 5U |
106 |
#define GPIOC_PIN6 6U |
107 |
#define GPIOC_PIN7 7U |
108 |
#define GPIOC_PIN8 8U |
109 |
#define GPIOC_PIN9 9U |
110 |
#define GPIOC_SYS_UART_RX 10U |
111 |
#define GPIOC_SYS_UART_TX 11U |
112 |
#define GPIOC_PIN12 12U |
113 |
#define GPIOC_PIN13 13U |
114 |
#define GPIOC_SYS_PD_N 14U |
115 |
#define GPIOC_PIN15 15U |
116 |
|
117 |
#define GPIOD_OSC_IN 0U |
118 |
#define GPIOD_OSC_OUT 1U |
119 |
#define GPIOD_SYS_INT_N 2U |
120 |
#define GPIOD_PIN3 3U |
121 |
#define GPIOD_PIN4 4U |
122 |
#define GPIOD_PIN5 5U |
123 |
#define GPIOD_PIN6 6U |
124 |
#define GPIOD_PIN7 7U |
125 |
#define GPIOD_PIN8 8U |
126 |
#define GPIOD_PIN9 9U |
127 |
#define GPIOD_PIN10 10U |
128 |
#define GPIOD_PIN11 11U |
129 |
#define GPIOD_PIN12 12U |
130 |
#define GPIOD_PIN13 13U |
131 |
#define GPIOD_PIN14 14U |
132 |
#define GPIOD_PIN15 15U |
133 |
|
134 |
#define GPIOE_PIN0 0U |
135 |
#define GPIOE_PIN1 1U |
136 |
#define GPIOE_PIN2 2U |
137 |
#define GPIOE_PIN3 3U |
138 |
#define GPIOE_PIN4 4U |
139 |
#define GPIOE_PIN5 5U |
140 |
#define GPIOE_PIN6 6U |
141 |
#define GPIOE_PIN7 7U |
142 |
#define GPIOE_PIN8 8U |
143 |
#define GPIOE_PIN9 9U |
144 |
#define GPIOE_PIN10 10U |
145 |
#define GPIOE_PIN11 11U |
146 |
#define GPIOE_PIN12 12U |
147 |
#define GPIOE_PIN13 13U |
148 |
#define GPIOE_PIN14 14U |
149 |
#define GPIOE_PIN15 15U |
150 |
|
151 |
#define GPIOF_PIN0 0U |
152 |
#define GPIOF_PIN1 1U |
153 |
#define GPIOF_PIN2 2U |
154 |
#define GPIOF_PIN3 3U |
155 |
#define GPIOF_PIN4 4U |
156 |
#define GPIOF_PIN5 5U |
157 |
#define GPIOF_PIN6 6U |
158 |
#define GPIOF_PIN7 7U |
159 |
#define GPIOF_PIN8 8U |
160 |
#define GPIOF_PIN9 9U |
161 |
#define GPIOF_PIN10 10U |
162 |
#define GPIOF_PIN11 11U |
163 |
#define GPIOF_PIN12 12U |
164 |
#define GPIOF_PIN13 13U |
165 |
#define GPIOF_PIN14 14U |
166 |
#define GPIOF_PIN15 15U |
167 |
|
168 |
#define GPIOG_PIN0 0U |
169 |
#define GPIOG_PIN1 1U |
170 |
#define GPIOG_PIN2 2U |
171 |
#define GPIOG_PIN3 3U |
172 |
#define GPIOG_PIN4 4U |
173 |
#define GPIOG_PIN5 5U |
174 |
#define GPIOG_PIN6 6U |
175 |
#define GPIOG_PIN7 7U |
176 |
#define GPIOG_PIN8 8U |
177 |
#define GPIOG_PIN9 9U |
178 |
#define GPIOG_PIN10 10U |
179 |
#define GPIOG_PIN11 11U |
180 |
#define GPIOG_PIN12 12U |
181 |
#define GPIOG_PIN13 13U |
182 |
#define GPIOG_PIN14 14U |
183 |
#define GPIOG_PIN15 15U |
184 |
|
185 |
/*
|
186 |
* IO lines assignments.
|
187 |
*/
|
188 |
#define LINE_LASER_RX PAL_LINE(GPIOA, GPIOA_LASER_RX)
|
189 |
#define LINE_LASER_TX PAL_LINE(GPIOA, GPIOA_LASER_TX)
|
190 |
#define LINE_LIGHT_BLANK PAL_LINE(GPIOA, GPIOA_LIGHT_BLANK)
|
191 |
#define LINE_LIGHT_SCLK PAL_LINE(GPIOA, GPIOA_LIGHT_SCLK)
|
192 |
#define LINE_LIGHT_MOSI PAL_LINE(GPIOA, GPIOA_LIGHT_MOSI)
|
193 |
#define LINE_PROG_RX PAL_LINE(GPIOA, GPIOA_PROG_RX)
|
194 |
#define LINE_PROG_TX PAL_LINE(GPIOA, GPIOA_PROG_TX)
|
195 |
#define LINE_CAN_RX PAL_LINE(GPIOA, GPIOA_CAN_RX)
|
196 |
#define LINE_CAN_TX PAL_LINE(GPIOA, GPIOA_CAN_TX)
|
197 |
#define LINE_SWDIO PAL_LINE(GPIOA, GPIOA_SWDIO)
|
198 |
#define LINE_SWCLK PAL_LINE(GPIOA, GPIOA_SWCLK)
|
199 |
|
200 |
#define LINE_LASER_EN PAL_LINE(GPIOB, GPIOB_LASER_EN)
|
201 |
#define LINE_LASER_OC_N PAL_LINE(GPIOB, GPIOB_LASER_OC_N)
|
202 |
#define LINE_SYS_UART_DN PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
|
203 |
#define LINE_WL_GDO2 PAL_LINE(GPIOB, GPIOB_WL_GDO2)
|
204 |
#define LINE_WL_GDO0 PAL_LINE(GPIOB, GPIOB_WL_GDO0)
|
205 |
#define LINE_MEM_SCL PAL_LINE(GPIOB, GPIOB_MEM_SCL)
|
206 |
#define LINE_MEM_SDA PAL_LINE(GPIOB, GPIOB_MEM_SDA)
|
207 |
#define LINE_WL_SS_N PAL_LINE(GPIOB, GPIOB_WL_SS_N)
|
208 |
#define LINE_WL_SCLK PAL_LINE(GPIOB, GPIOB_WL_SCLK)
|
209 |
#define LINE_WL_MISO PAL_LINE(GPIOB, GPIOB_WL_MISO)
|
210 |
#define LINE_WL_MOSI PAL_LINE(GPIOB, GPIOB_WL_MOSI)
|
211 |
|
212 |
#define LINE_LIGHT_XLAT PAL_LINE(GPIOC, GPIOC_LIGHT_XLAT)
|
213 |
#define LINE_SYS_UART_RX PAL_LINE(GPIOC, GPIOC_SYS_UART_RX)
|
214 |
#define LINE_SYS_UART_TX PAL_LINE(GPIOC, GPIOC_SYS_UART_TX)
|
215 |
#define LINE_SYS_PD_N PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
|
216 |
|
217 |
#define LINE_SYS_INT_N PAL_LINE(GPIOD, GPIOD_SYS_INT_N)
|
218 |
|
219 |
/*
|
220 |
* I/O ports initial setup, this configuration is established soon after reset
|
221 |
* in the initialization code.
|
222 |
* Please refer to the STM32 Reference Manual for details.
|
223 |
*/
|
224 |
#define PIN_MODE_INPUT 0U |
225 |
#define PIN_MODE_OUTPUT_2M 2U |
226 |
#define PIN_MODE_OUTPUT_10M 1U |
227 |
#define PIN_MODE_OUTPUT_50M 3U |
228 |
#define PIN_CNF_INPUT_ANALOG 0U |
229 |
#define PIN_CNF_INPUT_FLOATING 1U |
230 |
#define PIN_CNF_INPUT_PULLX 2U |
231 |
#define PIN_CNF_OUTPUT_PUSHPULL 0U |
232 |
#define PIN_CNF_OUTPUT_OPENDRAIN 1U |
233 |
#define PIN_CNF_ALTERNATE_PUSHPULL 2U |
234 |
#define PIN_CNF_ALTERNATE_OPENDRAIN 3U |
235 |
#define PIN_CR(pin, mode, cnf) (((mode) | ((cnf) << 2U)) << (((pin) % 8U) * 4U)) |
236 |
#define PIN_ODR_LOW(n) (0U << (n)) |
237 |
#define PIN_ODR_HIGH(n) (1U << (n)) |
238 |
#define PIN_IGNORE(n) (1U << (n)) |
239 |
|
240 |
/*
|
241 |
* GPIOA setup:
|
242 |
*
|
243 |
* PA0 - PIN0 (input floating)
|
244 |
* PA1 - PIN1 (input floating)
|
245 |
* PA2 - LASER_RX (alternate pushpull high 50MHz)
|
246 |
* PA3 - LASER_TX (input pullup)
|
247 |
* PA4 - LIGHT_BLANK (output pushpull high 50MHz)
|
248 |
* PA5 - LIGHT_SCLK (alternate pushpull 50MHz)
|
249 |
* PA6 - PIN6 (input foating)
|
250 |
* PA7 - LIGHT_MOSI (alternate pushpull 50MHz)
|
251 |
* PA8 - PIN8 (input floating)
|
252 |
* PA9 - PROG_RX (alternate pushpull 50MHz)
|
253 |
* PA10 - PROG_TX (input pullup)
|
254 |
* PA11 - CAN_RX (input floating)
|
255 |
* PA12 - CAN_TX (alternate pushpull 50MHz)
|
256 |
* PA13 - SWDIO (input pullup)
|
257 |
* PA14 - SWCLK (input pullup)
|
258 |
* PA15 - PIN15 (input floating)
|
259 |
*/
|
260 |
#define VAL_GPIOAIGN 0 |
261 |
#define VAL_GPIOACRL (PIN_CR(GPIOA_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
262 |
PIN_CR(GPIOA_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
263 |
PIN_CR(GPIOA_LASER_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
264 |
PIN_CR(GPIOA_LASER_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
265 |
PIN_CR(GPIOA_LIGHT_BLANK, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
266 |
PIN_CR(GPIOA_LIGHT_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
267 |
PIN_CR(GPIOA_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
268 |
PIN_CR(GPIOA_LIGHT_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL)) |
269 |
#define VAL_GPIOACRH (PIN_CR(GPIOA_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
270 |
PIN_CR(GPIOA_PROG_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
271 |
PIN_CR(GPIOA_PROG_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
272 |
PIN_CR(GPIOA_CAN_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
273 |
PIN_CR(GPIOA_CAN_TX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
274 |
PIN_CR(GPIOA_SWDIO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
275 |
PIN_CR(GPIOA_SWCLK, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
276 |
PIN_CR(GPIOA_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
277 |
#define VAL_GPIOAODR (PIN_ODR_LOW(GPIOA_PIN0) | \
|
278 |
PIN_ODR_LOW(GPIOA_PIN1) | \ |
279 |
PIN_ODR_HIGH(GPIOA_LASER_RX) | \ |
280 |
PIN_ODR_HIGH(GPIOA_LASER_TX) | \ |
281 |
PIN_ODR_HIGH(GPIOA_LIGHT_BLANK) | \ |
282 |
PIN_ODR_HIGH(GPIOA_LIGHT_SCLK) | \ |
283 |
PIN_ODR_LOW(GPIOA_PIN6) | \ |
284 |
PIN_ODR_HIGH(GPIOA_LIGHT_MOSI) | \ |
285 |
PIN_ODR_LOW(GPIOA_PIN8) | \ |
286 |
PIN_ODR_HIGH(GPIOA_PROG_RX) | \ |
287 |
PIN_ODR_HIGH(GPIOA_PROG_TX) | \ |
288 |
PIN_ODR_HIGH(GPIOA_CAN_RX) | \ |
289 |
PIN_ODR_HIGH(GPIOA_CAN_TX) | \ |
290 |
PIN_ODR_HIGH(GPIOA_SWDIO) | \ |
291 |
PIN_ODR_HIGH(GPIOA_SWCLK) | \ |
292 |
PIN_ODR_LOW(GPIOA_PIN15)) |
293 |
|
294 |
/*
|
295 |
* GPIOB setup:
|
296 |
*
|
297 |
* PB0 - PIN0 (input floating)
|
298 |
* PB1 - PIN1 (input floating)
|
299 |
* PB2 - LASER_EN (output pushpull low 50MHz)
|
300 |
* PB3 - PIN3 (input floating)
|
301 |
* PB4 - PIN4 (input floating)
|
302 |
* PB5 - LASER_OC_N (input floating)
|
303 |
* PB6 - SYS_UART_DN (output opendrain high 50MHz)
|
304 |
* PB7 - PIN7 (input floating)
|
305 |
* PB8 - WL_GDO2 (input pullup)
|
306 |
* PB9 - WL_GDO0 (input pullup)
|
307 |
* PB10 - MEM_SCL (alternate opendrain 50MHz)
|
308 |
* PB11 - MEM_SDA (alternate opendrain 50MHz)
|
309 |
* PB12 - WL_SS_N (output pushpull high 50MHz)
|
310 |
* PB13 - WL_SCLK (alternate pushpull 50MHz)
|
311 |
* PB14 - WL_MISO (input pullup)
|
312 |
* PB15 - WL_MOSI (alternate pushpull 50MHz)
|
313 |
*/
|
314 |
#define VAL_GPIOBIGN (PIN_IGNORE(GPIOB_SYS_UART_DN)) & 0 |
315 |
#define VAL_GPIOBCRL (PIN_CR(GPIOB_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
316 |
PIN_CR(GPIOB_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
317 |
PIN_CR(GPIOB_LASER_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
318 |
PIN_CR(GPIOB_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
319 |
PIN_CR(GPIOB_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
320 |
PIN_CR(GPIOB_LASER_OC_N, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
321 |
PIN_CR(GPIOB_SYS_UART_DN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
322 |
PIN_CR(GPIOB_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
323 |
#define VAL_GPIOBCRH (PIN_CR(GPIOB_WL_GDO2, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \
|
324 |
PIN_CR(GPIOB_WL_GDO0, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
325 |
PIN_CR(GPIOB_MEM_SCL, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) | \ |
326 |
PIN_CR(GPIOB_MEM_SDA, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) | \ |
327 |
PIN_CR(GPIOB_WL_SS_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
328 |
PIN_CR(GPIOB_WL_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
329 |
PIN_CR(GPIOB_WL_MISO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
330 |
PIN_CR(GPIOB_WL_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL)) |
331 |
#define VAL_GPIOBODR (PIN_ODR_LOW(GPIOB_PIN0) | \
|
332 |
PIN_ODR_LOW(GPIOB_PIN1) | \ |
333 |
PIN_ODR_LOW(GPIOB_LASER_EN) | \ |
334 |
PIN_ODR_LOW(GPIOB_PIN3) | \ |
335 |
PIN_ODR_LOW(GPIOB_PIN4) | \ |
336 |
PIN_ODR_HIGH(GPIOB_LASER_OC_N) | \ |
337 |
PIN_ODR_HIGH(GPIOB_SYS_UART_DN) | \ |
338 |
PIN_ODR_LOW(GPIOB_PIN7) | \ |
339 |
PIN_ODR_HIGH(GPIOB_WL_GDO2) | \ |
340 |
PIN_ODR_HIGH(GPIOB_WL_GDO0) | \ |
341 |
PIN_ODR_HIGH(GPIOB_MEM_SCL) | \ |
342 |
PIN_ODR_HIGH(GPIOB_MEM_SDA) | \ |
343 |
PIN_ODR_HIGH(GPIOB_WL_SS_N) | \ |
344 |
PIN_ODR_HIGH(GPIOB_WL_SCLK) | \ |
345 |
PIN_ODR_HIGH(GPIOB_WL_MISO) | \ |
346 |
PIN_ODR_HIGH(GPIOB_WL_MOSI)) |
347 |
|
348 |
/*
|
349 |
* GPIOC setup:
|
350 |
*
|
351 |
* PC0 - PIN0 (input floating)
|
352 |
* PC1 - PIN1 (input floating)
|
353 |
* PC2 - PIN2 (input floating)
|
354 |
* PC3 - PIN3 (input floating)
|
355 |
* PC4 - LIGHT_XLAT (output pushpull low 50MHz)
|
356 |
* PC5 - PIN5 (input floating)
|
357 |
* PC6 - PIN6 (input floating)
|
358 |
* PC7 - PIN7 (input floating)
|
359 |
* PC8 - PIN8 (input floating)
|
360 |
* PC9 - PIN9 (input floating)
|
361 |
* PC10 - SYS_UART_RX (input pullup)
|
362 |
* PC11 - SYS_UART_TX (input pullup)
|
363 |
* PC12 - PIN12 (input floating)
|
364 |
* PC13 - PIN13 (input floating)
|
365 |
* PC14 - SYS_PD_N (output opendrain high 50MHz)
|
366 |
* PC15 - PIN15 (input floating)
|
367 |
*/
|
368 |
#define VAL_GPIOCIGN (PIN_IGNORE(GPIOC_SYS_PD_N)) & 0 |
369 |
#define VAL_GPIOCCRL (PIN_CR(GPIOC_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
370 |
PIN_CR(GPIOC_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
371 |
PIN_CR(GPIOC_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
372 |
PIN_CR(GPIOC_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
373 |
PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
374 |
PIN_CR(GPIOC_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
375 |
PIN_CR(GPIOC_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
376 |
PIN_CR(GPIOC_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
377 |
#define VAL_GPIOCCRH (PIN_CR(GPIOC_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
378 |
PIN_CR(GPIOC_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
379 |
PIN_CR(GPIOC_SYS_UART_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
380 |
PIN_CR(GPIOC_SYS_UART_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
381 |
PIN_CR(GPIOC_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
382 |
PIN_CR(GPIOC_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
383 |
PIN_CR(GPIOC_SYS_PD_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
384 |
PIN_CR(GPIOC_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
385 |
#define VAL_GPIOCODR (PIN_ODR_LOW(GPIOC_PIN0) | \
|
386 |
PIN_ODR_LOW(GPIOC_PIN1) | \ |
387 |
PIN_ODR_LOW(GPIOC_PIN2) | \ |
388 |
PIN_ODR_LOW(GPIOC_PIN3) | \ |
389 |
PIN_ODR_LOW(GPIOC_LIGHT_XLAT) | \ |
390 |
PIN_ODR_LOW(GPIOC_PIN5) | \ |
391 |
PIN_ODR_LOW(GPIOC_PIN6) | \ |
392 |
PIN_ODR_LOW(GPIOC_PIN7) | \ |
393 |
PIN_ODR_LOW(GPIOC_PIN8) | \ |
394 |
PIN_ODR_LOW(GPIOC_PIN9) | \ |
395 |
PIN_ODR_HIGH(GPIOC_SYS_UART_RX) | \ |
396 |
PIN_ODR_HIGH(GPIOC_SYS_UART_TX) | \ |
397 |
PIN_ODR_LOW(GPIOC_PIN12) | \ |
398 |
PIN_ODR_LOW(GPIOC_PIN13) | \ |
399 |
PIN_ODR_HIGH(GPIOC_SYS_PD_N) | \ |
400 |
PIN_ODR_LOW(GPIOC_PIN15)) |
401 |
|
402 |
/*
|
403 |
* GPIOD setup:
|
404 |
*
|
405 |
* PD0 - OSC_IN (input floating)
|
406 |
* PD1 - OSC_OUT (input floating)
|
407 |
* PD2 - SYS_INT_N (output opendrain low 50MHz)
|
408 |
* PD3 - PIN3 (input floating)
|
409 |
* PD4 - PIN4 (input floating)
|
410 |
* PD5 - PIN5 (input floating)
|
411 |
* PD6 - PIN6 (input floating)
|
412 |
* PD7 - PIN7 (input floating)
|
413 |
* PD8 - PIN8 (input floating)
|
414 |
* PD9 - PIN9 (input floating)
|
415 |
* PD10 - PIN10 (input floating)
|
416 |
* PD11 - PIN11 (input floating)
|
417 |
* PD12 - PIN12 (input floating)
|
418 |
* PD13 - PIN13 (input floating)
|
419 |
* PD14 - PIN14 (input floating)
|
420 |
* PD15 - PIN15 (input floating)
|
421 |
*/
|
422 |
#define VAL_GPIODIGN (PIN_IGNORE(GPIOD_SYS_INT_N)) & 0 |
423 |
#define VAL_GPIODCRL (PIN_CR(GPIOD_OSC_IN, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
424 |
PIN_CR(GPIOD_OSC_OUT, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
425 |
PIN_CR(GPIOD_SYS_INT_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
426 |
PIN_CR(GPIOD_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
427 |
PIN_CR(GPIOD_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
428 |
PIN_CR(GPIOD_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
429 |
PIN_CR(GPIOD_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
430 |
PIN_CR(GPIOD_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
431 |
#define VAL_GPIODCRH (PIN_CR(GPIOD_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
432 |
PIN_CR(GPIOD_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
433 |
PIN_CR(GPIOD_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
434 |
PIN_CR(GPIOD_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
435 |
PIN_CR(GPIOD_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
436 |
PIN_CR(GPIOD_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
437 |
PIN_CR(GPIOD_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
438 |
PIN_CR(GPIOD_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
439 |
#define VAL_GPIODODR (PIN_ODR_HIGH(GPIOD_OSC_IN) | \
|
440 |
PIN_ODR_HIGH(GPIOD_OSC_OUT) | \ |
441 |
PIN_ODR_LOW(GPIOD_SYS_INT_N) | \ |
442 |
PIN_ODR_LOW(GPIOD_PIN3) | \ |
443 |
PIN_ODR_LOW(GPIOD_PIN4) | \ |
444 |
PIN_ODR_LOW(GPIOD_PIN5) | \ |
445 |
PIN_ODR_LOW(GPIOD_PIN6) | \ |
446 |
PIN_ODR_LOW(GPIOD_PIN7) | \ |
447 |
PIN_ODR_LOW(GPIOD_PIN8) | \ |
448 |
PIN_ODR_LOW(GPIOD_PIN9) | \ |
449 |
PIN_ODR_LOW(GPIOD_PIN10) | \ |
450 |
PIN_ODR_LOW(GPIOD_PIN11) | \ |
451 |
PIN_ODR_LOW(GPIOD_PIN12) | \ |
452 |
PIN_ODR_LOW(GPIOD_PIN13) | \ |
453 |
PIN_ODR_LOW(GPIOD_PIN14) | \ |
454 |
PIN_ODR_LOW(GPIOD_PIN15)) |
455 |
|
456 |
/*
|
457 |
* GPIOE setup:
|
458 |
*
|
459 |
* PE0 - PIN0 (input floating)
|
460 |
* PE1 - PIN1 (input floating)
|
461 |
* PE2 - PIN2 (input floating)
|
462 |
* PE3 - PIN3 (input floating)
|
463 |
* PE4 - PIN4 (input floating)
|
464 |
* PE5 - PIN5 (input floating)
|
465 |
* PE6 - PIN6 (input floating)
|
466 |
* PE7 - PIN7 (input floating)
|
467 |
* PE8 - PIN8 (input floating)
|
468 |
* PE9 - PIN9 (input floating)
|
469 |
* PE10 - PIN10 (input floating)
|
470 |
* PE11 - PIN11 (input floating)
|
471 |
* PE12 - PIN12 (input floating)
|
472 |
* PE13 - PIN13 (input floating)
|
473 |
* PE14 - PIN14 (input floating)
|
474 |
* PE15 - PIN15 (input floating)
|
475 |
*/
|
476 |
#define VAL_GPIOEIGN 0 |
477 |
#define VAL_GPIOECRL (PIN_CR(GPIOE_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
478 |
PIN_CR(GPIOE_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
479 |
PIN_CR(GPIOE_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
480 |
PIN_CR(GPIOE_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
481 |
PIN_CR(GPIOE_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
482 |
PIN_CR(GPIOE_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
483 |
PIN_CR(GPIOE_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
484 |
PIN_CR(GPIOE_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
485 |
#define VAL_GPIOECRH (PIN_CR(GPIOE_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
486 |
PIN_CR(GPIOE_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
487 |
PIN_CR(GPIOE_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
488 |
PIN_CR(GPIOE_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
489 |
PIN_CR(GPIOE_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
490 |
PIN_CR(GPIOE_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
491 |
PIN_CR(GPIOE_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
492 |
PIN_CR(GPIOE_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
493 |
#define VAL_GPIOEODR (PIN_ODR_LOW(GPIOE_PIN0) | \
|
494 |
PIN_ODR_LOW(GPIOE_PIN1) | \ |
495 |
PIN_ODR_LOW(GPIOE_PIN2) | \ |
496 |
PIN_ODR_LOW(GPIOE_PIN3) | \ |
497 |
PIN_ODR_LOW(GPIOE_PIN4) | \ |
498 |
PIN_ODR_LOW(GPIOE_PIN5) | \ |
499 |
PIN_ODR_LOW(GPIOE_PIN6) | \ |
500 |
PIN_ODR_LOW(GPIOE_PIN7) | \ |
501 |
PIN_ODR_LOW(GPIOE_PIN8) | \ |
502 |
PIN_ODR_LOW(GPIOE_PIN9) | \ |
503 |
PIN_ODR_LOW(GPIOE_PIN10) | \ |
504 |
PIN_ODR_LOW(GPIOE_PIN11) | \ |
505 |
PIN_ODR_LOW(GPIOE_PIN12) | \ |
506 |
PIN_ODR_LOW(GPIOE_PIN13) | \ |
507 |
PIN_ODR_LOW(GPIOE_PIN14) | \ |
508 |
PIN_ODR_LOW(GPIOE_PIN15)) |
509 |
|
510 |
/*
|
511 |
* GPIOF setup:
|
512 |
*
|
513 |
* PF0 - PIN0 (input floating)
|
514 |
* PF1 - PIN1 (input floating)
|
515 |
* PF2 - PIN2 (input floating)
|
516 |
* PF3 - PIN3 (input floating)
|
517 |
* PF4 - PIN4 (input floating)
|
518 |
* PF5 - PIN5 (input floating)
|
519 |
* PF6 - PIN6 (input floating)
|
520 |
* PF7 - PIN7 (input floating)
|
521 |
* PF8 - PIN8 (input floating)
|
522 |
* PF9 - PIN9 (input floating)
|
523 |
* PF10 - PIN10 (input floating)
|
524 |
* PF11 - PIN11 (input floating)
|
525 |
* PF12 - PIN12 (input floating)
|
526 |
* PF13 - PIN13 (input floating)
|
527 |
* PF14 - PIN14 (input floating)
|
528 |
* PF15 - PIN15 (input floating)
|
529 |
*/
|
530 |
#define VAL_GPIOFIGN 0 |
531 |
#define VAL_GPIOFCRL (PIN_CR(GPIOF_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
532 |
PIN_CR(GPIOF_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
533 |
PIN_CR(GPIOF_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
534 |
PIN_CR(GPIOF_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
535 |
PIN_CR(GPIOF_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
536 |
PIN_CR(GPIOF_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
537 |
PIN_CR(GPIOF_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
538 |
PIN_CR(GPIOF_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
539 |
#define VAL_GPIOFCRH (PIN_CR(GPIOF_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
540 |
PIN_CR(GPIOF_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
541 |
PIN_CR(GPIOF_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
542 |
PIN_CR(GPIOF_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
543 |
PIN_CR(GPIOF_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
544 |
PIN_CR(GPIOF_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
545 |
PIN_CR(GPIOF_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
546 |
PIN_CR(GPIOF_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
547 |
#define VAL_GPIOFODR (PIN_ODR_LOW(GPIOF_PIN0) | \
|
548 |
PIN_ODR_LOW(GPIOF_PIN1) | \ |
549 |
PIN_ODR_LOW(GPIOF_PIN2) | \ |
550 |
PIN_ODR_LOW(GPIOF_PIN3) | \ |
551 |
PIN_ODR_LOW(GPIOF_PIN4) | \ |
552 |
PIN_ODR_LOW(GPIOF_PIN5) | \ |
553 |
PIN_ODR_LOW(GPIOF_PIN6) | \ |
554 |
PIN_ODR_LOW(GPIOF_PIN7) | \ |
555 |
PIN_ODR_LOW(GPIOF_PIN8) | \ |
556 |
PIN_ODR_LOW(GPIOF_PIN9) | \ |
557 |
PIN_ODR_LOW(GPIOF_PIN10) | \ |
558 |
PIN_ODR_LOW(GPIOF_PIN11) | \ |
559 |
PIN_ODR_LOW(GPIOF_PIN12) | \ |
560 |
PIN_ODR_LOW(GPIOF_PIN13) | \ |
561 |
PIN_ODR_LOW(GPIOF_PIN14) | \ |
562 |
PIN_ODR_LOW(GPIOF_PIN15)) |
563 |
|
564 |
/*
|
565 |
* GPIOG setup:
|
566 |
*
|
567 |
* PG0 - PIN0 (input floating)
|
568 |
* PG1 - PIN1 (input floating)
|
569 |
* PG2 - PIN2 (input floating)
|
570 |
* PG3 - PIN3 (input floating)
|
571 |
* PG4 - PIN4 (input floating)
|
572 |
* PG5 - PIN5 (input floating)
|
573 |
* PG6 - PIN6 (input floating)
|
574 |
* PG7 - PIN7 (input floating)
|
575 |
* PG8 - PIN8 (input floating)
|
576 |
* PG9 - PIN9 (input floating)
|
577 |
* PG10 - PIN10 (input floating)
|
578 |
* PG11 - PIN11 (input floating)
|
579 |
* PG12 - PIN12 (input floating)
|
580 |
* PG13 - PIN13 (input floating)
|
581 |
* PG14 - PIN14 (input floating)
|
582 |
* PG15 - PIN15 (input floating)
|
583 |
*/
|
584 |
#define VAL_GPIOGIGN 0 |
585 |
#define VAL_GPIOGCRL (PIN_CR(GPIOG_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
586 |
PIN_CR(GPIOG_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
587 |
PIN_CR(GPIOG_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
588 |
PIN_CR(GPIOG_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
589 |
PIN_CR(GPIOG_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
590 |
PIN_CR(GPIOG_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
591 |
PIN_CR(GPIOG_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
592 |
PIN_CR(GPIOG_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
593 |
#define VAL_GPIOGCRH (PIN_CR(GPIOG_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
594 |
PIN_CR(GPIOG_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
595 |
PIN_CR(GPIOG_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
596 |
PIN_CR(GPIOG_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
597 |
PIN_CR(GPIOG_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
598 |
PIN_CR(GPIOG_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
599 |
PIN_CR(GPIOG_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
600 |
PIN_CR(GPIOG_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
601 |
#define VAL_GPIOGODR (PIN_ODR_LOW(GPIOG_PIN0) | \
|
602 |
PIN_ODR_LOW(GPIOG_PIN1) | \ |
603 |
PIN_ODR_LOW(GPIOG_PIN2) | \ |
604 |
PIN_ODR_LOW(GPIOG_PIN3) | \ |
605 |
PIN_ODR_LOW(GPIOG_PIN4) | \ |
606 |
PIN_ODR_LOW(GPIOG_PIN5) | \ |
607 |
PIN_ODR_LOW(GPIOG_PIN6) | \ |
608 |
PIN_ODR_LOW(GPIOG_PIN7) | \ |
609 |
PIN_ODR_LOW(GPIOG_PIN8) | \ |
610 |
PIN_ODR_LOW(GPIOG_PIN9) | \ |
611 |
PIN_ODR_LOW(GPIOG_PIN10) | \ |
612 |
PIN_ODR_LOW(GPIOG_PIN11) | \ |
613 |
PIN_ODR_LOW(GPIOG_PIN12) | \ |
614 |
PIN_ODR_LOW(GPIOG_PIN13) | \ |
615 |
PIN_ODR_LOW(GPIOG_PIN14) | \ |
616 |
PIN_ODR_LOW(GPIOG_PIN15)) |
617 |
|
618 |
#if !defined(_FROM_ASM_)
|
619 |
#ifdef __cplusplus
|
620 |
extern "C" { |
621 |
#endif
|
622 |
void boardInit(void); |
623 |
#ifdef __cplusplus
|
624 |
} |
625 |
#endif
|
626 |
#endif /* _FROM_ASM_ */ |
627 |
|
628 |
#endif /* BOARD_H */ |
629 |
|
630 |
/** @} */
|