Initial support for nrf9160

This commit is contained in:
Dion Dokter
2021-10-11 10:39:38 +02:00
parent 009b77c1b9
commit 20674f7126
16 changed files with 458 additions and 87 deletions

View File

@ -3,7 +3,13 @@
//! This HAL implements a basic watchdog timer with 1..=8 handles.
//! Once the watchdog has been started, it cannot be stopped.
use crate::pac::WDT;
use crate::pac;
#[cfg(not(feature = "nrf9160"))]
pub(crate) use pac::WDT;
#[cfg(feature = "nrf9160")]
pub(crate) use pac::WDT_NS as WDT;
use crate::peripherals;
const MIN_TICKS: u32 = 15;
@ -58,7 +64,12 @@ impl Watchdog {
let crv = config.timeout_ticks.max(MIN_TICKS);
let rren = (1u32 << N) - 1;
if r.runstatus.read().runstatus().bit() {
#[cfg(not(feature = "nrf9160"))]
let runstatus = r.runstatus.read().runstatus().bit();
#[cfg(feature = "nrf9160")]
let runstatus = r.runstatus.read().runstatuswdt().bit();
if runstatus {
let curr_config = r.config.read();
if curr_config.halt().bit() != config.run_during_debug_halt
|| curr_config.sleep().bit() != config.run_during_sleep