Use new alarm syntax in pico_rtic example

This commit is contained in:
9names 2022-01-30 23:04:16 +11:00
parent b19f2cc8e5
commit f51a84f070

View file

@ -54,7 +54,7 @@ mod app {
let mut timer = hal::Timer::new(c.device.TIMER, &mut resets); let mut timer = hal::Timer::new(c.device.TIMER, &mut resets);
let mut alarm = timer.alarm_0().unwrap(); let mut alarm = timer.alarm_0().unwrap();
let _ = alarm.schedule(SCAN_TIME_US.microseconds()); let _ = alarm.schedule(SCAN_TIME_US.microseconds());
alarm.enable_interrupt(&mut timer); alarm.enable_interrupt();
(Shared { timer, alarm, led }, Local {}, init::Monotonics()) (Shared { timer, alarm, led }, Local {}, init::Monotonics())
} }
@ -73,10 +73,9 @@ mod app {
} }
*c.local.tog = !*c.local.tog; *c.local.tog = !*c.local.tog;
let timer = c.shared.timer; let mut alarm = c.shared.alarm;
let alarm = c.shared.alarm; (alarm).lock(|a| {
(timer, alarm).lock(|t, a| { a.clear_interrupt();
a.clear_interrupt(t);
let _ = a.schedule(SCAN_TIME_US.microseconds()); let _ = a.schedule(SCAN_TIME_US.microseconds());
}); });
} }