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.
38 lines
1.2 KiB
38 lines
1.2 KiB
#include "chip.hpp"
|
|
|
|
extern "C" {
|
|
|
|
static iflytop::ZGPIO g_debuglight;
|
|
static Pin_t g_debuglight_pin = PinNull;
|
|
|
|
void chip_init(chip_cfg_t *cfg) {
|
|
g_debuglight_pin = cfg->debuglight;
|
|
if (g_debuglight_pin != PinNull) {
|
|
g_debuglight.initAsOutput(g_debuglight_pin, iflytop::ZGPIO::kMode_nopull, false, false);
|
|
}
|
|
//
|
|
zchip_loggger_init(cfg->huart);
|
|
//
|
|
zchip_clock_cfg_t zchip_clock_cfg;
|
|
zchip_clock_cfg.usdleaytim = cfg->us_dleay_tim;
|
|
zchip_clock_init(&zchip_clock_cfg);
|
|
//
|
|
iflytop::ChipTimIrqShceduler::Cfg ChipTimIrqShceduler_cfg;
|
|
ChipTimIrqShceduler_cfg.schedulertim = cfg->tim_irq_scheduler_tim;
|
|
iflytop::ChipTimIrqShceduler::instance().initialize(&ChipTimIrqShceduler_cfg);
|
|
|
|
iflytop::ChipTimIrqShceduler::instance().regPeriodJob(
|
|
[](iflytop::ChipTimIrqShceduler::Job *job) {
|
|
if (g_debuglight_pin == PinNull) return;
|
|
g_debuglight.toggleState();
|
|
},
|
|
300);
|
|
|
|
ZLOGI("SYS", "chip init ok");
|
|
ZLOGI("SYS", "= manufacturer : %s", MANUFACTURER);
|
|
ZLOGI("SYS", "= project name : %s", PROJECT_NAME);
|
|
ZLOGI("SYS", "= version : %s", VERSION);
|
|
ZLOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
|
|
ZLOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
|
|
}
|
|
}
|