diff --git a/src/utility/watchdog/Watchdog.cpp b/src/utility/watchdog/Watchdog.cpp index 19034026b..c46ff0949 100644 --- a/src/utility/watchdog/Watchdog.cpp +++ b/src/utility/watchdog/Watchdog.cpp @@ -42,7 +42,7 @@ /****************************************************************************** * GLOBAL VARIABLES ******************************************************************************/ -#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MBED) +#if defined(ARDUINO_ARCH_SAMD) static bool is_watchdog_enabled = false; #endif @@ -96,18 +96,15 @@ static void mbed_watchdog_enable() # error "You need to define the maximum possible timeout for this architecture." #endif - if (hal_watchdog_init(&cfg) == WATCHDOG_STATUS_OK) { - is_watchdog_enabled = true; - } - else { + if (!mbed::Watchdog::get_instance().start(cfg.timeout_ms)) { DEBUG_WARNING("%s: watchdog could not be enabled", __FUNCTION__); } } static void mbed_watchdog_reset() { - if (is_watchdog_enabled) { - hal_watchdog_kick(); + if (mbed::Watchdog::get_instance().is_running()) { + mbed::Watchdog::get_instance().kick(); } }