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.

53 lines
1.4 KiB

2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years 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
2 years 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 "sdk/chip/chip.hpp"
  7. #include "sdk/os/zos.hpp"
  8. #include "subboards/subboard30_shake_module/subboard30_shake_module.hpp"
  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. zos_cfg_t zoscfg = {0};
  18. chip_cfg_t chipcfg = {};
  19. chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER;
  20. chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER;
  21. chipcfg.huart = &PC_DEBUG_UART;
  22. chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO;
  23. chip_init(&chipcfg);
  24. zos_init(&zoscfg);
  25. zdevice_id_mgr_init();
  26. int32_t id = zdevice_id_mgr_get_device_id();
  27. ZEARLY_LOGI("SYS", "chip init ok");
  28. ZEARLY_LOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER);
  29. ZEARLY_LOGI("SYS", "= project name : %s", PC_PROJECT_NAME);
  30. ZEARLY_LOGI("SYS", "= version : %s", PC_VERSION);
  31. ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
  32. ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
  33. ZEARLY_LOGI("SYS", "= device id : %d", id);
  34. if (id <= 0) {
  35. chip_set_error();
  36. ZEARLY_LOGE("SYS", "device id is not set");
  37. } else {
  38. if (id == 30) {
  39. Subboard30ShakeModule::ins()->initializeAndRun();
  40. }
  41. }
  42. while (true) {
  43. zos_delay(1);
  44. }
  45. }