stm32/time: add Cargo features to choose tim2/tim3
This commit is contained in:
@ -19,7 +19,7 @@ defmt-error = []
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
|
||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32wb55cc"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32wb55cc", "time-driver-tim2"] }
|
||||
embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
|
||||
|
||||
defmt = "0.2.0"
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user