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

24 lines
497 B
Rust
Raw Normal View History

2021-02-03 05:05:05 +01:00
#![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
2021-02-03 05:05:05 +01:00
use log::*;
#[embassy_executor::task]
2021-02-03 05:05:05 +01:00
async fn run() {
loop {
info!("tick");
Timer::after(Duration::from_secs(1)).await;
}
}
#[embassy_executor::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
}