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.

61 lines
1.6 KiB

2 years 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
1 year ago
1 year ago
2 years 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
1 year ago
2 years ago
2 years ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "configs/device_id_mgr.hpp"
  4. #include "gservice.hpp"
  5. #include "sdk/chip/chip.hpp"
  6. #include "sdk/os/zos.hpp"
  7. #include "subboards/subboard30_shake_module/subboard30_shake_module.hpp"
  8. #define TAG "main"
  9. using namespace std;
  10. using namespace iflytop;
  11. extern void umain();
  12. extern "C" {
  13. void StartDefaultTask(void const* argument) { umain(); }
  14. }
  15. void umain() {
  16. zos_cfg_t zoscfg = {0};
  17. chip_cfg_t chipcfg = {};
  18. chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER;
  19. chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER;
  20. chipcfg.huart = &PC_DEBUG_UART;
  21. chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO;
  22. chip_init(&chipcfg);
  23. zos_init(&zoscfg);
  24. zdevice_id_mgr_init();
  25. int32_t id = zdevice_id_mgr_get_device_id();
  26. ZEARLY_LOGI("SYS", "chip init ok");
  27. ZEARLY_LOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER);
  28. ZEARLY_LOGI("SYS", "= project name : %s", PC_PROJECT_NAME);
  29. ZEARLY_LOGI("SYS", "= version : %s", PC_VERSION);
  30. ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
  31. ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
  32. ZEARLY_LOGI("SYS", "= device id : %d", id);
  33. if (id <= 0) {
  34. chip_set_error();
  35. ZEARLY_LOGE("SYS", "device id is not set");
  36. while (true) {
  37. zos_delay(1);
  38. }
  39. }
  40. GService::inst()->initialize();
  41. switch (id) {
  42. case 30: // ҡ��ģ��
  43. Subboard30ShakeModule::ins()->initialize();
  44. break;
  45. default:
  46. break;
  47. }
  48. while (true) {
  49. GService::inst()->getZCanReceiver()->loop();
  50. zos_delay(1);
  51. }
  52. }