This commit is contained in:
parent
911fe8771e
commit
d231905aca
@ -13,7 +13,7 @@ panic-rtt-target = { version = "0.1" }
|
||||
critical-section = "1"
|
||||
|
||||
embassy-sync = { version = "0.6.0" }
|
||||
embassy-time = { version = "0.3.2", features = ["tick-hz-1"] }
|
||||
embassy-time = { version = "0.3.2", features = ["tick-hz-1_000"] }
|
||||
embassy-time-driver = { version = "0.1" }
|
||||
|
||||
[dependencies.once_cell]
|
||||
|
@ -135,7 +135,7 @@ impl TimerDriverEmbassy {
|
||||
// Should be called inside the IRQ of the alarm timer.
|
||||
fn on_interrupt_alarm(&self, idx: usize) {
|
||||
critical_section::with(|cs| {
|
||||
if self.alarms.borrow(cs)[idx].timestamp.get() < self.now() {
|
||||
if self.alarms.borrow(cs)[idx].timestamp.get() <= self.now() {
|
||||
self.trigger_alarm(idx, cs)
|
||||
}
|
||||
})
|
||||
@ -171,7 +171,10 @@ impl TimerDriverEmbassy {
|
||||
}
|
||||
|
||||
fn trigger_alarm(&self, n: usize, cs: CriticalSection) {
|
||||
alarm_tim(n).ctrl().modify(|_, w| w.irq_enb().clear_bit());
|
||||
alarm_tim(n).ctrl().modify(|_, w| {
|
||||
w.irq_enb().clear_bit();
|
||||
w.enable().clear_bit()
|
||||
});
|
||||
|
||||
let alarm = &self.alarms.borrow(cs)[n];
|
||||
// Setting the maximum value disables the alarm.
|
||||
|
@ -38,7 +38,7 @@ async fn main(_spawner: Spawner) {
|
||||
let portg = PinsG::new(&mut dp.sysconfig, dp.portg);
|
||||
let mut led = portg.pg5.into_readable_push_pull_output();
|
||||
loop {
|
||||
Timer::after_millis(500).await;
|
||||
Timer::after_secs(1).await;
|
||||
led.toggle().ok();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user