board.c (2119B)
1 /* 2 ChibiOS Driver element - Copyright (C) 2019 /u/KeepItUnder 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 #include "hal.h" 18 19 #if HAL_USE_PAL || defined(__DOXYGEN__) 20 /** 21 * @brief PAL setup. 22 * @details Digital I/O ports static configuration as defined in @p board.h. 23 * This variable is used by the HAL when initializing the PAL driver. 24 */ 25 const PALConfig pal_default_config = { 26 # if NUC123_HAS_GPIOA 27 {VAL_GPIOA_PMD, VAL_GPIOA_OFFD, VAL_GPIOA_DMASK, VAL_GPIOA_DBEN, VAL_GPIOA_IMD, VAL_GPIOA_IEN, VAL_GPIOA_ISRC, VAL_GPIOA_DOUT}, 28 # endif 29 # if NUC123_HAS_GPIOB 30 {VAL_GPIOB_PMD, VAL_GPIOB_OFFD, VAL_GPIOB_DMASK, VAL_GPIOB_DBEN, VAL_GPIOB_IMD, VAL_GPIOB_IEN, VAL_GPIOB_ISRC, VAL_GPIOB_DOUT}, 31 # endif 32 # if NUC123_HAS_GPIOC 33 {VAL_GPIOC_PMD, VAL_GPIOC_OFFD, VAL_GPIOC_DMASK, VAL_GPIOC_DBEN, VAL_GPIOC_IMD, VAL_GPIOC_IEN, VAL_GPIOC_ISRC, VAL_GPIOC_DOUT}, 34 # endif 35 # if NUC123_HAS_GPIOD 36 {VAL_GPIOD_PMD, VAL_GPIOD_OFFD, VAL_GPIOD_DMASK, VAL_GPIOD_DBEN, VAL_GPIOD_IMD, VAL_GPIOD_IEN, VAL_GPIOD_ISRC, VAL_GPIOD_DOUT}, 37 # endif 38 # if NUC123_HAS_GPIOF 39 {VAL_GPIOF_PMD, VAL_GPIOF_OFFD, VAL_GPIOF_DMASK, VAL_GPIOF_DBEN, VAL_GPIOF_IMD, VAL_GPIOF_IEN, VAL_GPIOF_ISRC, VAL_GPIOF_DOUT}, 40 # endif 41 }; 42 #endif 43 44 /** 45 * @brief Early initialization code. 46 * @details This initialization must be performed just after stack setup 47 * and before any other initialization. 48 */ 49 void __early_init(void) { 50 NUC123_clock_init(); 51 } 52 53 /** 54 * @brief Board-specific initialization code. 55 * @todo Add your board-specific code, if any. 56 */ 57 void boardInit(void) {}