1315: Add HIL test for timer on nrf r=Dirbaio a=lulf 1325: Update Rust nightly. r=Dirbaio a=Dirbaio bors r+ Co-authored-by: Ulf Lilleengen <lulf@redhat.com> Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
This commit is contained in:
commit
117fca84ea
@ -1,7 +1,7 @@
|
|||||||
# Before upgrading check that everything is available on all tier1 targets here:
|
# Before upgrading check that everything is available on all tier1 targets here:
|
||||||
# https://rust-lang.github.io/rustup-components-history
|
# https://rust-lang.github.io/rustup-components-history
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2023-02-07"
|
channel = "nightly-2023-04-02"
|
||||||
components = [ "rust-src", "rustfmt", "llvm-tools-preview" ]
|
components = [ "rust-src", "rustfmt", "llvm-tools-preview" ]
|
||||||
targets = [
|
targets = [
|
||||||
"thumbv7em-none-eabi",
|
"thumbv7em-none-eabi",
|
||||||
|
25
tests/nrf/src/bin/timer.rs
Normal file
25
tests/nrf/src/bin/timer.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use defmt::{assert, info};
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_time::{Duration, Instant, Timer};
|
||||||
|
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(Duration::from_millis(100)).await;
|
||||||
|
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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user