embassy/examples/std/src/bin/tick.rs

24 lines
461 B
Rust
Raw Normal View History

2021-02-03 05:05:05 +01:00
#![feature(type_alias_impl_trait)]
use embassy::executor::Spawner;
2021-02-03 05:05:05 +01:00
use embassy::time::{Duration, Timer};
use log::*;
#[embassy::task]
2021-02-03 05:05:05 +01:00
async fn run() {
loop {
info!("tick");
Timer::after(Duration::from_secs(1)).await;
}
}
#[embassy::main]
async fn main(spawner: Spawner) {
2021-02-03 05:05:05 +01:00
env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.format_timestamp_nanos()
.init();
spawner.spawn(run()).unwrap();
2021-02-03 05:05:05 +01:00
}