Add timer test, add g0, g4 tests.

This commit is contained in:
Dario Nieuwenhuis
2021-12-07 00:28:32 +01:00
parent 693690cb5a
commit dde6607aec
5 changed files with 52 additions and 8 deletions

View File

@ -15,6 +15,13 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
// Arduino pins D0 and D1
// They're connected together with a 1K resistor.
#[cfg(feature = "stm32g491re")]
let (mut a, mut b) = (p.PC4, p.PC5);
#[cfg(feature = "stm32g071rb")]
let (mut a, mut b) = (p.PC4, p.PC5);
#[cfg(feature = "stm32f429zi")]
let (mut a, mut b) = (p.PG14, p.PG9);
// Test initial output

View File

@ -0,0 +1,27 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#[path = "../example_common.rs"]
mod example_common;
use defmt::assert;
use embassy::executor::Spawner;
use embassy::time::{Duration, Instant, Timer};
use embassy_stm32::Peripherals;
use example_common::*;
#[embassy::main]
async fn main(_spawner: Spawner, _p: Peripherals) {
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();
}