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.

57 lines
1.4 KiB

2 years 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
2 years 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 "protocol_impl/protocol_impl_service.hpp"
  6. #include "zsdk/zcanreceiver/zcanreceiver.hpp"
  7. #include "zsdk/zsdk.hpp"
  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. ZGPIO m_debugled;
  22. void debug_light_ctrl() {
  23. static uint32_t lastcall = 0;
  24. static bool light_status = false;
  25. if (zhas_passedms(lastcall) > 100) {
  26. m_debugled.toggle();
  27. lastcall = zget_ticket();
  28. }
  29. }
  30. void umain() {
  31. m_debugled.initAsOutput(DEBUG_LIGHT_GPIO, kxs_gpio_nopull, false, false);
  32. config_init();
  33. deviceInfo_init();
  34. ZLOGI(TAG, "%s ", PROJECT);
  35. ZLOGI(TAG, "version : %d ", SOFTWARE_VERSION);
  36. ZLOGI(TAG, "pversion: %d", deviceInfo_getProtocolVersion());
  37. ZLOGI(TAG, "sn : %s", sn_get_str());
  38. ZLOGI(TAG, "boardId : %d", deviceInfo_getBoardId());
  39. protocol_impl_service_init();
  40. ZLOGI(TAG, "system init done");
  41. SysMgr::ins()->regTaskId(osThreadGetId());
  42. while (true) {
  43. osDelay(1);
  44. debug_light_ctrl();
  45. }
  46. }