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