amiro-os / modules / DiWheelDrive_1-1 / board.c @ 4f3a1f5e
History | View | Annotate | Download (2.321 KB)
1 | e545e620 | Thomas Schöpping | /*
|
---|---|---|---|
2 | AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
||
3 | Copyright (C) 2016..2018 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 | #include <hal.h> |
||
20 | |||
21 | #if HAL_USE_PAL || defined(__DOXYGEN__)
|
||
22 | /**
|
||
23 | * @brief PAL setup.
|
||
24 | * @details Digital I/O ports static configuration as defined in @p board.h.
|
||
25 | * This variable is used by the HAL when initializing the PAL driver.
|
||
26 | */
|
||
27 | const PALConfig pal_default_config = {
|
||
28 | #if STM32_HAS_GPIOA
|
||
29 | {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, |
||
30 | #endif
|
||
31 | #if STM32_HAS_GPIOB
|
||
32 | {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, |
||
33 | #endif
|
||
34 | #if STM32_HAS_GPIOC
|
||
35 | {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, |
||
36 | #endif
|
||
37 | #if STM32_HAS_GPIOD
|
||
38 | {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, |
||
39 | #endif
|
||
40 | #if STM32_HAS_GPIOE
|
||
41 | {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, |
||
42 | #endif
|
||
43 | #if STM32_HAS_GPIOF
|
||
44 | {VAL_GPIOFODR, VAL_GPIOFCRL, VAL_GPIOFCRH}, |
||
45 | #endif
|
||
46 | #if STM32_HAS_GPIOG
|
||
47 | {VAL_GPIOGODR, VAL_GPIOGCRL, VAL_GPIOGCRH}, |
||
48 | #endif
|
||
49 | }; |
||
50 | #endif
|
||
51 | |||
52 | /**
|
||
53 | * @brief Early initialization code.
|
||
54 | * @details This initialization must be performed just after stack setup
|
||
55 | * and before any other initialization.
|
||
56 | */
|
||
57 | void __early_init(void) { |
||
58 | |||
59 | stm32_clock_init(); |
||
60 | } |
||
61 | |||
62 | /**
|
||
63 | * @brief Board-specific initialization code.
|
||
64 | * @todo Add your board-specific code, if any.
|
||
65 | */
|
||
66 | void boardInit(void) { |
||
67 | /*
|
||
68 | * Several I/O pins are re-mapped:
|
||
69 | * JTAG disabled and SWJ enabled
|
||
70 | * TIM2 to the PA15/PB3/PA2/PA3 pins.
|
||
71 | * TIM3 to PC6/PC7 pins.
|
||
72 | * USART3 to the PC10/PC11 pins.
|
||
73 | * I2C1 to the PB8/PB9 pins.
|
||
74 | */
|
||
75 | AFIO->MAPR = AFIO_MAPR_SWJ_CFG_DISABLE | |
||
76 | AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1 | |
||
77 | AFIO_MAPR_TIM3_REMAP_FULLREMAP | |
||
78 | AFIO_MAPR_USART3_REMAP_PARTIALREMAP | |
||
79 | AFIO_MAPR_I2C1_REMAP; |
||
80 | } |