Revert blinky changes for now

This commit is contained in:
Ulf Lilleengen 2021-12-10 12:32:20 +01:00
parent e93f2679b1
commit 9b01eed195

View File

@ -8,21 +8,18 @@ mod example_common;
use defmt::unwrap; use defmt::unwrap;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::time::{Duration, Timer}; use embassy::time::{Duration, Timer};
use embassy_nrf::{Peripherals, peripherals::P0_13, gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_nrf::Peripherals;
use embedded_hal::digital::v2::OutputPin; use embedded_hal::digital::v2::OutputPin;
#[embassh::task]
async fn blinker(led: Output<'static, P0_13>, interval: Duration) {
loop {
unwrap!(led.set_high());
Timer::after(interval).await;
unwrap!(led.set_low());
Timer::after(interval).await;
}
}
#[embassy::main] #[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) { async fn main(_spawner: Spawner, p: Peripherals) {
let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300))));
loop {
unwrap!(led.set_high());
Timer::after(Duration::from_millis(300)).await;
unwrap!(led.set_low());
Timer::after(Duration::from_millis(300)).await;
}
} }