2021-12-10 12:46:41 +01:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
|
|
|
use defmt::*;
|
2022-07-29 21:58:35 +02:00
|
|
|
use embassy_executor::executor::Spawner;
|
|
|
|
use embassy_executor::time::{Duration, Timer};
|
2022-06-12 22:15:44 +02:00
|
|
|
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
|
|
|
use embassy_nrf::peripherals::P0_13;
|
|
|
|
use {defmt_rtt as _, panic_probe as _}; // global logger
|
2021-12-10 12:46:41 +01:00
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::task]
|
2021-12-10 12:46:41 +01:00
|
|
|
async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) {
|
|
|
|
loop {
|
2021-12-19 23:25:02 +01:00
|
|
|
led.set_high();
|
2021-12-10 12:46:41 +01:00
|
|
|
Timer::after(interval).await;
|
2021-12-19 23:25:02 +01:00
|
|
|
led.set_low();
|
2021-12-10 12:46:41 +01:00
|
|
|
Timer::after(interval).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::main]
|
2022-08-17 18:49:55 +02:00
|
|
|
async fn main(spawner: Spawner) {
|
|
|
|
let p = embassy_nrf::init(Default::default());
|
|
|
|
|
2021-12-10 12:46:41 +01:00
|
|
|
let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
|
|
|
|
unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300))));
|
|
|
|
}
|