main.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2006-2025, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-01-22 RT-Thread first version
  9. */
  10. #include <rtthread.h>
  11. #include <board.h>
  12. #include <rtdevice.h>
  13. #define DBG_ENABLE
  14. #define DBG_COLOR
  15. #define DBG_TAG "main"
  16. #define DBG_LVL DBG_LOG
  17. #include <rtdbg.h>
  18. #include <ledblink.h>
  19. #include <control.h>
  20. #include "beep.h"
  21. #include "hmi.h"
  22. Device_Status_typedef device_status;
  23. #define CompileTime sprintf(device_status.driver_compile,"%s-%s",__DATE__,__TIME__) //编译时间,每次更新代码修改
  24. int clock_information(void);
  25. int main(void)
  26. {
  27. __HAL_RCC_PWR_CLK_ENABLE();
  28. __HAL_RCC_BKP_CLK_ENABLE();
  29. HAL_PWR_EnableBkUpAccess();
  30. uint16_t boot_flag = *(__IO uint16_t *)(BKP_BASE + 4 * 2); /* RTC_BKP_DR2, 16-bit */
  31. //打印boot_flag的值
  32. LOG_I("boot_flag:0x%04x\n",boot_flag);
  33. /* 清除 bootloader 的启动标志,表示 app 启动成功 */
  34. *(__IO uint16_t *)(0x40006C00 + 4 * 2) = 0x0000;
  35. CompileTime; //读取固件的编译时间
  36. led_add_device(LED0_PIN);
  37. led_set_level(1,0);
  38. clock_information();
  39. Beep_Tip(100);
  40. #if BZYV13_EN == 0
  41. ctr_router(ON); //2.0-屏幕
  42. #else
  43. ctr_Heat(ON); //1.3-屏幕
  44. #endif
  45. Check_ParamConfig();
  46. //打印内存占用
  47. memtrace(0, NULL);
  48. while(1)
  49. {
  50. if(device_status.update_flag == 1)
  51. {
  52. rt_thread_mdelay(100);
  53. }else{
  54. rt_thread_mdelay(1000);
  55. }
  56. led_tog(1);
  57. }
  58. return RT_EOK;
  59. }