stm32/time: add Cargo features to choose tim2/tim3

This commit is contained in:
Dario Nieuwenhuis
2021-08-04 12:05:22 +02:00
parent 0ea6a2d890
commit b1d631d639
10 changed files with 39 additions and 19 deletions

View File

@ -6,27 +6,29 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::OutputPin;
use example_common::*;
use cortex_m_rt::entry;
#[entry]
fn main() -> ! {
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
let p = embassy_stm32::init(Default::default());
unsafe { Dbgmcu::enable_all() };
let mut led = Output::new(p.PB0, Level::High, Speed::Low);
loop {
info!("high");
led.set_high().unwrap();
cortex_m::asm::delay(10_000_000);
Timer::after(Duration::from_millis(500)).await;
info!("low");
led.set_low().unwrap();
cortex_m::asm::delay(10_000_000);
Timer::after(Duration::from_millis(500)).await;
}
}