logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

board.c (3566B)


  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. ChibiOS - Copyright (C) 2023..2025 HorrorTroll
  4. ChibiOS - Copyright (C) 2023..2025 Zhaqian
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. */
  15. #include "hal.h"
  16. /*===========================================================================*/
  17. /* Driver local definitions. */
  18. /*===========================================================================*/
  19. /*===========================================================================*/
  20. /* Driver exported variables. */
  21. /*===========================================================================*/
  22. /*===========================================================================*/
  23. /* Driver local variables and types. */
  24. /*===========================================================================*/
  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. #if HAL_USE_PAL || defined(__DOXYGEN__)
  31. const PALConfig pal_default_config =
  32. {
  33. {VAL_GPIOAODT, VAL_GPIOACFGLR, VAL_GPIOACFGHR},
  34. {VAL_GPIOBODT, VAL_GPIOBCFGLR, VAL_GPIOBCFGHR},
  35. #if AT32_HAS_GPIOC
  36. {VAL_GPIOCODT, VAL_GPIOCCFGLR, VAL_GPIOCCFGHR},
  37. #endif
  38. {VAL_GPIODODT, VAL_GPIODCFGLR, VAL_GPIODCFGHR},
  39. #if AT32_HAS_GPIOF
  40. {VAL_GPIOFODT, VAL_GPIOFCFGLR, VAL_GPIOFCFGHR},
  41. #endif
  42. };
  43. #endif
  44. /*===========================================================================*/
  45. /* Driver local functions. */
  46. /*===========================================================================*/
  47. /*===========================================================================*/
  48. /* Driver interrupt handlers. */
  49. /*===========================================================================*/
  50. /*===========================================================================*/
  51. /* Driver exported functions. */
  52. /*===========================================================================*/
  53. /**
  54. * @brief Early initialization code.
  55. * @details System clocks are initialized before everything else.
  56. */
  57. void __early_init(void) {
  58. at32_clock_init();
  59. }
  60. #if HAL_USE_SDC || defined(__DOXYGEN__)
  61. /**
  62. * @brief SDC card detection.
  63. */
  64. bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
  65. static bool last_status = false;
  66. if (blkIsTransferring(sdcp))
  67. return last_status;
  68. return last_status = (bool)palReadPad(GPIOC, GPIOC_PIN11);
  69. }
  70. /**
  71. * @brief SDC card write protection detection.
  72. */
  73. bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
  74. (void)sdcp;
  75. return false;
  76. }
  77. #endif /* HAL_USE_SDC */
  78. /**
  79. * @brief Board-specific initialization code.
  80. * @note You can add your board-specific code here.
  81. */
  82. void boardInit(void) {
  83. IOMUX->REMAP |= IOMUX_REMAP_SWJTAG_MUX_JTAGDIS;
  84. }