libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
stm32_watchdog.hpp
1#pragma once
2
3#include "main.h"
4#include "watchdog.hpp"
5
6#if defined(HAL_IWDG_MODULE_ENABLED)
7
8namespace LibXR
9{
10
15class STM32Watchdog : public Watchdog
16{
17 public:
18 explicit STM32Watchdog(IWDG_HandleTypeDef* hiwdg, uint32_t timeout_ms = 1000,
19 uint32_t feed_ms = 250, uint32_t clock = LSI_VALUE);
20
21 ErrorCode SetConfig(const Configuration& config) override;
22
23 ErrorCode Feed() override;
24
25 ErrorCode Start() override;
26
27 ErrorCode Stop() override;
28
29 IWDG_HandleTypeDef* hiwdg_;
30 uint32_t clock_;
31};
32
33} // namespace LibXR
34
35#endif
STM32 IWDG 看门狗驱动 / STM32 independent watchdog driver.
uint32_t clock_
LSI clock in Hz.
ErrorCode Stop() override
停止看门狗 / Stop the watchdog
ErrorCode Start() override
启动看门狗 / Start the watchdog
IWDG_HandleTypeDef * hiwdg_
STM32 HAL IWDG handle.
ErrorCode Feed() override
立即手动喂狗 Feed the watchdog immediately
ErrorCode SetConfig(const Configuration &config) override
初始化硬件并设置超时时间 Initialize hardware and set overflow time
通用看门狗(Watchdog)抽象接口 General Watchdog interface for both thread and task style usage
Definition watchdog.hpp:14
LibXR 命名空间
Definition ch32_can.hpp:14
看门狗配置结构体 Configuration for the watchdog
Definition watchdog.hpp:27