Skip to content

Commit 9bbef41

Browse files
author
James Munns
committed
Make it clear that these dogs need petting, stat!
1 parent 89a488b commit 9bbef41

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/wdt-demo/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,15 @@ const APP: () = {
8888
handles
8989
}
9090
Err(wdt) => match Watchdog::try_recover::<count::Four>(wdt) {
91-
Ok(Parts { handles, .. }) => {
91+
Ok(Parts { mut handles, .. }) => {
9292
rprintln!("Oops, watchdog already active, but recovering!");
93+
94+
// Pet all the dogs quickly to reset to default timeout
95+
handles.0.pet();
96+
handles.1.pet();
97+
handles.2.pet();
98+
handles.3.pet();
99+
93100
handles
94101
}
95102
Err(_wdt) => {

nrf-hal-common/src/wdt.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ impl Watchdog<Active> {
173173
/// number of requested handles matches the activated number of handles,
174174
/// an activated handle will be returned. Otherwise the peripheral will
175175
/// be returned
176+
///
177+
/// NOTE: Since the watchdog is already counting, you want to pet these dogs
178+
/// as soon as possible!
176179
pub fn try_recover<H: sealed::Handles>(wdt: WDT) -> Result<Parts<H::Handles>, WDT> {
177180
// Do we have the same number of handles at least?
178181
if wdt.rren.read().bits() == H::ENABLE {

0 commit comments

Comments
 (0)