hand_acid_mainboard
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.

83 lines
2.0 KiB

12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. //
  4. #include "base/appdep.hpp"
  5. //
  6. #include "base/protocol_processer_mgr.hpp"
  7. //
  8. #define TAG "main"
  9. using namespace iflytop;
  10. extern void umain();
  11. extern "C" {
  12. void StartDefaultTask(void const* argument) { umain(); }
  13. }
  14. /*******************************************************************************
  15. * MAIN *
  16. *******************************************************************************/
  17. extern "C" {
  18. // void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
  19. // }
  20. }
  21. // void debug_light_ctrl() {
  22. // static uint32_t lastcall = 0;
  23. // static bool light_status = false;
  24. // if (!gInitErrorFlag) {
  25. // if (zhas_passedms(lastcall) > 300) {
  26. // PublicBoard::ins()->toggleDebugLight();
  27. // lastcall = zget_ticket();
  28. // }
  29. // } else {
  30. // if (zhas_passedms(lastcall) > 30) {
  31. // PublicBoard::ins()->toggleDebugLight();
  32. // lastcall = zget_ticket();
  33. // }
  34. // }
  35. // }
  36. #define REG_PROCESSER(processer) ProtocolProcesserMgr::ins()->regProcesser(processer);
  37. /* IWDG init function */
  38. void MX_IWDG_Init(void) {
  39. hiwdg.Instance = IWDG;
  40. hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
  41. hiwdg.Init.Reload = 501;
  42. if (HAL_IWDG_Init(&hiwdg) != HAL_OK) {
  43. Error_Handler();
  44. }
  45. }
  46. void umain() {
  47. gBoardFlagSetResetFlag();
  48. deviceInfo_init();
  49. config_init();
  50. AppPeriodTaskMgr::ins()->initialize();
  51. ZLOGI(TAG, "======================= boardinfo ==================== ");
  52. ZLOGI(TAG, "project : %s ", PROJECT);
  53. ZLOGI(TAG, "version : %d ", SOFTWARE_VERSION);
  54. ZLOGI(TAG, "pversion : %d", deviceInfo_getProtocolVersion());
  55. ZLOGI(TAG, "sn : %s", sn_get_str());
  56. ZLOGI(TAG, "=");
  57. AppPeriodTaskMgr::ins()->startScheduler();
  58. ZLOGI(TAG, "======================= sysinfo ======================= ");
  59. SysMgr::ins()->initedFinished();
  60. SysMgr::ins()->dumpSysInfo();
  61. ZLOGI(TAG, "=");
  62. MX_IWDG_Init();
  63. while (true) {
  64. osDelay(30);
  65. // debug_light_ctrl();
  66. HAL_IWDG_Refresh(&hiwdg);
  67. }
  68. }