Zephyr C++ Toolkit
|
Real hardware implementation of the watchdog interface. More...
#include <WatchdogReal.hpp>
Public Member Functions | |
WatchdogReal (const char *name, const struct device *device) | |
Constructor. | |
~WatchdogReal () | |
Destructor. | |
int | installTimeout (uint32_t timeoutMs, CallbackFn callback=nullptr, void *userData=nullptr, ResetFlag flags=ResetFlag::ResetSoc) override |
Install a watchdog timeout configuration. | |
int | setup (Option options=Option::None) override |
Setup the watchdog with global configuration. | |
int | feed (int channelId) override |
Feed (service) a watchdog channel to prevent timeout. | |
int | disable () override |
Disable the watchdog instance. | |
const struct device * | getRawDevice () const override |
Get the raw watchdog device pointer. | |
![]() | |
IWatchdog (const char *name) | |
Constructor. | |
virtual | ~IWatchdog ()=default |
Virtual destructor. | |
const char * | getName () const |
Get the name of this watchdog instance. | |
Static Private Member Functions | |
static uint8_t | convertOptions (Option options) |
Convert IWatchdog::Option to Zephyr wdt options. | |
static uint8_t | convertResetFlags (ResetFlag flags) |
Convert IWatchdog::ResetFlag to Zephyr wdt flags. | |
static void | staticCallback (const struct device *dev, int channelId) |
Static callback function for Zephyr WDT API. | |
Private Attributes | |
const struct device * | m_device |
Zephyr watchdog device. | |
bool | m_isSetup |
Track if setup() has been called. | |
CallbackFn | m_callback |
User callback function. | |
void * | m_userData |
User data for callback. | |
Additional Inherited Members | |
![]() | |
enum class | Option : uint8_t { None = 0 , PauseInSleep = 1 , PauseHaltedByDebug = 2 } |
Watchdog configuration options. More... | |
enum class | ResetFlag : uint8_t { None = 0 , ResetCpuCore = 1 , ResetSoc = 2 } |
Watchdog reset behavior flags. More... | |
using | CallbackFn = std::function< void(int channelId, void *userData)> |
Watchdog callback function type. | |
![]() | |
const char * | m_name |
Name of this watchdog instance. | |
Real hardware implementation of the watchdog interface.
This class provides a C++ wrapper around Zephyr's watchdog driver API.
zct::WatchdogReal::WatchdogReal | ( | const char * | name, |
const struct device * | device | ||
) |
Constructor.
name | Name of the watchdog instance for logging purposes |
device | Pointer to the Zephyr watchdog device |
zct::WatchdogReal::~WatchdogReal | ( | ) |
Destructor.
|
staticprivate |
Convert IWatchdog::Option to Zephyr wdt options.
options | IWatchdog options |
|
staticprivate |
Convert IWatchdog::ResetFlag to Zephyr wdt flags.
flags | IWatchdog reset flags |
|
overridevirtual |
Disable the watchdog instance.
Implements zct::IWatchdog.
|
overridevirtual |
Feed (service) a watchdog channel to prevent timeout.
channelId | Channel ID to feed |
Implements zct::IWatchdog.
|
overridevirtual |
|
overridevirtual |
Install a watchdog timeout configuration.
timeoutMs | Timeout value in milliseconds |
callback | Callback function to execute on timeout (optional) |
userData | User data to pass to callback (optional) |
flags | Reset behavior flags |
options | Configuration options |
Implements zct::IWatchdog.
|
overridevirtual |
Setup the watchdog with global configuration.
options | Global watchdog options |
Implements zct::IWatchdog.
|
staticprivate |
Static callback function for Zephyr WDT API.
dev | Watchdog device |
channelId | Channel that timed out |
|
private |
User callback function.
|
private |
Zephyr watchdog device.
|
private |
Track if setup() has been called.
|
private |
User data for callback.