Skip to content

Commit 9e25ce4

Browse files
Merge pull request #283 from macthestack/master
Adding WDT to nRF9160.
2 parents 2755bf3 + 7c1400f commit 9e25ce4

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
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+
} else {
12+
use crate::pac::WDT;
13+
}
14+
}
15+
16+
717
use handles::*;
818

919
/// A type state representing a watchdog that has not been started.
@@ -202,7 +212,13 @@ where
202212
/// Is the watchdog active?
203213
#[inline(always)]
204214
pub fn is_active(&self) -> bool {
205-
self.wdt.runstatus.read().runstatus().bit_is_set()
215+
cfg_if! {
216+
if #[cfg(feature = "9160")] {
217+
self.wdt.runstatus.read().runstatuswdt().bit_is_set()
218+
} else {
219+
self.wdt.runstatus.read().runstatus().bit_is_set()
220+
}
221+
}
206222
}
207223
}
208224

0 commit comments

Comments
 (0)