blocking_mutex: refactor to work on stable. No GATs, and can be constructed in const.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
mod example_common;
|
||||
|
||||
use defmt::unwrap;
|
||||
use embassy::blocking_mutex::kind::Noop;
|
||||
use embassy::blocking_mutex::raw::NoopRawMutex;
|
||||
use embassy::channel::mpsc::{self, Channel, Sender, TryRecvError};
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
@ -19,10 +19,10 @@ enum LedState {
|
||||
Off,
|
||||
}
|
||||
|
||||
static CHANNEL: Forever<Channel<Noop, LedState, 1>> = Forever::new();
|
||||
static CHANNEL: Forever<Channel<NoopRawMutex, LedState, 1>> = Forever::new();
|
||||
|
||||
#[embassy::task(pool_size = 1)]
|
||||
async fn my_task(sender: Sender<'static, Noop, LedState, 1>) {
|
||||
async fn my_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) {
|
||||
loop {
|
||||
let _ = sender.send(LedState::On).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
|
@ -6,7 +6,7 @@
|
||||
mod example_common;
|
||||
use example_common::*;
|
||||
|
||||
use embassy::blocking_mutex::kind::Noop;
|
||||
use embassy::blocking_mutex::raw::NoopRawMutex;
|
||||
use embassy::channel::mpsc::{self, Channel, Sender};
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::util::Forever;
|
||||
@ -15,7 +15,7 @@ use embassy_nrf::peripherals::UARTE0;
|
||||
use embassy_nrf::uarte::UarteRx;
|
||||
use embassy_nrf::{interrupt, uarte, Peripherals};
|
||||
|
||||
static CHANNEL: Forever<Channel<Noop, [u8; 8], 1>> = Forever::new();
|
||||
static CHANNEL: Forever<Channel<NoopRawMutex, [u8; 8], 1>> = Forever::new();
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(spawner: Spawner, p: Peripherals) {
|
||||
@ -57,7 +57,7 @@ async fn main(spawner: Spawner, p: Peripherals) {
|
||||
}
|
||||
|
||||
#[embassy::task]
|
||||
async fn reader(mut rx: UarteRx<'static, UARTE0>, s: Sender<'static, Noop, [u8; 8], 1>) {
|
||||
async fn reader(mut rx: UarteRx<'static, UARTE0>, s: Sender<'static, NoopRawMutex, [u8; 8], 1>) {
|
||||
let mut buf = [0; 8];
|
||||
loop {
|
||||
info!("reading...");
|
||||
|
Reference in New Issue
Block a user