Merge #1139
1139: Wdt config changes r=lulf a=huntc Per commits: * By passing WDT config around we can control it more easily and promote sharing it between files. * The memory layout of the s140 crept into a number of memory files, which can cause confusion (well, it did for me!). * Obtaining the current WDT config is useful so that we do not have to duplicate configurations around the place. A constructor method has been introduced that attempts to return the current running WDT config from the WDT peripheral. The bootloader example has also been updated to show how the watchdog can be obtained and used. Co-authored-by: huntc <huntchr@gmail.com>
This commit is contained in:
@ -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(_) => {
|
||||
|
Reference in New Issue
Block a user