embassy/tests/nrf/src/bin/timer.rs

26 lines
611 B
Rust
Raw Normal View History

2023-03-31 14:52:35 +02:00
#![no_std]
#![no_main]
2023-08-18 16:11:18 +02:00
teleprobe_meta::target!(b"nrf52840-dk");
2023-03-31 14:52:35 +02:00
use defmt::{assert, info};
use embassy_executor::Spawner;
use embassy_time::{Instant, Timer};
2023-03-31 14:52:35 +02:00
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let _p = embassy_nrf::init(Default::default());
info!("Hello World!");
let start = Instant::now();
Timer::after_millis(100).await;
2023-03-31 14:52:35 +02:00
let end = Instant::now();
let ms = (end - start).as_millis();
info!("slept for {} ms", ms);
assert!(ms >= 99);
assert!(ms < 110);
info!("Test OK");
cortex_m::asm::bkpt();
}