基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.6 KiB

  1. //
  2. // Created by iflyt on 2025/2/27.
  3. //
  4. #include "bsp.h"
  5. #include "LED/button_manager.h"
  6. /*
  7. *********************************************************************************************************
  8. * : bsp_Init
  9. * : CPU寄存器和外设的寄存器并初始化一些全局变量
  10. *
  11. * :
  12. *********************************************************************************************************
  13. */
  14. void bsp_Init(void)
  15. {
  16. /*
  17. STM32H7xx HAL H7自带的64MHzHSI时钟:
  18. - HAL_InitTick1ms
  19. - NVIV优先级分组为4
  20. */
  21. // HAL_Init();
  22. /*
  23. 400MHz
  24. - 使HSE
  25. - SystemCoreClockHAL_InitTick
  26. */
  27. // SystemClock_Config();
  28. DBG_UART_Init();
  29. CAN1_Init();
  30. LED_Init();
  31. #if 1
  32. EX_GPIO_Init(); // 外部中断初始化
  33. MYI2C_Init(&SENx,2000,0x38); //温湿度传感器 2000:读取数据周期2S; 0x38:AHT20地址
  34. MX_ADC1_Init();
  35. #endif
  36. #if 0
  37. app_init();
  38. #endif
  39. }
  40. #if 0
  41. /*
  42. *********************************************************************************************************
  43. * : Error_Handler
  44. * : file : __FILE__
  45. * line __LINE__
  46. * :
  47. * Error_Handler(__FILE__, __LINE__);
  48. *********************************************************************************************************
  49. */
  50. void Error_Handler(char *file, uint32_t line)
  51. {
  52. /*
  53. printf("Wrong parameters value: file %s on line %d\r\n", file, line)
  54. */
  55. /* 这是一个死循环,断言失败时程序会在此处死机,以便于用户查错 */
  56. __disable_irq();
  57. if (line == 0)
  58. {
  59. return;
  60. }
  61. /* USER CODE BEGIN Error_Handler_Debug */
  62. /* User can add his own implementation to report the HAL error return state */
  63. while (1)
  64. {
  65. }
  66. /* USER CODE END Error_Handler_Debug */
  67. }
  68. /**
  69. * @brief This function is executed in case of error occurrence.
  70. * @retval None
  71. */
  72. void Error_Handler(void)
  73. {
  74. /* USER CODE BEGIN Error_Handler_Debug */
  75. /* User can add his own implementation to report the HAL error return state */
  76. __disable_irq();
  77. while (1)
  78. {
  79. }
  80. /* USER CODE END Error_Handler_Debug */
  81. }
  82. #endif