aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf/src/bin/self_spawn_current_executor.rs
diff options
context:
space:
mode:
authorDominik Boehi <[email protected]>2023-01-09 22:29:58 +0100
committerDominik Boehi <[email protected]>2023-01-09 22:30:02 +0100
commit0a27b6cedb52453123190671f294bbd34918e09a (patch)
tree3888e0b352388ace235517ec97c4d3a88fd7fcfa /examples/nrf/src/bin/self_spawn_current_executor.rs
parent401185b1d95a2519ee94e5d5654cc9325fe85eec (diff)
Rename examples/nrf to examples/nrf52840
Diffstat (limited to 'examples/nrf/src/bin/self_spawn_current_executor.rs')
-rw-r--r--examples/nrf/src/bin/self_spawn_current_executor.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/examples/nrf/src/bin/self_spawn_current_executor.rs b/examples/nrf/src/bin/self_spawn_current_executor.rs
deleted file mode 100644
index 8a179886c..000000000
--- a/examples/nrf/src/bin/self_spawn_current_executor.rs
+++ /dev/null
@@ -1,22 +0,0 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt::{info, unwrap};
6use embassy_executor::Spawner;
7use embassy_time::{Duration, Timer};
8use {defmt_rtt as _, panic_probe as _};
9
10#[embassy_executor::task(pool_size = 2)]
11async fn my_task(n: u32) {
12 Timer::after(Duration::from_secs(1)).await;
13 info!("Spawning self! {}", n);
14 unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1)));
15}
16
17#[embassy_executor::main]
18async fn main(spawner: Spawner) {
19 let _p = embassy_nrf::init(Default::default());
20 info!("Hello World!");
21 unwrap!(spawner.spawn(my_task(0)));
22}