diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-29 21:58:35 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-29 23:40:36 +0200 |
| commit | a0f1b0ee01d461607660d2d56b5b1bdc57e0d3fb (patch) | |
| tree | e60fc8f8db8ec07e55d655c1a830b07f4db0b7d2 /examples/nrf/src/bin | |
| parent | 8745d646f0976791b7098456aa61adb983fb1c18 (diff) | |
Split embassy crate into embassy-executor, embassy-util.
Diffstat (limited to 'examples/nrf/src/bin')
42 files changed, 154 insertions, 155 deletions
diff --git a/examples/nrf/src/bin/awaitable_timer.rs b/examples/nrf/src/bin/awaitable_timer.rs index 34a657cb9..f2c1d9fa4 100644 --- a/examples/nrf/src/bin/awaitable_timer.rs +++ b/examples/nrf/src/bin/awaitable_timer.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::timer::Timer; | 7 | use embassy_nrf::timer::Timer; |
| 8 | use embassy_nrf::{interrupt, Peripherals}; | 8 | use embassy_nrf::{interrupt, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut t = Timer::new_awaitable(p.TIMER0, interrupt::take!(TIMER0)); | 13 | let mut t = Timer::new_awaitable(p.TIMER0, interrupt::take!(TIMER0)); |
| 14 | // default frequency is 1MHz, so this triggers every second | 14 | // default frequency is 1MHz, so this triggers every second |
diff --git a/examples/nrf/src/bin/blinky.rs b/examples/nrf/src/bin/blinky.rs index 23d16f796..98db6546c 100644 --- a/examples/nrf/src/bin/blinky.rs +++ b/examples/nrf/src/bin/blinky.rs | |||
| @@ -2,13 +2,13 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 6 | use embassy_executor::time::{Duration, Timer}; |
| 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/buffered_uart.rs b/examples/nrf/src/bin/buffered_uart.rs index 18dd698bf..f02b7d845 100644 --- a/examples/nrf/src/bin/buffered_uart.rs +++ b/examples/nrf/src/bin/buffered_uart.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::buffered_uarte::{BufferedUarte, State}; | 7 | use embassy_nrf::buffered_uarte::{BufferedUarte, State}; |
| 8 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 8 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 9 | use embedded_io::asynch::{BufRead, Write}; | 9 | use embedded_io::asynch::{BufRead, Write}; |
| 10 | use futures::pin_mut; | 10 | use futures::pin_mut; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut config = uarte::Config::default(); | 15 | let mut config = uarte::Config::default(); |
| 16 | config.parity = uarte::Parity::EXCLUDED; | 16 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/channel.rs b/examples/nrf/src/bin/channel.rs index c57b91a42..e97c6c5ee 100644 --- a/examples/nrf/src/bin/channel.rs +++ b/examples/nrf/src/bin/channel.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::Channel; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 11 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::Channel; | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | enum LedState { | 14 | enum LedState { |
| @@ -18,7 +18,7 @@ enum LedState { | |||
| 18 | 18 | ||
| 19 | static CHANNEL: Channel<ThreadModeRawMutex, LedState, 1> = Channel::new(); | 19 | static CHANNEL: Channel<ThreadModeRawMutex, LedState, 1> = Channel::new(); |
| 20 | 20 | ||
| 21 | #[embassy::task] | 21 | #[embassy_executor::task] |
| 22 | async fn my_task() { | 22 | async fn my_task() { |
| 23 | loop { | 23 | loop { |
| 24 | CHANNEL.send(LedState::On).await; | 24 | CHANNEL.send(LedState::On).await; |
| @@ -28,7 +28,7 @@ async fn my_task() { | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | #[embassy::main] | 31 | #[embassy_executor::main] |
| 32 | async fn main(spawner: Spawner, p: Peripherals) { | 32 | async fn main(spawner: Spawner, p: Peripherals) { |
| 33 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 33 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 34 | 34 | ||
diff --git a/examples/nrf/src/bin/channel_sender_receiver.rs b/examples/nrf/src/bin/channel_sender_receiver.rs index 847ce2382..bca7bb248 100644 --- a/examples/nrf/src/bin/channel_sender_receiver.rs +++ b/examples/nrf/src/bin/channel_sender_receiver.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::NoopRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::{Channel, Receiver, Sender}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy::util::Forever; | ||
| 11 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; | 8 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; |
| 12 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embassy_util::blocking_mutex::raw::NoopRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::{Channel, Receiver, Sender}; | ||
| 12 | use embassy_util::Forever; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | enum LedState { | 15 | enum LedState { |
| @@ -19,7 +19,7 @@ enum LedState { | |||
| 19 | 19 | ||
| 20 | static CHANNEL: Forever<Channel<NoopRawMutex, LedState, 1>> = Forever::new(); | 20 | static CHANNEL: Forever<Channel<NoopRawMutex, LedState, 1>> = Forever::new(); |
| 21 | 21 | ||
| 22 | #[embassy::task] | 22 | #[embassy_executor::task] |
| 23 | async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { | 23 | async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { |
| 24 | loop { | 24 | loop { |
| 25 | sender.send(LedState::On).await; | 25 | sender.send(LedState::On).await; |
| @@ -29,7 +29,7 @@ async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #[embassy::task] | 32 | #[embassy_executor::task] |
| 33 | async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { | 33 | async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { |
| 34 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); | 34 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); |
| 35 | 35 | ||
| @@ -41,7 +41,7 @@ async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedSta | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | #[embassy::main] | 44 | #[embassy_executor::main] |
| 45 | async fn main(spawner: Spawner, p: Peripherals) { | 45 | async fn main(spawner: Spawner, p: Peripherals) { |
| 46 | let channel = CHANNEL.put(Channel::new()); | 46 | let channel = CHANNEL.put(Channel::new()); |
| 47 | 47 | ||
diff --git a/examples/nrf/src/bin/executor_fairness_test.rs b/examples/nrf/src/bin/executor_fairness_test.rs index 5a4221519..b98454936 100644 --- a/examples/nrf/src/bin/executor_fairness_test.rs +++ b/examples/nrf/src/bin/executor_fairness_test.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | use core::task::Poll; | 5 | use core::task::Poll; |
| 6 | 6 | ||
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Instant, Timer}; | 9 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 10 | use embassy_nrf::Peripherals; | 10 | use embassy_nrf::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::task] | 13 | #[embassy_executor::task] |
| 14 | async fn run1() { | 14 | async fn run1() { |
| 15 | loop { | 15 | loop { |
| 16 | info!("DING DONG"); | 16 | info!("DING DONG"); |
| @@ -18,14 +18,14 @@ async fn run1() { | |||
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::task] | 21 | #[embassy_executor::task] |
| 22 | async fn run2() { | 22 | async fn run2() { |
| 23 | loop { | 23 | loop { |
| 24 | Timer::at(Instant::from_ticks(0)).await; | 24 | Timer::at(Instant::from_ticks(0)).await; |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | #[embassy::task] | 28 | #[embassy_executor::task] |
| 29 | async fn run3() { | 29 | async fn run3() { |
| 30 | futures::future::poll_fn(|cx| { | 30 | futures::future::poll_fn(|cx| { |
| 31 | cx.waker().wake_by_ref(); | 31 | cx.waker().wake_by_ref(); |
| @@ -34,7 +34,7 @@ async fn run3() { | |||
| 34 | .await; | 34 | .await; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy::main] | 37 | #[embassy_executor::main] |
| 38 | async fn main(spawner: Spawner, _p: Peripherals) { | 38 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 39 | unwrap!(spawner.spawn(run1())); | 39 | unwrap!(spawner.spawn(run1())); |
| 40 | unwrap!(spawner.spawn(run2())); | 40 | unwrap!(spawner.spawn(run2())); |
diff --git a/examples/nrf/src/bin/gpiote_channel.rs b/examples/nrf/src/bin/gpiote_channel.rs index ad8f37c6e..65c7b4df7 100644 --- a/examples/nrf/src/bin/gpiote_channel.rs +++ b/examples/nrf/src/bin/gpiote_channel.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Input, Pull}; | 7 | use embassy_nrf::gpio::{Input, Pull}; |
| 8 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; | 8 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Starting!"); | 14 | info!("Starting!"); |
| 15 | 15 | ||
diff --git a/examples/nrf/src/bin/gpiote_port.rs b/examples/nrf/src/bin/gpiote_port.rs index 30b87b3a7..7746a7f96 100644 --- a/examples/nrf/src/bin/gpiote_port.rs +++ b/examples/nrf/src/bin/gpiote_port.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; | 7 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 4)] | 11 | #[embassy_executor::task(pool_size = 4)] |
| 12 | async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { | 12 | async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { |
| 13 | loop { | 13 | loop { |
| 14 | pin.wait_for_low().await; | 14 | pin.wait_for_low().await; |
| @@ -18,7 +18,7 @@ async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { | |||
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::main] | 21 | #[embassy_executor::main] |
| 22 | async fn main(spawner: Spawner, p: Peripherals) { | 22 | async fn main(spawner: Spawner, p: Peripherals) { |
| 23 | info!("Starting!"); | 23 | info!("Starting!"); |
| 24 | 24 | ||
diff --git a/examples/nrf/src/bin/multiprio.rs b/examples/nrf/src/bin/multiprio.rs index 1a4598e21..7050da378 100644 --- a/examples/nrf/src/bin/multiprio.rs +++ b/examples/nrf/src/bin/multiprio.rs | |||
| @@ -59,14 +59,14 @@ | |||
| 59 | 59 | ||
| 60 | use cortex_m_rt::entry; | 60 | use cortex_m_rt::entry; |
| 61 | use defmt::{info, unwrap}; | 61 | use defmt::{info, unwrap}; |
| 62 | use embassy::time::{Duration, Instant, Timer}; | 62 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 63 | use embassy::util::Forever; | ||
| 64 | use embassy_nrf::executor::{Executor, InterruptExecutor}; | 63 | use embassy_nrf::executor::{Executor, InterruptExecutor}; |
| 65 | use embassy_nrf::interrupt; | 64 | use embassy_nrf::interrupt; |
| 66 | use embassy_nrf::interrupt::InterruptExt; | 65 | use embassy_nrf::interrupt::InterruptExt; |
| 66 | use embassy_util::Forever; | ||
| 67 | use {defmt_rtt as _, panic_probe as _}; | 67 | use {defmt_rtt as _, panic_probe as _}; |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn run_high() { | 70 | async fn run_high() { |
| 71 | loop { | 71 | loop { |
| 72 | info!(" [high] tick!"); | 72 | info!(" [high] tick!"); |
| @@ -74,7 +74,7 @@ async fn run_high() { | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #[embassy::task] | 77 | #[embassy_executor::task] |
| 78 | async fn run_med() { | 78 | async fn run_med() { |
| 79 | loop { | 79 | loop { |
| 80 | let start = Instant::now(); | 80 | let start = Instant::now(); |
| @@ -91,7 +91,7 @@ async fn run_med() { | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | #[embassy::task] | 94 | #[embassy_executor::task] |
| 95 | async fn run_low() { | 95 | async fn run_low() { |
| 96 | loop { | 96 | loop { |
| 97 | let start = Instant::now(); | 97 | let start = Instant::now(); |
diff --git a/examples/nrf/src/bin/mutex.rs b/examples/nrf/src/bin/mutex.rs index 92e01976c..5fe7eadb9 100644 --- a/examples/nrf/src/bin/mutex.rs +++ b/examples/nrf/src/bin/mutex.rs | |||
| @@ -3,16 +3,16 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::mutex::Mutex; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 10 | use embassy_util::mutex::Mutex; | ||
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | static MUTEX: Mutex<ThreadModeRawMutex, u32> = Mutex::new(0); | 13 | static MUTEX: Mutex<ThreadModeRawMutex, u32> = Mutex::new(0); |
| 14 | 14 | ||
| 15 | #[embassy::task] | 15 | #[embassy_executor::task] |
| 16 | async fn my_task() { | 16 | async fn my_task() { |
| 17 | loop { | 17 | loop { |
| 18 | { | 18 | { |
| @@ -29,7 +29,7 @@ async fn my_task() { | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #[embassy::main] | 32 | #[embassy_executor::main] |
| 33 | async fn main(spawner: Spawner, _p: Peripherals) { | 33 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 34 | unwrap!(spawner.spawn(my_task())); | 34 | unwrap!(spawner.spawn(my_task())); |
| 35 | 35 | ||
diff --git a/examples/nrf/src/bin/nvmc.rs b/examples/nrf/src/bin/nvmc.rs index b55ef1f6c..1d4387de7 100644 --- a/examples/nrf/src/bin/nvmc.rs +++ b/examples/nrf/src/bin/nvmc.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::nvmc::Nvmc; | 8 | use embassy_nrf::nvmc::Nvmc; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello NVMC!"); | 15 | info!("Hello NVMC!"); |
| 16 | 16 | ||
diff --git a/examples/nrf/src/bin/ppi.rs b/examples/nrf/src/bin/ppi.rs index 004a1bfa4..9a60cc0a0 100644 --- a/examples/nrf/src/bin/ppi.rs +++ b/examples/nrf/src/bin/ppi.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | use core::future::pending; | 5 | use core::future::pending; |
| 6 | 6 | ||
| 7 | use defmt::info; | 7 | use defmt::info; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; | 9 | use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; |
| 10 | use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity}; | 10 | use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity}; |
| 11 | use embassy_nrf::ppi::Ppi; | 11 | use embassy_nrf::ppi::Ppi; |
| @@ -13,7 +13,7 @@ use embassy_nrf::Peripherals; | |||
| 13 | use gpiote::{OutputChannel, OutputChannelPolarity}; | 13 | use gpiote::{OutputChannel, OutputChannelPolarity}; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | info!("Starting!"); | 18 | info!("Starting!"); |
| 19 | 19 | ||
diff --git a/examples/nrf/src/bin/pubsub.rs b/examples/nrf/src/bin/pubsub.rs index 2c3a355c2..5f33f3e0b 100644 --- a/examples/nrf/src/bin/pubsub.rs +++ b/examples/nrf/src/bin/pubsub.rs | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_util::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | /// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher | 12 | /// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher |
| @@ -19,7 +19,7 @@ enum Message { | |||
| 19 | C, | 19 | C, |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | #[embassy::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { | 23 | async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { |
| 24 | defmt::info!("Hello World!"); | 24 | defmt::info!("Hello World!"); |
| 25 | 25 | ||
| @@ -64,7 +64,7 @@ async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { | |||
| 64 | /// A logger task that just awaits the messages it receives | 64 | /// A logger task that just awaits the messages it receives |
| 65 | /// | 65 | /// |
| 66 | /// This takes the generic `Subscriber`. This is most performant, but requires you to write down all of the generics | 66 | /// This takes the generic `Subscriber`. This is most performant, but requires you to write down all of the generics |
| 67 | #[embassy::task] | 67 | #[embassy_executor::task] |
| 68 | async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Message, 4, 3, 1>) { | 68 | async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Message, 4, 3, 1>) { |
| 69 | loop { | 69 | loop { |
| 70 | let message = messages.next_message().await; | 70 | let message = messages.next_message().await; |
| @@ -76,7 +76,7 @@ async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Messa | |||
| 76 | /// Because of this, depeding on how the messages were published, the subscriber might miss some messages | 76 | /// Because of this, depeding on how the messages were published, the subscriber might miss some messages |
| 77 | /// | 77 | /// |
| 78 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics | 78 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics |
| 79 | #[embassy::task] | 79 | #[embassy_executor::task] |
| 80 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { | 80 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { |
| 81 | loop { | 81 | loop { |
| 82 | // Do some work | 82 | // Do some work |
| @@ -93,7 +93,7 @@ async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /// Same as `slow_logger` but it ignores lag results | 95 | /// Same as `slow_logger` but it ignores lag results |
| 96 | #[embassy::task] | 96 | #[embassy_executor::task] |
| 97 | async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) { | 97 | async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) { |
| 98 | loop { | 98 | loop { |
| 99 | // Do some work | 99 | // Do some work |
diff --git a/examples/nrf/src/bin/pwm.rs b/examples/nrf/src/bin/pwm.rs index aec5dd73a..c8a083294 100644 --- a/examples/nrf/src/bin/pwm.rs +++ b/examples/nrf/src/bin/pwm.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; | 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -70,7 +70,7 @@ static DUTY: [u16; 1024] = [ | |||
| 70 | 7255, 7331, 7407, 7484, 7561, 7638, 7716, 7794, 7873, 7952, 8031, 8111, | 70 | 7255, 7331, 7407, 7484, 7561, 7638, 7716, 7794, 7873, 7952, 8031, 8111, |
| 71 | ]; | 71 | ]; |
| 72 | 72 | ||
| 73 | #[embassy::main] | 73 | #[embassy_executor::main] |
| 74 | async fn main(_spawner: Spawner, p: Peripherals) { | 74 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 75 | let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); | 75 | let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); |
| 76 | pwm.set_prescaler(Prescaler::Div1); | 76 | pwm.set_prescaler(Prescaler::Div1); |
diff --git a/examples/nrf/src/bin/pwm_double_sequence.rs b/examples/nrf/src/bin/pwm_double_sequence.rs index facafa775..cfd8db86b 100644 --- a/examples/nrf/src/bin/pwm_double_sequence.rs +++ b/examples/nrf/src/bin/pwm_double_sequence.rs | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{ | 8 | use embassy_nrf::pwm::{ |
| 9 | Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence, | 9 | Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence, |
| 10 | }; | 10 | }; |
| 11 | use embassy_nrf::Peripherals; | 11 | use embassy_nrf::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let seq_words_0: [u16; 5] = [1000, 250, 100, 50, 0]; | 16 | let seq_words_0: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 17 | let seq_words_1: [u16; 4] = [50, 100, 250, 1000]; | 17 | let seq_words_1: [u16; 4] = [50, 100, 250, 1000]; |
diff --git a/examples/nrf/src/bin/pwm_sequence.rs b/examples/nrf/src/bin/pwm_sequence.rs index b7cb385c7..b7a04c036 100644 --- a/examples/nrf/src/bin/pwm_sequence.rs +++ b/examples/nrf/src/bin/pwm_sequence.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer}; | 8 | use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; | 14 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 15 | 15 | ||
diff --git a/examples/nrf/src/bin/pwm_sequence_ppi.rs b/examples/nrf/src/bin/pwm_sequence_ppi.rs index d98e2ca76..f5c587c35 100644 --- a/examples/nrf/src/bin/pwm_sequence_ppi.rs +++ b/examples/nrf/src/bin/pwm_sequence_ppi.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | use core::future::pending; | 5 | use core::future::pending; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_nrf::gpio::{Input, Pull}; | 9 | use embassy_nrf::gpio::{Input, Pull}; |
| 10 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; | 10 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; |
| 11 | use embassy_nrf::ppi::Ppi; | 11 | use embassy_nrf::ppi::Ppi; |
| @@ -13,7 +13,7 @@ use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSeq | |||
| 13 | use embassy_nrf::Peripherals; | 13 | use embassy_nrf::Peripherals; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; | 18 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 19 | 19 | ||
diff --git a/examples/nrf/src/bin/pwm_sequence_ws2812b.rs b/examples/nrf/src/bin/pwm_sequence_ws2812b.rs index 0dee8c949..d6b3f005c 100644 --- a/examples/nrf/src/bin/pwm_sequence_ws2812b.rs +++ b/examples/nrf/src/bin/pwm_sequence_ws2812b.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{ | 8 | use embassy_nrf::pwm::{ |
| 9 | Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer, | 9 | Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer, |
| 10 | }; | 10 | }; |
| @@ -26,7 +26,7 @@ const RES: u16 = 0x8000; | |||
| 26 | 26 | ||
| 27 | // Provides data to a WS2812b (Neopixel) LED and makes it go blue. The data | 27 | // Provides data to a WS2812b (Neopixel) LED and makes it go blue. The data |
| 28 | // line is assumed to be P1_05. | 28 | // line is assumed to be P1_05. |
| 29 | #[embassy::main] | 29 | #[embassy_executor::main] |
| 30 | async fn main(_spawner: Spawner, p: Peripherals) { | 30 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 31 | let mut config = Config::default(); | 31 | let mut config = Config::default(); |
| 32 | config.sequence_load = SequenceLoad::Common; | 32 | config.sequence_load = SequenceLoad::Common; |
diff --git a/examples/nrf/src/bin/pwm_servo.rs b/examples/nrf/src/bin/pwm_servo.rs index 71a90a948..d28a5a17e 100644 --- a/examples/nrf/src/bin/pwm_servo.rs +++ b/examples/nrf/src/bin/pwm_servo.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; | 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let mut pwm = SimplePwm::new_1ch(p.PWM0, p.P0_05); | 14 | let mut pwm = SimplePwm::new_1ch(p.PWM0, p.P0_05); |
| 15 | // sg90 microervo requires 50hz or 20ms period | 15 | // sg90 microervo requires 50hz or 20ms period |
diff --git a/examples/nrf/src/bin/qdec.rs b/examples/nrf/src/bin/qdec.rs index 9529c7bb6..6bda82f78 100644 --- a/examples/nrf/src/bin/qdec.rs +++ b/examples/nrf/src/bin/qdec.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::qdec::{self, Qdec}; | 7 | use embassy_nrf::qdec::{self, Qdec}; |
| 8 | use embassy_nrf::{interrupt, Peripherals}; | 8 | use embassy_nrf::{interrupt, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let irq = interrupt::take!(QDEC); | 13 | let irq = interrupt::take!(QDEC); |
| 14 | let config = qdec::Config::default(); | 14 | let config = qdec::Config::default(); |
diff --git a/examples/nrf/src/bin/qspi.rs b/examples/nrf/src/bin/qspi.rs index 96c90f9c8..57e0fdbe2 100644 --- a/examples/nrf/src/bin/qspi.rs +++ b/examples/nrf/src/bin/qspi.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{assert_eq, info, unwrap}; | 5 | use defmt::{assert_eq, info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, qspi, Peripherals}; | 7 | use embassy_nrf::{interrupt, qspi, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| @@ -14,7 +14,7 @@ const PAGE_SIZE: usize = 4096; | |||
| 14 | #[repr(C, align(4))] | 14 | #[repr(C, align(4))] |
| 15 | struct AlignedBuf([u8; 4096]); | 15 | struct AlignedBuf([u8; 4096]); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_spawner: Spawner, p: Peripherals) { | 18 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 19 | // Config for the MX25R64 present in the nRF52840 DK | 19 | // Config for the MX25R64 present in the nRF52840 DK |
| 20 | let mut config = qspi::Config::default(); | 20 | let mut config = qspi::Config::default(); |
diff --git a/examples/nrf/src/bin/qspi_lowpower.rs b/examples/nrf/src/bin/qspi_lowpower.rs index ce2e40b23..080b27a16 100644 --- a/examples/nrf/src/bin/qspi_lowpower.rs +++ b/examples/nrf/src/bin/qspi_lowpower.rs | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | use core::mem; | 5 | use core::mem; |
| 6 | 6 | ||
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_executor::time::{Duration, Timer}; |
| 10 | use embassy_nrf::{interrupt, qspi, Peripherals}; | 10 | use embassy_nrf::{interrupt, qspi, Peripherals}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| @@ -15,7 +15,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 15 | #[repr(C, align(4))] | 15 | #[repr(C, align(4))] |
| 16 | struct AlignedBuf([u8; 64]); | 16 | struct AlignedBuf([u8; 64]); |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 19 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 20 | let mut irq = interrupt::take!(QSPI); | 20 | let mut irq = interrupt::take!(QSPI); |
| 21 | 21 | ||
diff --git a/examples/nrf/src/bin/raw_spawn.rs b/examples/nrf/src/bin/raw_spawn.rs index d564b6b26..9199d3aeb 100644 --- a/examples/nrf/src/bin/raw_spawn.rs +++ b/examples/nrf/src/bin/raw_spawn.rs | |||
| @@ -5,10 +5,10 @@ use core::mem; | |||
| 5 | 5 | ||
| 6 | use cortex_m_rt::entry; | 6 | use cortex_m_rt::entry; |
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::raw::TaskStorage; | 8 | use embassy_executor::executor::raw::TaskStorage; |
| 9 | use embassy::executor::Executor; | 9 | use embassy_executor::executor::Executor; |
| 10 | use embassy::time::{Duration, Timer}; | 10 | use embassy_executor::time::{Duration, Timer}; |
| 11 | use embassy::util::Forever; | 11 | use embassy_util::Forever; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | async fn run1() { | 14 | async fn run1() { |
diff --git a/examples/nrf/src/bin/rng.rs b/examples/nrf/src/bin/rng.rs index 08d3abe10..a4314e8b9 100644 --- a/examples/nrf/src/bin/rng.rs +++ b/examples/nrf/src/bin/rng.rs | |||
| @@ -2,13 +2,13 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_nrf::rng::Rng; | 6 | use embassy_nrf::rng::Rng; |
| 7 | use embassy_nrf::{interrupt, Peripherals}; | 7 | use embassy_nrf::{interrupt, Peripherals}; |
| 8 | use rand::Rng as _; | 8 | use rand::Rng as _; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut rng = Rng::new(p.RNG, interrupt::take!(RNG)); | 13 | let mut rng = Rng::new(p.RNG, interrupt::take!(RNG)); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/saadc.rs b/examples/nrf/src/bin/saadc.rs index cb9289784..65c78d842 100644 --- a/examples/nrf/src/bin/saadc.rs +++ b/examples/nrf/src/bin/saadc.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc}; | 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc}; |
| 9 | use embassy_nrf::{interrupt, Peripherals}; | 9 | use embassy_nrf::{interrupt, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 13 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 14 | let config = Config::default(); | 14 | let config = Config::default(); |
| 15 | let channel_config = ChannelConfig::single_ended(&mut p.P0_02); | 15 | let channel_config = ChannelConfig::single_ended(&mut p.P0_02); |
diff --git a/examples/nrf/src/bin/saadc_continuous.rs b/examples/nrf/src/bin/saadc_continuous.rs index 234294eae..d0305736f 100644 --- a/examples/nrf/src/bin/saadc_continuous.rs +++ b/examples/nrf/src/bin/saadc_continuous.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::Duration; | 7 | use embassy_executor::time::Duration; |
| 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState}; | 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState}; |
| 9 | use embassy_nrf::timer::Frequency; | 9 | use embassy_nrf::timer::Frequency; |
| 10 | use embassy_nrf::{interrupt, Peripherals}; | 10 | use embassy_nrf::{interrupt, Peripherals}; |
| @@ -12,7 +12,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 12 | 12 | ||
| 13 | // Demonstrates both continuous sampling and scanning multiple channels driven by a PPI linked timer | 13 | // Demonstrates both continuous sampling and scanning multiple channels driven by a PPI linked timer |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 16 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 17 | let config = Config::default(); | 17 | let config = Config::default(); |
| 18 | let channel_1_config = ChannelConfig::single_ended(&mut p.P0_02); | 18 | let channel_1_config = ChannelConfig::single_ended(&mut p.P0_02); |
| @@ -27,7 +27,7 @@ async fn main(_spawner: Spawner, mut p: Peripherals) { | |||
| 27 | 27 | ||
| 28 | // This delay demonstrates that starting the timer prior to running | 28 | // This delay demonstrates that starting the timer prior to running |
| 29 | // the task sampler is benign given the calibration that follows. | 29 | // the task sampler is benign given the calibration that follows. |
| 30 | embassy::time::Timer::after(Duration::from_millis(500)).await; | 30 | embassy_executor::time::Timer::after(Duration::from_millis(500)).await; |
| 31 | saadc.calibrate().await; | 31 | saadc.calibrate().await; |
| 32 | 32 | ||
| 33 | let mut bufs = [[[0; 3]; 500]; 2]; | 33 | let mut bufs = [[[0; 3]; 500]; 2]; |
diff --git a/examples/nrf/src/bin/self_spawn.rs b/examples/nrf/src/bin/self_spawn.rs index 4b8ac04bc..e0152802e 100644 --- a/examples/nrf/src/bin/self_spawn.rs +++ b/examples/nrf/src/bin/self_spawn.rs | |||
| @@ -3,19 +3,19 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 2)] | 11 | #[embassy_executor::task(pool_size = 2)] |
| 12 | async fn my_task(spawner: Spawner, n: u32) { | 12 | async fn my_task(spawner: Spawner, n: u32) { |
| 13 | Timer::after(Duration::from_secs(1)).await; | 13 | Timer::after(Duration::from_secs(1)).await; |
| 14 | info!("Spawning self! {}", n); | 14 | info!("Spawning self! {}", n); |
| 15 | unwrap!(spawner.spawn(my_task(spawner, n + 1))); | 15 | unwrap!(spawner.spawn(my_task(spawner, n + 1))); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(spawner: Spawner, _p: Peripherals) { | 19 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | unwrap!(spawner.spawn(my_task(spawner, 0))); | 21 | unwrap!(spawner.spawn(my_task(spawner, 0))); |
diff --git a/examples/nrf/src/bin/self_spawn_current_executor.rs b/examples/nrf/src/bin/self_spawn_current_executor.rs index 3c3379ce6..1d8309d77 100644 --- a/examples/nrf/src/bin/self_spawn_current_executor.rs +++ b/examples/nrf/src/bin/self_spawn_current_executor.rs | |||
| @@ -3,19 +3,19 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 2)] | 11 | #[embassy_executor::task(pool_size = 2)] |
| 12 | async fn my_task(n: u32) { | 12 | async fn my_task(n: u32) { |
| 13 | Timer::after(Duration::from_secs(1)).await; | 13 | Timer::after(Duration::from_secs(1)).await; |
| 14 | info!("Spawning self! {}", n); | 14 | info!("Spawning self! {}", n); |
| 15 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); | 15 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(spawner: Spawner, _p: Peripherals) { | 19 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | unwrap!(spawner.spawn(my_task(0))); | 21 | unwrap!(spawner.spawn(my_task(0))); |
diff --git a/examples/nrf/src/bin/spim.rs b/examples/nrf/src/bin/spim.rs index 62040168a..fd741b21c 100644 --- a/examples/nrf/src/bin/spim.rs +++ b/examples/nrf/src/bin/spim.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 8 | use embassy_nrf::{interrupt, spim, Peripherals}; | 8 | use embassy_nrf::{interrupt, spim, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | info!("running!"); | 13 | info!("running!"); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/temp.rs b/examples/nrf/src/bin/temp.rs index 939cb39e7..654098e0b 100644 --- a/examples/nrf/src/bin/temp.rs +++ b/examples/nrf/src/bin/temp.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::temp::Temp; | 8 | use embassy_nrf::temp::Temp; |
| 9 | use embassy_nrf::{interrupt, Peripherals}; | 9 | use embassy_nrf::{interrupt, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let irq = interrupt::take!(TEMP); | 14 | let irq = interrupt::take!(TEMP); |
| 15 | let mut temp = Temp::new(p.TEMP, irq); | 15 | let mut temp = Temp::new(p.TEMP, irq); |
diff --git a/examples/nrf/src/bin/timer.rs b/examples/nrf/src/bin/timer.rs index 64376dd78..61ff1d6db 100644 --- a/examples/nrf/src/bin/timer.rs +++ b/examples/nrf/src/bin/timer.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task] | 11 | #[embassy_executor::task] |
| 12 | async fn run1() { | 12 | async fn run1() { |
| 13 | loop { | 13 | loop { |
| 14 | info!("BIG INFREQUENT TICK"); | 14 | info!("BIG INFREQUENT TICK"); |
| @@ -16,7 +16,7 @@ async fn run1() { | |||
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #[embassy::task] | 19 | #[embassy_executor::task] |
| 20 | async fn run2() { | 20 | async fn run2() { |
| 21 | loop { | 21 | loop { |
| 22 | info!("tick"); | 22 | info!("tick"); |
| @@ -24,7 +24,7 @@ async fn run2() { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main] | 27 | #[embassy_executor::main] |
| 28 | async fn main(spawner: Spawner, _p: Peripherals) { | 28 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 29 | unwrap!(spawner.spawn(run1())); | 29 | unwrap!(spawner.spawn(run1())); |
| 30 | unwrap!(spawner.spawn(run2())); | 30 | unwrap!(spawner.spawn(run2())); |
diff --git a/examples/nrf/src/bin/twim.rs b/examples/nrf/src/bin/twim.rs index fb8372a12..bb7ee9db4 100644 --- a/examples/nrf/src/bin/twim.rs +++ b/examples/nrf/src/bin/twim.rs | |||
| @@ -7,14 +7,14 @@ | |||
| 7 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
| 8 | 8 | ||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::executor::Spawner; | 10 | use embassy_executor::executor::Spawner; |
| 11 | use embassy_nrf::twim::{self, Twim}; | 11 | use embassy_nrf::twim::{self, Twim}; |
| 12 | use embassy_nrf::{interrupt, Peripherals}; | 12 | use embassy_nrf::{interrupt, Peripherals}; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | const ADDRESS: u8 = 0x50; | 15 | const ADDRESS: u8 = 0x50; |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_spawner: Spawner, p: Peripherals) { | 18 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 19 | info!("Initializing TWI..."); | 19 | info!("Initializing TWI..."); |
| 20 | let config = twim::Config::default(); | 20 | let config = twim::Config::default(); |
diff --git a/examples/nrf/src/bin/twim_lowpower.rs b/examples/nrf/src/bin/twim_lowpower.rs index c9c2d503e..ebf3d7109 100644 --- a/examples/nrf/src/bin/twim_lowpower.rs +++ b/examples/nrf/src/bin/twim_lowpower.rs | |||
| @@ -11,15 +11,15 @@ | |||
| 11 | use core::mem; | 11 | use core::mem; |
| 12 | 12 | ||
| 13 | use defmt::*; | 13 | use defmt::*; |
| 14 | use embassy::executor::Spawner; | 14 | use embassy_executor::executor::Spawner; |
| 15 | use embassy::time::{Duration, Timer}; | 15 | use embassy_executor::time::{Duration, Timer}; |
| 16 | use embassy_nrf::twim::{self, Twim}; | 16 | use embassy_nrf::twim::{self, Twim}; |
| 17 | use embassy_nrf::{interrupt, Peripherals}; | 17 | use embassy_nrf::{interrupt, Peripherals}; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 19 | ||
| 20 | const ADDRESS: u8 = 0x50; | 20 | const ADDRESS: u8 = 0x50; |
| 21 | 21 | ||
| 22 | #[embassy::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 23 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 24 | info!("Started!"); | 24 | info!("Started!"); |
| 25 | let mut irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); | 25 | let mut irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); |
diff --git a/examples/nrf/src/bin/uart.rs b/examples/nrf/src/bin/uart.rs index c8c4a67a5..5f363b69e 100644 --- a/examples/nrf/src/bin/uart.rs +++ b/examples/nrf/src/bin/uart.rs | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 12 | let mut config = uarte::Config::default(); | 12 | let mut config = uarte::Config::default(); |
| 13 | config.parity = uarte::Parity::EXCLUDED; | 13 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/uart_idle.rs b/examples/nrf/src/bin/uart_idle.rs index 6679b28da..0f455dffd 100644 --- a/examples/nrf/src/bin/uart_idle.rs +++ b/examples/nrf/src/bin/uart_idle.rs | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 12 | let mut config = uarte::Config::default(); | 12 | let mut config = uarte::Config::default(); |
| 13 | config.parity = uarte::Parity::EXCLUDED; | 13 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/uart_split.rs b/examples/nrf/src/bin/uart_split.rs index 1ffb63706..2de5f90c1 100644 --- a/examples/nrf/src/bin/uart_split.rs +++ b/examples/nrf/src/bin/uart_split.rs | |||
| @@ -3,17 +3,17 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::Channel; | ||
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy_nrf::peripherals::UARTE0; | 7 | use embassy_nrf::peripherals::UARTE0; |
| 10 | use embassy_nrf::uarte::UarteRx; | 8 | use embassy_nrf::uarte::UarteRx; |
| 11 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 9 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 10 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::Channel; | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); | 14 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(spawner: Spawner, p: Peripherals) { | 17 | async fn main(spawner: Spawner, p: Peripherals) { |
| 18 | let mut config = uarte::Config::default(); | 18 | let mut config = uarte::Config::default(); |
| 19 | config.parity = uarte::Parity::EXCLUDED; | 19 | config.parity = uarte::Parity::EXCLUDED; |
| @@ -48,7 +48,7 @@ async fn main(spawner: Spawner, p: Peripherals) { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | #[embassy::task] | 51 | #[embassy_executor::task] |
| 52 | async fn reader(mut rx: UarteRx<'static, UARTE0>) { | 52 | async fn reader(mut rx: UarteRx<'static, UARTE0>) { |
| 53 | let mut buf = [0; 8]; | 53 | let mut buf = [0; 8]; |
| 54 | loop { | 54 | loop { |
diff --git a/examples/nrf/src/bin/usb_ethernet.rs b/examples/nrf/src/bin/usb_ethernet.rs index e57cdaf63..93cb05907 100644 --- a/examples/nrf/src/bin/usb_ethernet.rs +++ b/examples/nrf/src/bin/usb_ethernet.rs | |||
| @@ -8,10 +8,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; | |||
| 8 | use core::task::Waker; | 8 | use core::task::Waker; |
| 9 | 9 | ||
| 10 | use defmt::*; | 10 | use defmt::*; |
| 11 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_executor::executor::Spawner; |
| 12 | use embassy::channel::mpmc::Channel; | ||
| 13 | use embassy::executor::Spawner; | ||
| 14 | use embassy::util::Forever; | ||
| 15 | use embassy_net::tcp::TcpSocket; | 12 | use embassy_net::tcp::TcpSocket; |
| 16 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; | 13 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; |
| 17 | use embassy_nrf::rng::Rng; | 14 | use embassy_nrf::rng::Rng; |
| @@ -19,6 +16,9 @@ use embassy_nrf::usb::{Driver, PowerUsb}; | |||
| 19 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; | 16 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; |
| 20 | use embassy_usb::{Builder, Config, UsbDevice}; | 17 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 21 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 18 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 19 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 20 | use embassy_util::channel::mpmc::Channel; | ||
| 21 | use embassy_util::Forever; | ||
| 22 | use embedded_io::asynch::{Read, Write}; | 22 | use embedded_io::asynch::{Read, Write}; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {defmt_rtt as _, panic_probe as _}; |
| 24 | 24 | ||
| @@ -32,12 +32,12 @@ macro_rules! forever { | |||
| 32 | }}; | 32 | }}; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #[embassy::task] | 35 | #[embassy_executor::task] |
| 36 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { | 36 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { |
| 37 | device.run().await | 37 | device.run().await |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | #[embassy::task] | 40 | #[embassy_executor::task] |
| 41 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | 41 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { |
| 42 | loop { | 42 | loop { |
| 43 | warn!("WAITING for connection"); | 43 | warn!("WAITING for connection"); |
| @@ -66,7 +66,7 @@ async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | |||
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | 70 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { |
| 71 | loop { | 71 | loop { |
| 72 | let pkt = TX_CHANNEL.recv().await; | 72 | let pkt = TX_CHANNEL.recv().await; |
| @@ -76,12 +76,12 @@ async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #[embassy::task] | 79 | #[embassy_executor::task] |
| 80 | async fn net_task(stack: &'static Stack<Device>) -> ! { | 80 | async fn net_task(stack: &'static Stack<Device>) -> ! { |
| 81 | stack.run().await | 81 | stack.run().await |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | #[embassy::main] | 84 | #[embassy_executor::main] |
| 85 | async fn main(spawner: Spawner, p: Peripherals) { | 85 | async fn main(spawner: Spawner, p: Peripherals) { |
| 86 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 86 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 87 | 87 | ||
diff --git a/examples/nrf/src/bin/usb_hid_keyboard.rs b/examples/nrf/src/bin/usb_hid_keyboard.rs index 539ae6f16..863f3e5dd 100644 --- a/examples/nrf/src/bin/usb_hid_keyboard.rs +++ b/examples/nrf/src/bin/usb_hid_keyboard.rs | |||
| @@ -7,23 +7,22 @@ use core::mem; | |||
| 7 | use core::sync::atomic::{AtomicBool, Ordering}; | 7 | use core::sync::atomic::{AtomicBool, Ordering}; |
| 8 | 8 | ||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::channel::signal::Signal; | 10 | use embassy_executor::executor::Spawner; |
| 11 | use embassy::executor::Spawner; | ||
| 12 | use embassy::time::Duration; | ||
| 13 | use embassy::util::{select, Either}; | ||
| 14 | use embassy_nrf::gpio::{Input, Pin, Pull}; | 11 | use embassy_nrf::gpio::{Input, Pin, Pull}; |
| 15 | use embassy_nrf::usb::{Driver, PowerUsb}; | 12 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 16 | use embassy_nrf::{interrupt, pac, Peripherals}; | 13 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 17 | use embassy_usb::control::OutResponse; | 14 | use embassy_usb::control::OutResponse; |
| 18 | use embassy_usb::{Builder, Config, DeviceStateHandler}; | 15 | use embassy_usb::{Builder, Config, DeviceStateHandler}; |
| 19 | use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State}; | 16 | use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State}; |
| 17 | use embassy_util::channel::signal::Signal; | ||
| 18 | use embassy_util::{select, Either}; | ||
| 20 | use futures::future::join; | 19 | use futures::future::join; |
| 21 | use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; | 20 | use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; |
| 22 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 22 | ||
| 24 | static SUSPENDED: AtomicBool = AtomicBool::new(false); | 23 | static SUSPENDED: AtomicBool = AtomicBool::new(false); |
| 25 | 24 | ||
| 26 | #[embassy::main] | 25 | #[embassy_executor::main] |
| 27 | async fn main(_spawner: Spawner, p: Peripherals) { | 26 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 28 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 27 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 29 | 28 | ||
| @@ -154,11 +153,11 @@ impl RequestHandler for MyRequestHandler { | |||
| 154 | OutResponse::Accepted | 153 | OutResponse::Accepted |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | fn set_idle(&self, id: Option<ReportId>, dur: Duration) { | 156 | fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) { |
| 158 | info!("Set idle rate for {:?} to {:?}", id, dur); | 157 | info!("Set idle rate for {:?} to {:?}", id, dur); |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { | 160 | fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> { |
| 162 | info!("Get idle rate for {:?}", id); | 161 | info!("Get idle rate for {:?}", id); |
| 163 | None | 162 | None |
| 164 | } | 163 | } |
diff --git a/examples/nrf/src/bin/usb_hid_mouse.rs b/examples/nrf/src/bin/usb_hid_mouse.rs index 516e7ea95..88bf87bd6 100644 --- a/examples/nrf/src/bin/usb_hid_mouse.rs +++ b/examples/nrf/src/bin/usb_hid_mouse.rs | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy::time::{Duration, Timer}; | 10 | use embassy_executor::time::{Duration, Timer}; |
| 11 | use embassy_nrf::usb::{Driver, PowerUsb}; | 11 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 12 | use embassy_nrf::{interrupt, pac, Peripherals}; | 12 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 13 | use embassy_usb::control::OutResponse; | 13 | use embassy_usb::control::OutResponse; |
| @@ -17,7 +17,7 @@ use futures::future::join; | |||
| 17 | use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; | 17 | use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 19 | ||
| 20 | #[embassy::main] | 20 | #[embassy_executor::main] |
| 21 | async fn main(_spawner: Spawner, p: Peripherals) { | 21 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 22 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 22 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 23 | 23 | ||
| @@ -113,11 +113,11 @@ impl RequestHandler for MyRequestHandler { | |||
| 113 | OutResponse::Accepted | 113 | OutResponse::Accepted |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | fn set_idle(&self, id: Option<ReportId>, dur: Duration) { | 116 | fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) { |
| 117 | info!("Set idle rate for {:?} to {:?}", id, dur); | 117 | info!("Set idle rate for {:?} to {:?}", id, dur); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { | 120 | fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> { |
| 121 | info!("Get idle rate for {:?}", id); | 121 | info!("Get idle rate for {:?}", id); |
| 122 | None | 122 | None |
| 123 | } | 123 | } |
diff --git a/examples/nrf/src/bin/usb_serial.rs b/examples/nrf/src/bin/usb_serial.rs index d2200dc5d..7d233d24d 100644 --- a/examples/nrf/src/bin/usb_serial.rs +++ b/examples/nrf/src/bin/usb_serial.rs | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::{info, panic}; | 8 | use defmt::{info, panic}; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy_nrf::usb::{Driver, Instance, PowerUsb, UsbSupply}; | 10 | use embassy_nrf::usb::{Driver, Instance, PowerUsb, UsbSupply}; |
| 11 | use embassy_nrf::{interrupt, pac, Peripherals}; | 11 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 12 | use embassy_usb::driver::EndpointError; | 12 | use embassy_usb::driver::EndpointError; |
| @@ -15,7 +15,7 @@ use embassy_usb_serial::{CdcAcmClass, State}; | |||
| 15 | use futures::future::join; | 15 | use futures::future::join; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) { | 19 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 20 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 20 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 21 | 21 | ||
diff --git a/examples/nrf/src/bin/usb_serial_multitask.rs b/examples/nrf/src/bin/usb_serial_multitask.rs index 3806da5a0..956315322 100644 --- a/examples/nrf/src/bin/usb_serial_multitask.rs +++ b/examples/nrf/src/bin/usb_serial_multitask.rs | |||
| @@ -6,23 +6,23 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::{info, panic, unwrap}; | 8 | use defmt::{info, panic, unwrap}; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy::util::Forever; | ||
| 11 | use embassy_nrf::usb::{Driver, PowerUsb}; | 10 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 12 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; | 11 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; |
| 13 | use embassy_usb::driver::EndpointError; | 12 | use embassy_usb::driver::EndpointError; |
| 14 | use embassy_usb::{Builder, Config, UsbDevice}; | 13 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 15 | use embassy_usb_serial::{CdcAcmClass, State}; | 14 | use embassy_usb_serial::{CdcAcmClass, State}; |
| 15 | use embassy_util::Forever; | ||
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | type MyDriver = Driver<'static, peripherals::USBD, PowerUsb>; | 18 | type MyDriver = Driver<'static, peripherals::USBD, PowerUsb>; |
| 19 | 19 | ||
| 20 | #[embassy::task] | 20 | #[embassy_executor::task] |
| 21 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) { | 21 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) { |
| 22 | device.run().await; | 22 | device.run().await; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #[embassy::task] | 25 | #[embassy_executor::task] |
| 26 | async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { | 26 | async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { |
| 27 | loop { | 27 | loop { |
| 28 | class.wait_connection().await; | 28 | class.wait_connection().await; |
| @@ -32,7 +32,7 @@ async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { | |||
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #[embassy::main] | 35 | #[embassy_executor::main] |
| 36 | async fn main(spawner: Spawner, p: Peripherals) { | 36 | async fn main(spawner: Spawner, p: Peripherals) { |
| 37 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 37 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 38 | 38 | ||
diff --git a/examples/nrf/src/bin/wdt.rs b/examples/nrf/src/bin/wdt.rs index 280e23bcf..560cb3567 100644 --- a/examples/nrf/src/bin/wdt.rs +++ b/examples/nrf/src/bin/wdt.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Input, Pull}; | 7 | use embassy_nrf::gpio::{Input, Pull}; |
| 8 | use embassy_nrf::wdt::{Config, Watchdog}; | 8 | use embassy_nrf::wdt::{Config, Watchdog}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
