SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
PmicWatchdogBase Class Referenceabstract

#include <PmicWatchdogBase.hpp>

Inheritance diagram for PmicWatchdogBase:
[legend]

Public Member Functions

virtual ~PmicWatchdogBase ()=default
 Virtual destructor.
 
virtual bool enableWatchdog (bool enable)=0
 Enable or disable the watchdog timer.
 
virtual bool isWatchdogEnabled () const =0
 Check if watchdog is enabled.
 
virtual bool setWatchdogTimeout (uint16_t timeout_s)=0
 Set the watchdog timeout duration.
 
virtual uint16_t getWatchdogTimeout () const =0
 Get the current watchdog timeout setting.
 
virtual bool resetWatchdog ()=0
 Reset the watchdog timer (feed the watchdog).
 

Detailed Description

Definition at line 44 of file PmicWatchdogBase.hpp.

Constructor & Destructor Documentation

◆ ~PmicWatchdogBase()

virtual PmicWatchdogBase::~PmicWatchdogBase ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ enableWatchdog()

virtual bool PmicWatchdogBase::enableWatchdog ( bool  enable)
pure virtual

Enable or disable the watchdog timer.

When disabled, the PMIC will not monitor I2C communication. When enabled, the watchdog must be regularly reset (fed) to prevent timeout.

Parameters
enableTrue to enable watchdog, false to disable
Returns
true on success, false if not supported or I2C error

Implemented in SY6970Power, BQ25896Power, and AXP2101Watchdog.

◆ getWatchdogTimeout()

virtual uint16_t PmicWatchdogBase::getWatchdogTimeout ( ) const
pure virtual

Get the current watchdog timeout setting.

Returns
Timeout in seconds (0 if disabled, or chip-specific timeout value)

Implemented in SY6970Power, BQ25896Power, and AXP2101Watchdog.

◆ isWatchdogEnabled()

virtual bool PmicWatchdogBase::isWatchdogEnabled ( ) const
pure virtual

Check if watchdog is enabled.

Returns
true if watchdog is enabled

Implemented in SY6970Power, BQ25896Power, and AXP2101Watchdog.

◆ resetWatchdog()

virtual bool PmicWatchdogBase::resetWatchdog ( )
pure virtual

Reset the watchdog timer (feed the watchdog).

This must be called regularly before the watchdog timeout expires to prevent the PMIC from resetting due to I2C communication timeout.

Returns
true on success, false if not supported or I2C error
Note
Should be called at least once before the watchdog timeout. Recommended to call every 20-30 seconds for 40s timeout.

Implemented in SY6970Power, BQ25896Power, and AXP2101Watchdog.

◆ setWatchdogTimeout()

virtual bool PmicWatchdogBase::setWatchdogTimeout ( uint16_t  timeout_s)
pure virtual

Set the watchdog timeout duration.

Sets how long the watchdog will wait before triggering a fault. Must be called after enableWatchdog(true).

Parameters
timeout_sTimeout in seconds (chip-specific valid values, typically 0=disabled, 40, 80, 160)
Returns
true on success, false if not supported or I2C error
Note
Valid timeout values are chip-specific. Common values: 0=disabled, 40, 80, 160 seconds. Other chips may use different values - implementation should check and clamp.
See also
getWatchdogTimeout()

Implemented in SY6970Power, BQ25896Power, and AXP2101Watchdog.


The documentation for this class was generated from the following file: