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.

66 lines
1.8 KiB

2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "base/config_service.hpp"
  4. #include "base/device_info.hpp"
  5. #include "iwdg.h"
  6. #include "protocol_impl/protocol_impl_service.hpp"
  7. #include "zsdk/zcanreceiver/zcanreceiver.hpp"
  8. #include "zsdk/zsdk.hpp"
  9. #define TAG "main"
  10. using namespace iflytop;
  11. extern void umain();
  12. extern "C" {
  13. void StartDefaultTask(void const* argument) { umain(); }
  14. }
  15. /*******************************************************************************
  16. * MAIN *
  17. *******************************************************************************/
  18. extern "C" {
  19. // void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
  20. // }
  21. }
  22. ZGPIO m_debugled;
  23. void debug_light_ctrl() {
  24. static uint32_t lastcall = 0;
  25. static bool light_status = false;
  26. if (zhas_passedms(lastcall) > 100) {
  27. m_debugled.toggle();
  28. lastcall = zget_ticket();
  29. }
  30. }
  31. void umain() {
  32. m_debugled.initAsOutput(DEBUG_LIGHT_GPIO, kxs_gpio_nopull, false, false);
  33. config_init();
  34. deviceInfo_init();
  35. ZLOGI(TAG, "======================= boardinfo ==================== ");
  36. ZLOGI(TAG, "project : %s ", PROJECT);
  37. ZLOGI(TAG, "version : %d ", SOFTWARE_VERSION);
  38. ZLOGI(TAG, "pversion: %d", deviceInfo_getProtocolVersion());
  39. ZLOGI(TAG, "sn : %s", sn_get_str());
  40. ZLOGI(TAG, "boardId : %d", deviceInfo_getBoardId());
  41. ZLOGI(TAG, "=");
  42. HAL_IWDG_Refresh(&hiwdg);
  43. ZLOGI(TAG, "======================= init info ==================== ");
  44. protocol_impl_service_init();
  45. ZLOGI(TAG, "=");
  46. ZLOGI(TAG, "======================= sysinfo ======================= ");
  47. HAL_IWDG_Refresh(&hiwdg);
  48. SysMgr::ins()->initedFinished();
  49. SysMgr::ins()->dumpSysInfo();
  50. ZLOGI(TAG, "=");
  51. while (true) {
  52. osDelay(1);
  53. HAL_IWDG_Refresh(&hiwdg);
  54. debug_light_ctrl();
  55. }
  56. }