Skip to content

Commit 14c5abb

Browse files
committed
Watchdog: use mbed API to enable and trigger watchdog
1 parent ffa84d1 commit 14c5abb

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: src/utility/watchdog/Watchdog.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
/******************************************************************************
4343
* GLOBAL VARIABLES
4444
******************************************************************************/
45-
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MBED)
45+
#if defined(ARDUINO_ARCH_SAMD)
4646
static bool is_watchdog_enabled = false;
4747
#endif
4848

@@ -96,18 +96,15 @@ static void mbed_watchdog_enable()
9696
# error "You need to define the maximum possible timeout for this architecture."
9797
#endif
9898

99-
if (hal_watchdog_init(&cfg) == WATCHDOG_STATUS_OK) {
100-
is_watchdog_enabled = true;
101-
}
102-
else {
99+
if (!mbed::Watchdog::get_instance().start(cfg.timeout_ms)) {
103100
DEBUG_WARNING("%s: watchdog could not be enabled", __FUNCTION__);
104101
}
105102
}
106103

107104
static void mbed_watchdog_reset()
108105
{
109-
if (is_watchdog_enabled) {
110-
hal_watchdog_kick();
106+
if (mbed::Watchdog::get_instance().is_running()) {
107+
mbed::Watchdog::get_instance().kick();
111108
}
112109
}
113110

0 commit comments

Comments
 (0)