amiro-os / modules / NUCLEO-F103RB / board.h @ 70dd091e
History | View | Annotate | Download (12.693 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
#ifndef BOARD_H
|
20 |
#define BOARD_H
|
21 |
|
22 |
/*===========================================================================*/
|
23 |
/* Driver constants. */
|
24 |
/*===========================================================================*/
|
25 |
|
26 |
/*
|
27 |
* Setup for the ST NUCLEO64-F103RB board.
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
* Board identifier.
|
32 |
*/
|
33 |
#define BOARD_ST_NUCLEO64_F103RB
|
34 |
#define BOARD_NAME "STMicroelectronics NUCLEO-F103RB" |
35 |
|
36 |
/*
|
37 |
* Board frequencies.
|
38 |
*/
|
39 |
#define STM32_LSECLK 0 |
40 |
|
41 |
#if defined(NUCLEO_EXTERNAL_OSCILLATOR)
|
42 |
#define STM32_HSECLK 8000000 |
43 |
#define STM32_HSE_BYPASS
|
44 |
|
45 |
#elif defined(NUCLEO_HSE_CRYSTAL)
|
46 |
#define STM32_HSECLK 8000000 |
47 |
|
48 |
#else
|
49 |
#define STM32_HSECLK 0 |
50 |
#endif
|
51 |
|
52 |
/*
|
53 |
* MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
|
54 |
*/
|
55 |
#define STM32F103xB
|
56 |
|
57 |
/*
|
58 |
* Identifiers for optional peripherals.
|
59 |
*/
|
60 |
#define BOARD_DW1000_CONNECTED false |
61 |
#define BOARD_MIC9404x_CONNECTED false /* Power supply for DW1000 in Light ring */ |
62 |
|
63 |
/*
|
64 |
* IO pins assignments.
|
65 |
*/
|
66 |
#define GPIOA_ARD_A0 0U |
67 |
#define GPIOA_ADC1_IN0 0U |
68 |
#define GPIOA_ARD_A1 1U |
69 |
#define GPIOA_ADC1_IN1 1U |
70 |
#define GPIOA_ARD_D1 2U |
71 |
#define GPIOA_USART2_TX 2U |
72 |
#define GPIOA_ARD_D0 3U |
73 |
#define GPIOA_USART2_RX 3U |
74 |
#define GPIOA_ARD_A2 4U |
75 |
#define GPIOA_ADC1_IN4 4U |
76 |
#define GPIOA_ARD_D13 5U |
77 |
#define GPIOA_LED_GREEN 5U |
78 |
#define GPIOA_ARD_D12 6U |
79 |
#define GPIOA_ARD_D11 7U |
80 |
#define GPIOA_ARD_D7 8U |
81 |
#define GPIOA_ARD_D8 9U |
82 |
#define GPIOA_ARD_D2 10U |
83 |
#define GPIOA_PIN11 11U |
84 |
#define GPIOA_PIN12 12U |
85 |
#define GPIOA_SWDIO 13U |
86 |
#define GPIOA_SWCLK 14U |
87 |
#define GPIOA_PIN15 15U |
88 |
|
89 |
#define GPIOB_ARD_A3 0U |
90 |
#define GPIOB_ADC1_IN8 0U |
91 |
#define GPIOB_PIN1 1U |
92 |
#define GPIOB_PIN2 2U |
93 |
#define GPIOB_ARD_D3 3U |
94 |
#define GPIOB_SWO 3U |
95 |
#define GPIOB_ARD_D5 4U |
96 |
#define GPIOB_ARD_D4 5U |
97 |
#define GPIOB_ARD_D10 6U |
98 |
#define GPIOB_PIN7 7U |
99 |
#define GPIOB_ARD_D15 8U |
100 |
#define GPIOB_ARD_D14 9U |
101 |
#define GPIOB_ARD_D6 10U |
102 |
#define GPIOB_PIN11 11U |
103 |
#define GPIOB_PIN12 12U |
104 |
#define GPIOB_PIN13 13U |
105 |
#define GPIOB_PIN14 14U |
106 |
#define GPIOB_PIN15 15U |
107 |
|
108 |
#define GPIOC_ARD_A5 0U |
109 |
#define GPIOC_ADC1_IN11 0U |
110 |
#define GPIOC_ARD_A4 1U |
111 |
#define GPIOC_ADC1_IN10 1U |
112 |
#define GPIOC_PIN2 2U |
113 |
#define GPIOC_PIN3 3U |
114 |
#define GPIOC_PIN4 4U |
115 |
#define GPIOC_PIN5 5U |
116 |
#define GPIOC_PIN6 6U |
117 |
#define GPIOC_ARD_D9 7U |
118 |
#define GPIOC_PIN8 8U |
119 |
#define GPIOC_PIN9 9U |
120 |
#define GPIOC_PIN10 10U |
121 |
#define GPIOC_PIN11 11U |
122 |
#define GPIOC_PIN12 12U |
123 |
#define GPIOC_BUTTON 13U |
124 |
#define GPIOC_PIN14 14U |
125 |
#define GPIOC_PIN15 15U |
126 |
|
127 |
#define GPIOD_OSC_IN 0U |
128 |
#define GPIOD_PIN0 0U |
129 |
#define GPIOD_OSC_OUT 1U |
130 |
#define GPIOD_PIN1 1U |
131 |
#define GPIOD_PIN2 2U |
132 |
#define GPIOD_PIN3 3U |
133 |
#define GPIOD_PIN4 4U |
134 |
#define GPIOD_PIN5 5U |
135 |
#define GPIOD_PIN6 6U |
136 |
#define GPIOD_PIN7 7U |
137 |
#define GPIOD_PIN8 8U |
138 |
#define GPIOD_PIN9 9U |
139 |
#define GPIOD_PIN10 10U |
140 |
#define GPIOD_PIN11 11U |
141 |
#define GPIOD_PIN12 12U |
142 |
#define GPIOD_PIN13 13U |
143 |
#define GPIOD_PIN14 14U |
144 |
#define GPIOD_PIN15 15U |
145 |
|
146 |
#define GPIOE_PIN0 0U |
147 |
#define GPIOE_PIN1 1U |
148 |
#define GPIOE_PIN2 2U |
149 |
#define GPIOE_PIN3 3U |
150 |
#define GPIOE_PIN4 4U |
151 |
#define GPIOE_PIN5 5U |
152 |
#define GPIOE_PIN6 6U |
153 |
#define GPIOE_PIN7 7U |
154 |
#define GPIOE_PIN8 8U |
155 |
#define GPIOE_PIN9 9U |
156 |
#define GPIOE_PIN10 10U |
157 |
#define GPIOE_PIN11 11U |
158 |
#define GPIOE_PIN12 12U |
159 |
#define GPIOE_PIN13 13U |
160 |
#define GPIOE_PIN14 14U |
161 |
#define GPIOE_PIN15 15U |
162 |
|
163 |
#define GPIOF_PIN0 0U |
164 |
#define GPIOF_PIN1 1U |
165 |
#define GPIOF_PIN2 2U |
166 |
#define GPIOF_PIN3 3U |
167 |
#define GPIOF_PIN4 4U |
168 |
#define GPIOF_PIN5 5U |
169 |
#define GPIOF_PIN6 6U |
170 |
#define GPIOF_PIN7 7U |
171 |
#define GPIOF_PIN8 8U |
172 |
#define GPIOF_PIN9 9U |
173 |
#define GPIOF_PIN10 10U |
174 |
#define GPIOF_PIN11 11U |
175 |
#define GPIOF_PIN12 12U |
176 |
#define GPIOF_PIN13 13U |
177 |
#define GPIOF_PIN14 14U |
178 |
#define GPIOF_PIN15 15U |
179 |
|
180 |
/*
|
181 |
* IO lines assignments.
|
182 |
*/
|
183 |
#define LINE_ARD_A0 PAL_LINE(GPIOA, GPIOA_ARD_A0)
|
184 |
#define LINE_ADC1_IN0 PAL_LINE(GPIOA, GPIOA_ADC1_IN0)
|
185 |
#define LINE_ARD_A1 PAL_LINE(GPIOA, GPIOA_ARD_A1)
|
186 |
#define LINE_ADC1_IN1 PAL_LINE(GPIOA, GPIOA_ADC1_IN1)
|
187 |
#define LINE_ARD_D1 PAL_LINE(GPIOA, GPIOA_ARD_D1)
|
188 |
#define LINE_USART2_TX PAL_LINE(GPIOA, GPIOA_USART2_TX)
|
189 |
#define LINE_ARD_D0 PAL_LINE(GPIOA, GPIOA_ARD_D0)
|
190 |
#define LINE_USART2_RX PAL_LINE(GPIOA, GPIOA_USART2_RX)
|
191 |
#define LINE_ARD_A2 PAL_LINE(GPIOA, GPIOA_ARD_A2)
|
192 |
#define LINE_ADC1_IN4 PAL_LINE(GPIOA, GPIOA_ADC1_IN4)
|
193 |
#define LINE_ARD_D13 PAL_LINE(GPIOA, GPIOA_ARD_D13)
|
194 |
#define LINE_LED_GREEN PAL_LINE(GPIOA, GPIOA_LED_GREEN)
|
195 |
#define LINE_ARD_D12 PAL_LINE(GPIOA, GPIOA_ARD_D12)
|
196 |
#define LINE_ARD_D11 PAL_LINE(GPIOA, GPIOA_ARD_D11)
|
197 |
#define LINE_ARD_D7 PAL_LINE(GPIOA, GPIOA_ARD_D7)
|
198 |
#define LINE_ARD_D8 PAL_LINE(GPIOA, GPIOA_ARD_D8)
|
199 |
#define LINE_ARD_D2 PAL_LINE(GPIOA, GPIOA_ARD_D2)
|
200 |
#define LINE_SWDIO PAL_LINE(GPIOA, GPIOA_SWDIO)
|
201 |
#define LINE_SWCLK PAL_LINE(GPIOA, GPIOA_SWCLK)
|
202 |
|
203 |
#define LINE_ARD_A3 PAL_LINE(GPIOB, GPIOB_ARD_A3)
|
204 |
#define LINE_ADC1_IN8 PAL_LINE(GPIOB, GPIOB_ADC1_IN8)
|
205 |
#define LINE_ARD_D3 PAL_LINE(GPIOB, GPIOB_ARD_D3)
|
206 |
#define LINE_SWO PAL_LINE(GPIOB, GPIOB_SWO)
|
207 |
#define LINE_ARD_D5 PAL_LINE(GPIOB, GPIOB_ARD_D5)
|
208 |
#define LINE_ARD_D4 PAL_LINE(GPIOB, GPIOB_ARD_D4)
|
209 |
#define LINE_ARD_D10 PAL_LINE(GPIOB, GPIOB_ARD_D10)
|
210 |
#define LINE_ARD_D15 PAL_LINE(GPIOB, GPIOB_ARD_D15)
|
211 |
#define LINE_ARD_D14 PAL_LINE(GPIOB, GPIOB_ARD_D14)
|
212 |
#define LINE_ARD_D6 PAL_LINE(GPIOB, GPIOB_ARD_D6)
|
213 |
|
214 |
#define LINE_ARD_A5 PAL_LINE(GPIOC, GPIOC_ARD_A5)
|
215 |
#define LINE_ADC1_IN11 PAL_LINE(GPIOC, GPIOC_ADC1_IN11)
|
216 |
#define LINE_ARD_A4 PAL_LINE(GPIOC, GPIOC_ARD_A4)
|
217 |
#define LINE_ADC1_IN10 PAL_LINE(GPIOC, GPIOC_ADC1_IN10)
|
218 |
#define LINE_ARD_D9 PAL_LINE(GPIOC, GPIOC_ARD_D9)
|
219 |
#define LINE_BUTTON PAL_LINE(GPIOC, GPIOC_BUTTON)
|
220 |
|
221 |
#define LINE_OSC_IN PAL_LINE(GPIOD, GPIOH_OSC_IN)
|
222 |
#define LINE_OSC_OUT PAL_LINE(GPIOD, GPIOH_OSC_OUT)
|
223 |
|
224 |
/*===========================================================================*/
|
225 |
/* Driver pre-compile time settings. */
|
226 |
/*===========================================================================*/
|
227 |
|
228 |
/*===========================================================================*/
|
229 |
/* Derived constants and error checks. */
|
230 |
/*===========================================================================*/
|
231 |
|
232 |
/*===========================================================================*/
|
233 |
/* Driver data structures and types. */
|
234 |
/*===========================================================================*/
|
235 |
|
236 |
/*===========================================================================*/
|
237 |
/* Driver macros. */
|
238 |
/*===========================================================================*/
|
239 |
|
240 |
/*
|
241 |
* I/O ports initial setup, this configuration is established soon after reset
|
242 |
* in the initialization code.
|
243 |
*
|
244 |
* The digits have the following meaning:
|
245 |
* 0 - Analog input.
|
246 |
* 1 - Push Pull output 10MHz.
|
247 |
* 2 - Push Pull output 2MHz.
|
248 |
* 3 - Push Pull output 50MHz.
|
249 |
* 4 - Digital input.
|
250 |
* 5 - Open Drain output 10MHz.
|
251 |
* 6 - Open Drain output 2MHz.
|
252 |
* 7 - Open Drain output 50MHz.
|
253 |
* 8 - Digital input with PullUp or PullDown resistor depending on ODR.
|
254 |
* 9 - Alternate Push Pull output 10MHz.
|
255 |
* A - Alternate Push Pull output 2MHz.
|
256 |
* B - Alternate Push Pull output 50MHz.
|
257 |
* C - Reserved.
|
258 |
* D - Alternate Open Drain output 10MHz.
|
259 |
* E - Alternate Open Drain output 2MHz.
|
260 |
* F - Alternate Open Drain output 50MHz.
|
261 |
* Please refer to the STM32 Reference Manual for details.
|
262 |
*/
|
263 |
|
264 |
/*
|
265 |
* Port A setup.
|
266 |
* Everything input with pull-up except:
|
267 |
* PA2 - Alternate output (GPIOA_ARD_D1, GPIOA_USART2_TX).
|
268 |
* PA3 - Normal input (GPIOA_ARD_D0, GPIOA_USART2_RX).
|
269 |
* PA5 - Push Pull output (GPIOA_LED_GREEN).
|
270 |
* PA13 - Pull-up input (GPIOA_SWDIO).
|
271 |
* PA14 - Pull-down input (GPIOA_SWCLK).
|
272 |
*/
|
273 |
#define VAL_GPIOACRL 0x88384B88 /* PA7...PA0 */ |
274 |
#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */ |
275 |
#define VAL_GPIOAODR 0xFFFFBFDF |
276 |
|
277 |
/*
|
278 |
* Port B setup.
|
279 |
* Everything input with pull-up except:
|
280 |
* PB3 - Pull-up input (GPIOA_SWO).
|
281 |
*/
|
282 |
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ |
283 |
#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */ |
284 |
#define VAL_GPIOBODR 0xFFFFFFFF |
285 |
|
286 |
/*
|
287 |
* Port C setup.
|
288 |
* Everything input with pull-up except:
|
289 |
* PC13 - Normal input (GPIOC_BUTTON).
|
290 |
*/
|
291 |
#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ |
292 |
#define VAL_GPIOCCRH 0x88488888 /* PC15...PC8 */ |
293 |
#define VAL_GPIOCODR 0xFFFFFFFF |
294 |
|
295 |
/*
|
296 |
* Port D setup.
|
297 |
* Everything input with pull-up except:
|
298 |
* PD0 - Normal input (GPIOD_OSC_IN).
|
299 |
* PD1 - Normal input (GPIOD_OSC_OUT).
|
300 |
*/
|
301 |
#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ |
302 |
#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ |
303 |
#define VAL_GPIODODR 0xFFFFFFFF |
304 |
|
305 |
/*
|
306 |
* Port E setup.
|
307 |
* Everything input with pull-up except:
|
308 |
*/
|
309 |
#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ |
310 |
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ |
311 |
#define VAL_GPIOEODR 0xFFFFFFFF |
312 |
|
313 |
/*
|
314 |
* USB bus activation macro, required by the USB driver.
|
315 |
*/
|
316 |
#define usb_lld_connect_bus(usbp)
|
317 |
|
318 |
/*
|
319 |
* USB bus de-activation macro, required by the USB driver.
|
320 |
*/
|
321 |
#define usb_lld_disconnect_bus(usbp)
|
322 |
|
323 |
/*===========================================================================*/
|
324 |
/* External declarations. */
|
325 |
/*===========================================================================*/
|
326 |
|
327 |
#if !defined(_FROM_ASM_)
|
328 |
#ifdef __cplusplus
|
329 |
extern "C" { |
330 |
#endif
|
331 |
void boardInit(void); |
332 |
#ifdef __cplusplus
|
333 |
} |
334 |
#endif
|
335 |
#endif /* _FROM_ASM_ */ |
336 |
|
337 |
#endif /* BOARD_H */ |