aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf/src/bin/self_spawn_current_executor.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-07-30 00:02:12 +0200
committerGitHub <[email protected]>2022-07-30 00:02:12 +0200
commitbd6bab1625d90a2dc2a4b57b40dcfaa9516bf791 (patch)
treee60fc8f8db8ec07e55d655c1a830b07f4db0b7d2 /examples/nrf/src/bin/self_spawn_current_executor.rs
parent8745d646f0976791b7098456aa61adb983fb1c18 (diff)
parenta0f1b0ee01d461607660d2d56b5b1bdc57e0d3fb (diff)
Merge pull request #883 from embassy-rs/split
Split embassy crate into embassy-executor, embassy-util.
Diffstat (limited to 'examples/nrf/src/bin/self_spawn_current_executor.rs')
-rw-r--r--examples/nrf/src/bin/self_spawn_current_executor.rs8
1 files changed, 4 insertions, 4 deletions
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
5use defmt::{info, unwrap}; 5use defmt::{info, unwrap};
6use embassy::executor::Spawner; 6use embassy_executor::executor::Spawner;
7use embassy::time::{Duration, Timer}; 7use embassy_executor::time::{Duration, Timer};
8use embassy_nrf::Peripherals; 8use embassy_nrf::Peripherals;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[embassy::task(pool_size = 2)] 11#[embassy_executor::task(pool_size = 2)]
12async fn my_task(n: u32) { 12async 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]
19async fn main(spawner: Spawner, _p: Peripherals) { 19async 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)));