Add STM32U5 example.

This commit is contained in:
Bob McWhirter
2021-11-02 14:43:42 -04:00
parent 705523d0ea
commit 3ab1775820
4 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::gpio::{Input, Pull};
use embedded_hal::digital::v2::InputPin;
use example_common::*;
#[cortex_m_rt::entry]
fn main() -> ! {
info!("Hello World!");
loop {}
//let p = embassy_stm32::init(Default::default());
//let button = Input::new(p.PC13, Pull::Up);
//loop {
//if unwrap!(button.is_high()) {
//info!("high");
//} else {
//info!("low");
//}
//}
}

View File

@ -0,0 +1,17 @@
#![macro_use]
use defmt_rtt as _; // global logger
use panic_probe as _;
pub use defmt::*;
use core::sync::atomic::{AtomicUsize, Ordering};
defmt::timestamp! {"{=u64}", {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
}
}