26 lines
681 B
C++
26 lines
681 B
C++
/**
|
|||
|
|
* @file watchdog.h
|
||
|
|
* @brief APP 独立看门狗模块(FWDGT)。
|
||
|
|
*
|
||
|
|
* 超时后系统硬复位,BOOT 检测 FWDGT 复位标志后停留在 OTA 等待模式,
|
||
|
|
* 而非继续跳入卡死的 APP。
|
||
|
|
*/
|
||
|
|
#ifndef DEVICE_WATCHDOG_H
|
||
|
|
#define DEVICE_WATCHDOG_H
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
class Watchdog {
|
||
|
|
public:
|
||
|
|
/** @brief 初始化并启动 FWDGT,超时约 CONFIG_FWDGT_TIMEOUT_MS 毫秒。 */
|
||
|
|
static void init();
|
||
|
|
|
||
|
|
/** @brief 喂狗(重载计数器),应在主循环中周期调用。 */
|
||
|
|
static void feed();
|
||
|
|
|
||
|
|
/** @brief 停止喂狗,让看门狗自然超时触发复位跳转 BOOT。 */
|
||
|
|
static void abandon();
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif /* DEVICE_WATCHDOG_H */
|