Skip to content

Commit 2d8930b

Browse files
committed
Adding WDT to nRF9160.
1 parent d2eacea commit 2d8930b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

nrf-hal-common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub mod uart;
7878
pub mod uarte;
7979
#[cfg(not(feature = "9160"))]
8080
pub mod uicr;
81-
#[cfg(not(feature = "9160"))]
8281
pub mod wdt;
8382

8483
pub mod prelude {

nrf-hal-common/src/wdt.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@
33
//! This HAL implements a basic watchdog timer with 1..=8 handles.
44
//! Once the watchdog has been started, it cannot be stopped.
55
6-
use crate::pac::WDT;
6+
use cfg_if::cfg_if;
7+
8+
cfg_if! {
9+
if #[cfg(feature = "9160")]{
10+
use crate::pac::WDT_NS as WDT;
11+
}
12+
else {
13+
use crate::pac::WDT;
14+
}
15+
}
16+
17+
718
use handles::*;
819

920
/// A type state representing a watchdog that has not been started.
@@ -202,7 +213,14 @@ where
202213
/// Is the watchdog active?
203214
#[inline(always)]
204215
pub fn is_active(&self) -> bool {
205-
self.wdt.runstatus.read().runstatus().bit_is_set()
216+
cfg_if! {
217+
if #[cfg(feature = "9160")]
218+
{
219+
self.wdt.runstatus.read().runstatuswdt().bit_is_set()
220+
} else {
221+
self.wdt.runstatus.read().runstatus().bit_is_set()
222+
}
223+
}
206224
}
207225
}
208226

0 commit comments

Comments
 (0)