Files
DCU_APP/GD32E508_DCU_APP/device/watchdog.cpp
T
cbb 76da7a3dd6 Refactor and clean up codebase
- Removed unused constants and type aliases in app_spi_command_defs.h and temp_sensor.h.
- Simplified ISpiCommandHandler destructor to default.
- Eliminated redundant methods and comments in temp_sensor and usart0 files.
- Consolidated writeU32Le function to app_spi_command_defs.h for reuse.
- Updated comments for clarity and accuracy in task_manager.h and task_runner.cpp.
- Removed hardfault.h as it contained no declarations.
- Cleaned up CANFD and watchdog implementations by removing dead code and unnecessary comments.
- Updated version numbers in config.h to reflect recent changes.
- Enhanced error handling and diagnostics in hardfault handling.
2026-07-15 02:49:37 +08:00

27 lines
544 B
C++

/**
* @file watchdog.cpp
* @brief APP 独立看门狗(FWDGT)实现。
*
* 时钟源: IRC40K (~40 KHz)
* 预分频: CONFIG_FWDGT_PSC, 重载值: CONFIG_FWDGT_RLD
* 超时 = (PSC / 40000) * (RLD + 1) 秒
*/
#include "device/watchdog.h"
#include "sys/config.h"
#include "main.h"
void Watchdog::init()
{
fwdgt_write_enable();
fwdgt_prescaler_value_config(CONFIG_FWDGT_PSC);
fwdgt_reload_value_config(CONFIG_FWDGT_RLD);
fwdgt_write_disable();
fwdgt_enable();
}
void Watchdog::feed()
{
fwdgt_counter_reload();
}