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.

70 lines
1.9 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
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
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. #define TAG "main"
  10. using namespace std;
  11. using namespace iflytop;
  12. extern void umain();
  13. extern "C" {
  14. void StartDefaultTask(void const* argument) { umain(); }
  15. }
  16. void umain() {
  17. int32_t id = zdevice_id_mgr_get_device_id();
  18. switch (id) {
  19. case 30: // 摇匀模组
  20. subboard30_shake_module_board_init();
  21. break;
  22. default:
  23. common_hardware_init();
  24. break;
  25. }
  26. zos_cfg_t zoscfg = {0};
  27. chip_cfg_t chipcfg = {};
  28. chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER;
  29. chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER;
  30. chipcfg.huart = &PC_DEBUG_UART;
  31. chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO;
  32. chip_init(&chipcfg);
  33. zos_init(&zoscfg);
  34. zdevice_id_mgr_init();
  35. ZEARLY_LOGI("SYS", "chip init ok");
  36. ZEARLY_LOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER);
  37. ZEARLY_LOGI("SYS", "= project name : %s", PC_PROJECT_NAME);
  38. ZEARLY_LOGI("SYS", "= version : %s", PC_VERSION);
  39. ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
  40. ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
  41. ZEARLY_LOGI("SYS", "= device id : %d", id);
  42. if (id <= 0) {
  43. chip_set_error();
  44. ZEARLY_LOGE("SYS", "device id is not set");
  45. while (true) {
  46. zos_delay(1);
  47. }
  48. }
  49. GService::inst()->initialize();
  50. switch (id) {
  51. case 30: // 摇匀模组
  52. Subboard30ShakeModule::ins()->initialize();
  53. break;
  54. default:
  55. break;
  56. }
  57. while (true) {
  58. GService::inst()->getZCanReceiver()->loop();
  59. zos_delay(1);
  60. }
  61. }