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.

76 lines
2.0 KiB

2 years 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
2 years 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
1 year ago
1 year 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
2 years ago
2 years ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "configs/device_id_mgr.hpp"
  4. #include "public_service/public_service.hpp"
  5. #include "sdk/chip/chip.hpp"
  6. #include "sdk/os/zos.hpp"
  7. #include "subboards/subboard30_shake_module/subboard30_shake_module.hpp"
  8. #include "subboards/subboard30_shake_module/subboard30_shake_module_board.h"
  9. #include "sysmgr/sys_mgr.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. int32_t id = zdevice_id_mgr_get_device_id();
  19. switch (id) {
  20. case 30: // 摇匀模组
  21. subboard30_shake_module_board_init();
  22. break;
  23. default:
  24. common_hardware_init();
  25. break;
  26. }
  27. zos_cfg_t zoscfg = {0};
  28. chip_cfg_t chipcfg = {};
  29. chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER;
  30. chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER;
  31. chipcfg.huart = &PC_DEBUG_UART;
  32. chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO;
  33. chip_init(&chipcfg);
  34. zos_init(&zoscfg);
  35. zdevice_id_mgr_init();
  36. ZEARLY_LOGI("SYS", "chip init ok");
  37. ZEARLY_LOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER);
  38. ZEARLY_LOGI("SYS", "= project name : %s", PC_PROJECT_NAME);
  39. ZEARLY_LOGI("SYS", "= version : %s", PC_VERSION);
  40. ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
  41. ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
  42. ZEARLY_LOGI("SYS", "= device id : %d", id);
  43. if (id <= 0) {
  44. chip_set_error();
  45. ZEARLY_LOGE("SYS", "device id is not set");
  46. while (true) {
  47. zos_delay(1);
  48. }
  49. }
  50. GService::inst()->initialize();
  51. switch (id) {
  52. case 30: // 摇匀模组
  53. Subboard30ShakeModule::ins()->initialize();
  54. break;
  55. default:
  56. break;
  57. }
  58. ZLOGI(TAG, "======================= sysinfo ======================= ");
  59. SysMgr::ins()->initedFinished();
  60. SysMgr::ins()->dumpSysInfo();
  61. ZLOGI(TAG, "=");
  62. while (true) {
  63. GService::inst()->getZCanReceiver()->loop();
  64. zos_delay(1);
  65. }
  66. }