embassy/examples/nrf/src/bin/timer.rs
2022-07-29 23:40:36 +02:00

32 lines
699 B
Rust

#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use defmt::{info, unwrap};
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::Peripherals;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::task]
async fn run1() {
loop {
info!("BIG INFREQUENT TICK");
Timer::after(Duration::from_ticks(64000)).await;
}
}
#[embassy_executor::task]
async fn run2() {
loop {
info!("tick");
Timer::after(Duration::from_ticks(13000)).await;
}
}
#[embassy_executor::main]
async fn main(spawner: Spawner, _p: Peripherals) {
unwrap!(spawner.spawn(run1()));
unwrap!(spawner.spawn(run2()));
}