diff --git a/templates/index.html b/templates/index.html index ac8c307..e788aeb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -28,28 +28,31 @@

Rust + async ❤️ embedded

{% filter markdown%} ```rust use defmt::info; -use embassy::executor::Spawner; -use embassy::time::{Duration, Timer}; +use embassy_executor::Spawner; use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; use embassy_nrf::Peripherals; +use embassy_time::{Duration, Timer}; // Declare async tasks -#[embassy::task] +#[embassy_executor::task] async fn blink(pin: AnyPin) { let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); loop { // Timekeeping is globally available, no need to mess with hardware timers. led.set_high(); - Timer::after(Duration::from_millis(150)).await; + Timer::after_millis(150).await; led.set_low(); - Timer::after(Duration::from_millis(150)).await; + Timer::after_millis(150).await; } } // Main is itself an async task as well. -#[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +#[embassy_executor::main] +async fn main(spawner: Spawner) { + // Initialize the embassy-nrf HAL. + let p = embassy_nrf::init(Default::default()); + // Spawned tasks run in the background, concurrently. spawner.spawn(blink(p.P0_13.degrade())).unwrap();