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.

63 lines
1.6 KiB

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