]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/vinta/boards/GENERIC_STM32_F042X6/board.c
[Keyboard] Add QMK configurator JSON for Alice PCB (#6397)
[qmk_firmware.git] / keyboards / vinta / boards / GENERIC_STM32_F042X6 / board.c
1 /*
2     ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3     Licensed under the Apache License, Version 2.0 (the "License");
4     you may not use this file except in compliance with the License.
5     You may obtain a copy of the License at
6         http://www.apache.org/licenses/LICENSE-2.0
7     Unless required by applicable law or agreed to in writing, software
8     distributed under the License is distributed on an "AS IS" BASIS,
9     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10     See the License for the specific language governing permissions and
11     limitations under the License.
12 */
13
14 #include "hal.h"
15
16 #if HAL_USE_PAL || defined(__DOXYGEN__)
17 /**
18  * @brief   PAL setup.
19  * @details Digital I/O ports static configuration as defined in @p board.h.
20  *          This variable is used by the HAL when initializing the PAL driver.
21  */
22 const PALConfig pal_default_config = {
23 #if STM32_HAS_GPIOA
24   {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
25    VAL_GPIOA_ODR,   VAL_GPIOA_AFRL,   VAL_GPIOA_AFRH},
26 #endif
27 #if STM32_HAS_GPIOB
28   {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
29    VAL_GPIOB_ODR,   VAL_GPIOB_AFRL,   VAL_GPIOB_AFRH},
30 #endif
31 #if STM32_HAS_GPIOC
32   {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
33    VAL_GPIOC_ODR,   VAL_GPIOC_AFRL,   VAL_GPIOC_AFRH},
34 #endif
35 #if STM32_HAS_GPIOD
36   {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
37    VAL_GPIOD_ODR,   VAL_GPIOD_AFRL,   VAL_GPIOD_AFRH},
38 #endif
39 #if STM32_HAS_GPIOE
40   {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
41    VAL_GPIOE_ODR,   VAL_GPIOE_AFRL,   VAL_GPIOE_AFRH},
42 #endif
43 #if STM32_HAS_GPIOF
44   {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
45    VAL_GPIOF_ODR,   VAL_GPIOF_AFRL,   VAL_GPIOF_AFRH},
46 #endif
47 #if STM32_HAS_GPIOG
48   {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
49    VAL_GPIOG_ODR,   VAL_GPIOG_AFRL,   VAL_GPIOG_AFRH},
50 #endif
51 #if STM32_HAS_GPIOH
52   {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
53    VAL_GPIOH_ODR,   VAL_GPIOH_AFRL,   VAL_GPIOH_AFRH},
54 #endif
55 #if STM32_HAS_GPIOI
56   {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
57    VAL_GPIOI_ODR,   VAL_GPIOI_AFRL,   VAL_GPIOI_AFRH}
58 #endif
59 };
60 #endif
61
62 void enter_bootloader_mode_if_requested(void);
63
64 /**
65  * @brief   Early initialization code.
66  * @details This initialization must be performed just after stack setup
67  *          and before any other initialization.
68  */
69 void __early_init(void) {
70   enter_bootloader_mode_if_requested();
71   stm32_clock_init();
72 }
73
74 #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
75 /**
76  * @brief   MMC_SPI card detection.
77  */
78 bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
79
80   (void)mmcp;
81   /* TODO: Fill the implementation.*/
82   return true;
83 }
84
85 /**
86  * @brief   MMC_SPI card write protection detection.
87  */
88 bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
89
90   (void)mmcp;
91   /* TODO: Fill the implementation.*/
92   return false;
93 }
94 #endif
95
96 /**
97  * @brief   Board-specific initialization code.
98  * @todo    Add your board-specific code, if any.
99  */
100 void boardInit(void) {
101 }