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