amiro-os / modules / DiWheelDrive_1-2 / board.c @ 510b93cc
History | View | Annotate | Download (3.86 KB)
1 | abb8b3f4 | Thomas Schöpping | /*
|
---|---|---|---|
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 | 034cb15a | Thomas Schöpping | * @brief DiWheeDrive v1.2 Board specific initializations.
|
22 | abb8b3f4 | Thomas Schöpping | *
|
23 | * @addtogroup diwheeldrive_board
|
||
24 | * @{
|
||
25 | */
|
||
26 | |||
27 | #include <hal.h> |
||
28 | |||
29 | cda14729 | Thomas Schöpping | /*===========================================================================*/
|
30 | /* Driver local definitions. */
|
||
31 | /*===========================================================================*/
|
||
32 | |||
33 | /*===========================================================================*/
|
||
34 | /* Driver exported variables. */
|
||
35 | /*===========================================================================*/
|
||
36 | |||
37 | /*===========================================================================*/
|
||
38 | /* Driver local variables and types. */
|
||
39 | /*===========================================================================*/
|
||
40 | |||
41 | abb8b3f4 | Thomas Schöpping | #if HAL_USE_PAL || defined(__DOXYGEN__)
|
42 | /**
|
||
43 | * @brief PAL setup.
|
||
44 | * @details Digital I/O ports static configuration as defined in @p board.h.
|
||
45 | * This variable is used by the HAL when initializing the PAL driver.
|
||
46 | */
|
||
47 | const PALConfig pal_default_config = {
|
||
48 | #if STM32_HAS_GPIOA
|
||
49 | {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, |
||
50 | #endif
|
||
51 | #if STM32_HAS_GPIOB
|
||
52 | {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, |
||
53 | #endif
|
||
54 | #if STM32_HAS_GPIOC
|
||
55 | {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, |
||
56 | #endif
|
||
57 | #if STM32_HAS_GPIOD
|
||
58 | {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, |
||
59 | #endif
|
||
60 | #if STM32_HAS_GPIOE
|
||
61 | {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, |
||
62 | #endif
|
||
63 | #if STM32_HAS_GPIOF
|
||
64 | {VAL_GPIOFODR, VAL_GPIOFCRL, VAL_GPIOFCRH}, |
||
65 | #endif
|
||
66 | #if STM32_HAS_GPIOG
|
||
67 | {VAL_GPIOGODR, VAL_GPIOGCRL, VAL_GPIOGCRH}, |
||
68 | #endif
|
||
69 | }; |
||
70 | #endif
|
||
71 | |||
72 | cda14729 | Thomas Schöpping | /*===========================================================================*/
|
73 | /* Driver local functions. */
|
||
74 | /*===========================================================================*/
|
||
75 | |||
76 | /*===========================================================================*/
|
||
77 | /* Driver interrupt handlers. */
|
||
78 | /*===========================================================================*/
|
||
79 | |||
80 | /*===========================================================================*/
|
||
81 | /* Driver exported functions. */
|
||
82 | /*===========================================================================*/
|
||
83 | |||
84 | abb8b3f4 | Thomas Schöpping | /**
|
85 | * @brief Early initialization code.
|
||
86 | * @details This initialization must be performed just after stack setup
|
||
87 | * and before any other initialization.
|
||
88 | */
|
||
89 | void __early_init(void) { |
||
90 | |||
91 | stm32_clock_init(); |
||
92 | } |
||
93 | |||
94 | /**
|
||
95 | * @brief Board-specific initialization code.
|
||
96 | * @todo Add your board-specific code, if any.
|
||
97 | */
|
||
98 | void boardInit(void) { |
||
99 | /*
|
||
100 | * Several I/O pins are re-mapped:
|
||
101 | * JTAG disabled and SWJ enabled
|
||
102 | * TIM2 to the PA15/PB3/PA2/PA3 pins.
|
||
103 | * TIM3 to PC6/PC7 pins.
|
||
104 | * USART3 to the PC10/PC11 pins.
|
||
105 | * I2C1 to the PB8/PB9 pins.
|
||
106 | */
|
||
107 | AFIO->MAPR = AFIO_MAPR_SWJ_CFG_DISABLE | |
||
108 | AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1 | |
||
109 | AFIO_MAPR_TIM3_REMAP_FULLREMAP | |
||
110 | AFIO_MAPR_USART3_REMAP_PARTIALREMAP | |
||
111 | AFIO_MAPR_I2C1_REMAP; |
||
112 | } |
||
113 | |||
114 | /** @} */ |