diff options
| author | huntc <[email protected]> | 2021-07-09 12:13:07 +1000 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-07-15 12:31:52 +1000 |
| commit | f159beec1cbd1406f63ca7c3e84a1d598bbadaa1 (patch) | |
| tree | 197367958c390e7036b1ceb300491b921b688435 /examples | |
| parent | 5f87c7808c9d896a2a2d5e064a58ed2ac23a4348 (diff) | |
Use of a NoopMutex
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf/src/bin/mpsc.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/nrf/src/bin/mpsc.rs b/examples/nrf/src/bin/mpsc.rs index 6a0f8f471..c2cb107e1 100644 --- a/examples/nrf/src/bin/mpsc.rs +++ b/examples/nrf/src/bin/mpsc.rs | |||
| @@ -16,17 +16,17 @@ use embassy::util::{mpsc, Forever}; | |||
| 16 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 16 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 17 | use embassy_nrf::Peripherals; | 17 | use embassy_nrf::Peripherals; |
| 18 | use embedded_hal::digital::v2::OutputPin; | 18 | use embedded_hal::digital::v2::OutputPin; |
| 19 | use mpsc::{Channel, Sender, WithThreadModeOnly}; | 19 | use mpsc::{Channel, Sender, WithNoThreads}; |
| 20 | 20 | ||
| 21 | enum LedState { | 21 | enum LedState { |
| 22 | On, | 22 | On, |
| 23 | Off, | 23 | Off, |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | static CHANNEL: Forever<Channel<WithThreadModeOnly, LedState, 1>> = Forever::new(); | 26 | static CHANNEL: Forever<Channel<WithNoThreads, LedState, 1>> = Forever::new(); |
| 27 | 27 | ||
| 28 | #[embassy::task(pool_size = 1)] | 28 | #[embassy::task(pool_size = 1)] |
| 29 | async fn my_task(sender: Sender<'static, WithThreadModeOnly, LedState, 1>) { | 29 | async fn my_task(sender: Sender<'static, WithNoThreads, LedState, 1>) { |
| 30 | loop { | 30 | loop { |
| 31 | let _ = sender.send(LedState::On).await; | 31 | let _ = sender.send(LedState::On).await; |
| 32 | Timer::after(Duration::from_secs(1)).await; | 32 | Timer::after(Duration::from_secs(1)).await; |
| @@ -39,7 +39,7 @@ async fn my_task(sender: Sender<'static, WithThreadModeOnly, LedState, 1>) { | |||
| 39 | async fn main(spawner: Spawner, p: Peripherals) { | 39 | async fn main(spawner: Spawner, p: Peripherals) { |
| 40 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 40 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 41 | 41 | ||
| 42 | let channel = CHANNEL.put(Channel::with_thread_mode_only()); | 42 | let channel = CHANNEL.put(Channel::with_no_threads()); |
| 43 | let (sender, mut receiver) = mpsc::split(channel); | 43 | let (sender, mut receiver) = mpsc::split(channel); |
| 44 | 44 | ||
| 45 | spawner.spawn(my_task(sender)).unwrap(); | 45 | spawner.spawn(my_task(sender)).unwrap(); |
