Pass WDT config around

By passing WDT config around we can control it more easily and promote sharing it between files.
This commit is contained in:
huntc
2023-01-04 10:19:39 +11:00
parent 0aa2a9ac27
commit 651eec0242
2 changed files with 9 additions and 6 deletions

View File

@ -149,11 +149,7 @@ pub struct WatchdogFlash<'d> {
impl<'d> WatchdogFlash<'d> {
/// Start a new watchdog with a given flash and WDT peripheral and a timeout
pub fn start(flash: Nvmc<'d>, wdt: WDT, timeout: u32) -> Self {
let mut config = wdt::Config::default();
config.timeout_ticks = 32768 * timeout; // timeout seconds
config.run_during_sleep = true;
config.run_during_debug_halt = false;
pub fn start(flash: Nvmc<'d>, wdt: WDT, config: wdt::Config) -> Self {
let (_wdt, [wdt]) = match wdt::Watchdog::try_new(wdt, config) {
Ok(x) => x,
Err(_) => {