59 lines
899 B
C
59 lines
899 B
C
|
|
#include <debug.h>
|
|
#include "interface_config.h"
|
|
#include "ch32v30x_iwdg.h"
|
|
|
|
Timer boot_timer_interface;
|
|
|
|
// 喂狗
|
|
void feedWatchdog(void)
|
|
{
|
|
IWDG_ReloadCounter(); //外部wdt喂狗
|
|
}
|
|
|
|
|
|
void bootmian(void *signal_id)
|
|
{
|
|
//------------------------------------------------------------------------------
|
|
(void)signal_id; // 标记变量为已使用,避免编译器警告
|
|
feedWatchdog();
|
|
|
|
timerStart(&boot_timer_interface, 100,1);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// APP模块的初始化
|
|
void bootInterfaceInit(void)
|
|
{
|
|
// 初始化定时器
|
|
timerInit(&boot_timer_interface);
|
|
// 订阅定时器信号,用于定时采集
|
|
subscribe(&boot_timer_interface, bootmian);
|
|
|
|
timerStart(&boot_timer_interface, 100,1); //15ms
|
|
|
|
feedWatchdog();//喂狗,初始化完毕先喂一次
|
|
|
|
printf("bootInterface: initial OK %d\n",getCurrentTime());
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|