From a4772c15c0df5939492361f43ab65a94eca70785 Mon Sep 17 00:00:00 2001 From: kalkyl Date: Wed, 17 May 2023 00:16:36 +0200 Subject: [PATCH] rp: Add system reset fn via watchdog --- embassy-rp/src/watchdog.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/embassy-rp/src/watchdog.rs b/embassy-rp/src/watchdog.rs index 3631b2a9..78a295ae 100644 --- a/embassy-rp/src/watchdog.rs +++ b/embassy-rp/src/watchdog.rs @@ -106,4 +106,17 @@ impl Watchdog { self.load_counter(self.load_value); self.enable(true); } + + /// Trigger a system reset + pub fn trigger_reset(&mut self) { + unsafe { + self.configure_wdog_reset_triggers(); + self.pause_on_debug(false); + self.enable(true); + let watchdog = pac::WATCHDOG; + watchdog.ctrl().write(|w| { + w.set_trigger(true); + }) + } + } }