diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-15 00:34:59 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-15 00:34:59 +0000 |
| commit | 7045c5317091c8e81b0dbe64c9788bb2667472b1 (patch) | |
| tree | 7d2e7610753a24c71036cade2c3f5215c542afca /examples/nrf52840/src/bin/self_spawn_current_executor.rs | |
| parent | a818f336582fcaef3795cb99a7e38d3c4b9c1237 (diff) | |
| parent | 0621e957a0ddc7010d46b3ea3ddc8b9852bc8333 (diff) | |
Merge pull request #2061 from adamgreig/timer-helpers
Add convenience methods for Timer::after_secs/millis/micros/ticks
Diffstat (limited to 'examples/nrf52840/src/bin/self_spawn_current_executor.rs')
| -rw-r--r-- | examples/nrf52840/src/bin/self_spawn_current_executor.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/nrf52840/src/bin/self_spawn_current_executor.rs b/examples/nrf52840/src/bin/self_spawn_current_executor.rs index 8a179886c..65d50f8c3 100644 --- a/examples/nrf52840/src/bin/self_spawn_current_executor.rs +++ b/examples/nrf52840/src/bin/self_spawn_current_executor.rs | |||
| @@ -4,12 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_time::{Duration, Timer}; | 7 | use embassy_time::Timer; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy_executor::task(pool_size = 2)] | 10 | #[embassy_executor::task(pool_size = 2)] |
| 11 | async fn my_task(n: u32) { | 11 | async fn my_task(n: u32) { |
| 12 | Timer::after(Duration::from_secs(1)).await; | 12 | Timer::after_secs(1).await; |
| 13 | info!("Spawning self! {}", n); | 13 | info!("Spawning self! {}", n); |
| 14 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); | 14 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); |
| 15 | } | 15 | } |
