forked from arduino/ArduinoCore-mbed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request arduino#967 from pennam/wdog-kik-fix
patch: kick watchdog only if running
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
patches/0237-Watchdog-kick-only-if-watchdog-is-running.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From 81a7d47a15e76701b206bce907526b9d9d5888cc Mon Sep 17 00:00:00 2001 | ||
From: pennam <[email protected]> | ||
Date: Wed, 2 Oct 2024 11:31:36 +0200 | ||
Subject: [PATCH] Watchdog: kick only if watchdog is running | ||
|
||
--- | ||
drivers/source/Watchdog.cpp | 8 +++++--- | ||
1 file changed, 5 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/drivers/source/Watchdog.cpp b/drivers/source/Watchdog.cpp | ||
index 3f21b94dfb..daca018148 100644 | ||
--- a/drivers/source/Watchdog.cpp | ||
+++ b/drivers/source/Watchdog.cpp | ||
@@ -72,9 +72,11 @@ bool Watchdog::stop() | ||
|
||
void Watchdog::kick() | ||
{ | ||
- core_util_critical_section_enter(); | ||
- hal_watchdog_kick(); | ||
- core_util_critical_section_exit(); | ||
+ if (_running) { | ||
+ core_util_critical_section_enter(); | ||
+ hal_watchdog_kick(); | ||
+ core_util_critical_section_exit(); | ||
+ } | ||
} | ||
|
||
bool Watchdog::is_running() const | ||
-- | ||
2.45.2 | ||
|