From e86def99f9bd5d6dd14c20e41bef4f14b8df6de3 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Tue, 20 Jul 2021 13:57:27 +0300 Subject: [PATCH] Add Disable and use the avrlibc wdt functions --- src/hal/avr/watchdog.cpp | 7 ++++++- src/hal/watchdog.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hal/avr/watchdog.cpp b/src/hal/avr/watchdog.cpp index 86f1b52..7717b58 100644 --- a/src/hal/avr/watchdog.cpp +++ b/src/hal/avr/watchdog.cpp @@ -1,4 +1,5 @@ #include "../watchdog.h" +#include namespace hal { namespace watchdog { @@ -7,8 +8,12 @@ void Enable(uint16_t period) { // @@TODO } +void Disable() { + wdt_disable(); +} + void Reset() { - asm("wdr"); + wdt_reset(); } } // namespace watchdog diff --git a/src/hal/watchdog.h b/src/hal/watchdog.h index c585281..592f6f3 100644 --- a/src/hal/watchdog.h +++ b/src/hal/watchdog.h @@ -8,6 +8,7 @@ namespace watchdog { /// watchdog interface void Enable(uint16_t period); +void Disable(); void Reset(); } // namespace watchdog