From 2b7e27db4ae8b0a39606490b17dbad562d64f1bd Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sun, 28 Sep 2025 21:03:59 +0200 Subject: nrf/wdt: erase instance generic --- embassy-nrf/src/wdt.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'embassy-nrf') diff --git a/embassy-nrf/src/wdt.rs b/embassy-nrf/src/wdt.rs index 7ab9adc29..dc99a16f5 100644 --- a/embassy-nrf/src/wdt.rs +++ b/embassy-nrf/src/wdt.rs @@ -66,11 +66,11 @@ impl Default for Config { } /// Watchdog driver. -pub struct Watchdog { - _wdt: Peri<'static, T>, +pub struct Watchdog { + r: pac::wdt::Wdt, } -impl Watchdog { +impl Watchdog { /// Try to create a new watchdog driver. /// /// This function will return an error if the watchdog is already active @@ -79,7 +79,7 @@ impl Watchdog { /// /// `N` must be between 1 and 8, inclusive. #[inline] - pub fn try_new( + pub fn try_new( wdt: Peri<'static, T>, config: Config, ) -> Result<(Self, [WatchdogHandle; N]), Peri<'static, T>> { @@ -116,7 +116,7 @@ impl Watchdog { r.tasks_start().write_value(1); } - let this = Self { _wdt: wdt }; + let this = Self { r: T::REGS }; let mut handles = [const { WatchdogHandle { index: 0 } }; N]; for i in 0..N { @@ -135,7 +135,7 @@ impl Watchdog { /// interrupt has been enabled. #[inline(always)] pub fn enable_interrupt(&mut self) { - T::REGS.intenset().write(|w| w.set_timeout(true)); + self.r.intenset().write(|w| w.set_timeout(true)); } /// Disable the watchdog interrupt. @@ -143,7 +143,7 @@ impl Watchdog { /// NOTE: This has no effect on the reset caused by the Watchdog. #[inline(always)] pub fn disable_interrupt(&mut self) { - T::REGS.intenclr().write(|w| w.set_timeout(true)); + self.r.intenclr().write(|w| w.set_timeout(true)); } /// Is the watchdog still awaiting pets from any handle? @@ -152,9 +152,8 @@ impl Watchdog { /// handles to prevent a reset this time period. #[inline(always)] pub fn awaiting_pets(&self) -> bool { - let r = T::REGS; - let enabled = r.rren().read().0; - let status = r.reqstatus().read().0; + let enabled = self.r.rren().read().0; + let status = self.r.reqstatus().read().0; (status & enabled) == 0 } } -- cgit