diff options
| author | Adam Greig <[email protected]> | 2023-10-15 00:57:25 +0100 |
|---|---|---|
| committer | Adam Greig <[email protected]> | 2023-10-15 01:30:12 +0100 |
| commit | 0621e957a0ddc7010d46b3ea3ddc8b9852bc8333 (patch) | |
| tree | f6caefe939109e55a73e9141c736d2f6c20f51e8 /examples/nrf52840/src/bin/self_spawn_current_executor.rs | |
| parent | 7559f9e5834799b041d899767ef4305dcfdf0181 (diff) | |
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
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 | } |
