stm32l4: Cleanup examples

* Use `cortex_m_rt::entry` for sync examples
* Use `Dbgmcu::enable_all()` everywhere
This commit is contained in:
Timo Kröger
2021-07-29 15:54:11 +02:00
parent 2a4890165d
commit 4ccac69929
9 changed files with 48 additions and 75 deletions

View File

@ -9,28 +9,26 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dac::{Channel, Dac, Value};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::NoPin;
use embassy_stm32::{pac, Peripherals};
use embassy_stm32::pac;
use example_common::*;
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
#[cortex_m_rt::entry]
fn main() -> ! {
info!("Hello World!");
unsafe {
pac::DBGMCU.cr().modify(|w| {
w.set_dbg_sleep(true);
w.set_dbg_standby(true);
w.set_dbg_stop(true);
});
Dbgmcu::enable_all();
pac::RCC.apb1enr1().modify(|w| {
w.set_dac1en(true);
});
}
let p = embassy_stm32::init(Default::default());
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
loop {