|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
I2C watchdog timer control for the AXP2101 PMIC. More...
#include <AXP2101Watchdog.hpp>
Public Member Functions | |
| AXP2101Watchdog (AXP2101Core &core) | |
| ~AXP2101Watchdog ()=default | |
| bool | enableWatchdog (bool enable) override |
| Enable or disable the watchdog timer. | |
| bool | isWatchdogEnabled () const override |
| Check whether the watchdog timer is enabled. | |
| bool | setWatchdogTimeout (uint16_t timeout_s) override |
| Set the watchdog timeout duration. | |
| uint16_t | getWatchdogTimeout () const override |
| Get the current watchdog timeout setting. | |
| bool | resetWatchdog () override |
| Reset (pet) the watchdog timer. | |
Public Member Functions inherited from PmicWatchdogBase | |
| virtual | ~PmicWatchdogBase ()=default |
| Virtual destructor. | |
I2C watchdog timer control for the AXP2101 PMIC.
The watchdog monitors I2C bus activity. If no communication occurs within the configured timeout, the PMIC resets suspect registers to their default values. Regular calls to resetWatchdog() are required to prevent timeout expiry.
Supported timeout values: 1, 2, 4, 8, 16, 32, 64, 128 seconds. Watchdog behaviour (IRQ only / IRQ+reset) is configured via AXP2101Core::setWatchdogConfig(), default is IRQ Only.
Definition at line 47 of file AXP2101Watchdog.hpp.
|
explicit |
Definition at line 38 of file AXP2101Watchdog.cpp.
|
default |
|
overridevirtual |
Enable or disable the watchdog timer.
| enable | true to enable (default 64s timeout), false to disable. |
Implements PmicWatchdogBase.
Definition at line 42 of file AXP2101Watchdog.cpp.
References AXP2101Core::enableModule(), and AXP2101Core::WATCHDOG.
|
overridevirtual |
Get the current watchdog timeout setting.
Implements PmicWatchdogBase.
Definition at line 69 of file AXP2101Watchdog.cpp.
References SensorCommWrapper::readReg(), and axp2101_regs::ctrl::WDT_CTRL.
|
overridevirtual |
Check whether the watchdog timer is enabled.
Implements PmicWatchdogBase.
Definition at line 47 of file AXP2101Watchdog.cpp.
References AXP2101Core::isModuleEnabled(), and AXP2101Core::WATCHDOG.
|
overridevirtual |
Reset (pet) the watchdog timer.
Must be called at least once before the timeout expires to prevent register reset. Recommended interval is half the configured timeout period.
Implements PmicWatchdogBase.
Definition at line 79 of file AXP2101Watchdog.cpp.
References SensorCommWrapper::setRegBit(), and axp2101_regs::ctrl::WDT_CTRL.
|
overridevirtual |
Set the watchdog timeout duration.
Valid values: 1, 2, 4, 8, 16, 32, 64, 128 seconds. Other values will be rejected (return false).
| timeout_s | Timeout in seconds. |
Implements PmicWatchdogBase.
Definition at line 52 of file AXP2101Watchdog.cpp.
References SensorCommWrapper::updateBits(), and axp2101_regs::ctrl::WDT_CTRL.