aboutsummaryrefslogtreecommitdiff
path: root/tests/nrf/src/bin/timer.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-06-25 22:27:56 +0200
committerDario Nieuwenhuis <[email protected]>2024-06-25 22:29:07 +0200
commitcab17434d5411558e7fb9f260665ec8da88118a9 (patch)
tree4494cfc59064cfa896e3f9ce530d6fd4ccbcfcd9 /tests/nrf/src/bin/timer.rs
parent3ae2f140f9c794577b5bc10c43c21b9824dc3b9a (diff)
tests/nrf: unify, add nrf52832, nrf52833, nrf5340, nrf9160
Diffstat (limited to 'tests/nrf/src/bin/timer.rs')
-rw-r--r--tests/nrf/src/bin/timer.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/nrf/src/bin/timer.rs b/tests/nrf/src/bin/timer.rs
new file mode 100644
index 000000000..1ae9dd647
--- /dev/null
+++ b/tests/nrf/src/bin/timer.rs
@@ -0,0 +1,26 @@
1#![no_std]
2#![no_main]
3
4#[path = "../common.rs"]
5mod common;
6
7use defmt::{assert, info};
8use embassy_executor::Spawner;
9use embassy_time::{Instant, Timer};
10use {defmt_rtt as _, panic_probe as _};
11
12#[embassy_executor::main]
13async fn main(_spawner: Spawner) {
14 let _p = embassy_nrf::init(Default::default());
15 info!("Hello World!");
16
17 let start = Instant::now();
18 Timer::after_millis(100).await;
19 let end = Instant::now();
20 let ms = (end - start).as_millis();
21 info!("slept for {} ms", ms);
22 assert!(ms >= 99);
23
24 info!("Test OK");
25 cortex_m::asm::bkpt();
26}