diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-02-11 23:25:30 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-02-12 01:16:31 +0100 |
commit | 6c925b2342708266f24d58020e89786811531d47 (patch) | |
tree | e46a871fe4d2845d2bfb29f24c8e688165a17738 /examples/stm32f3/src/bin | |
parent | 5ae4e20f8654bdc129d152b5364b6864457c2e02 (diff) | |
download | embassy-6c925b2342708266f24d58020e89786811531d47.zip |
blocking_mutex: refactor to work on stable. No GATs, and can be constructed in const.
Diffstat (limited to 'examples/stm32f3/src/bin')
-rw-r--r-- | examples/stm32f3/src/bin/button_events.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 720ed9d1..1218edd2 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs @@ -12,7 +12,7 @@ #[path = "../example_common.rs"] mod example_common; -use embassy::blocking_mutex::kind::Noop; +use embassy::blocking_mutex::raw::NoopRawMutex; use embassy::channel::mpsc::{self, Channel, Receiver, Sender}; use embassy::executor::Spawner; use embassy::time::{with_timeout, Duration, Timer}; @@ -77,7 +77,7 @@ enum ButtonEvent { Hold, } -static BUTTON_EVENTS_QUEUE: Forever<Channel<Noop, ButtonEvent, 4>> = Forever::new(); +static BUTTON_EVENTS_QUEUE: Forever<Channel<NoopRawMutex, ButtonEvent, 4>> = Forever::new(); #[embassy::main] async fn main(spawner: Spawner, p: Peripherals) { @@ -103,7 +103,10 @@ async fn main(spawner: Spawner, p: Peripherals) { } #[embassy::task] -async fn led_blinker(mut leds: Leds<'static>, queue: Receiver<'static, Noop, ButtonEvent, 4>) { +async fn led_blinker( + mut leds: Leds<'static>, + queue: Receiver<'static, NoopRawMutex, ButtonEvent, 4>, +) { loop { leds.blink().await; match queue.try_recv() { @@ -121,7 +124,7 @@ async fn led_blinker(mut leds: Leds<'static>, queue: Receiver<'static, Noop, But #[embassy::task] async fn button_waiter( mut button: ExtiInput<'static, PA0>, - queue: Sender<'static, Noop, ButtonEvent, 4>, + queue: Sender<'static, NoopRawMutex, ButtonEvent, 4>, ) { const DOUBLE_CLICK_DELAY: u64 = 250; const HOLD_DELAY: u64 = 1000; |