|
|
@ -1,10 +1,15 @@ |
|
|
|
#include "chip.hpp"
|
|
|
|
|
|
|
|
extern "C" { |
|
|
|
static iflytop::ZGPIO *g_debuglight = NULL; |
|
|
|
|
|
|
|
static iflytop::ZGPIO g_debuglight; |
|
|
|
static Pin_t g_debuglight_pin = PinNull; |
|
|
|
|
|
|
|
void chip_init(chip_cfg_t *cfg) { |
|
|
|
g_debuglight = cfg->debuglight; |
|
|
|
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); |
|
|
|
//
|
|
|
@ -18,8 +23,8 @@ void chip_init(chip_cfg_t *cfg) { |
|
|
|
|
|
|
|
iflytop::ChipTimIrqShceduler::instance().regPeriodJob( |
|
|
|
[](iflytop::ChipTimIrqShceduler::Job *job) { |
|
|
|
if (!g_debuglight) return; |
|
|
|
g_debuglight->toggleState(); |
|
|
|
if (g_debuglight_pin == PinNull) return; |
|
|
|
g_debuglight.toggleState(); |
|
|
|
}, |
|
|
|
100); |
|
|
|
|
|
|
|