initial commit
This commit is contained in:
commit
db4adc53fa
10 changed files with 996 additions and 0 deletions
31
src/main.rs
Normal file
31
src/main.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use defmt::*;
|
||||
use defmt_rtt as _;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::{
|
||||
gpio::{Level, Output, Speed},
|
||||
peripherals::PA5
|
||||
};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use panic_probe as _; // global logger
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn blinker(mut led: Output<'static, PA5>, interval: Duration) {
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(interval).await;
|
||||
led.set_low();
|
||||
Timer::after(interval).await;
|
||||
}
|
||||
}
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let led = Output::new(p.PA5, Level::Low, Speed::Low);
|
||||
unwrap!(spawner.spawn(blinker(led, Duration::from_millis(500))));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue