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.

32 lines
1.0 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #include "chip.hpp"
  2. extern "C" {
  3. static iflytop::ZGPIO *g_debuglight = NULL;
  4. void chip_init(chip_cfg_t *cfg) {
  5. g_debuglight = cfg->debuglight;
  6. //
  7. zchip_loggger_init(cfg->huart);
  8. //
  9. zchip_clock_cfg_t zchip_clock_cfg;
  10. zchip_clock_cfg.usdleaytim = cfg->us_dleay_tim;
  11. zchip_clock_init(&zchip_clock_cfg);
  12. //
  13. iflytop::ChipTimIrqShceduler::Cfg ChipTimIrqShceduler_cfg;
  14. ChipTimIrqShceduler_cfg.schedulertim = cfg->tim_irq_scheduler_tim;
  15. iflytop::ChipTimIrqShceduler::instance().initialize(&ChipTimIrqShceduler_cfg);
  16. iflytop::ChipTimIrqShceduler::instance().regPeriodJob(
  17. [](iflytop::ChipTimIrqShceduler::Job *job) {
  18. if (!g_debuglight) return;
  19. g_debuglight->toggleState();
  20. },
  21. 100);
  22. ZLOGI("SYS", "chip init ok");
  23. ZLOGI("SYS", "= manufacturer : %s", MANUFACTURER);
  24. ZLOGI("SYS", "= project name : %s", PROJECT_NAME);
  25. ZLOGI("SYS", "= version : %s", VERSION);
  26. ZLOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
  27. ZLOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
  28. }
  29. }