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
16class STM32Watchdog : public Watchdog
17{
18 public:
19 explicit STM32Watchdog(IWDG_HandleTypeDef* hiwdg, uint32_t timeout_ms = 1000,
20 uint32_t feed_ms = 250, uint32_t clock = LSI_VALUE);
21
22 ErrorCode SetConfig(const Configuration& config) override;
23
24 ErrorCode Feed() override;
25
26 ErrorCode Start() override;
27
28 ErrorCode Stop() override;
29
30 IWDG_HandleTypeDef* hiwdg_;
31 uint32_t clock_;
32};
33
34} // namespace LibXR
35
36#endif
STM32 IWDG 独立看门狗 / Independent Watchdog.
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_gpio.hpp:9
看门狗配置结构体 Configuration for the watchdog
Definition watchdog.hpp:27