stm32: move dbgmcu stuff to toplevel config setting, defaulting to true.

This commit is contained in:
Dario Nieuwenhuis 2021-08-19 23:32:22 +02:00
parent 446d6c275c
commit 2c992f7010
46 changed files with 26 additions and 233 deletions

View File

@ -68,12 +68,14 @@ pub use generated::{peripherals, Peripherals};
#[non_exhaustive]
pub struct Config {
pub rcc: rcc::Config,
pub enable_debug_during_sleep: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
rcc: Default::default(),
enable_debug_during_sleep: true,
}
}
}
@ -83,6 +85,10 @@ pub fn init(config: Config) -> Peripherals {
let p = Peripherals::take();
unsafe {
if config.enable_debug_during_sleep {
dbgmcu::Dbgmcu::enable_all();
}
gpio::init();
dma::init();
#[cfg(exti)]

View File

@ -2,7 +2,6 @@ use core::marker::PhantomData;
use embassy::util::Unborrow;
use crate::dbgmcu::Dbgmcu;
use crate::pac::{FLASH, RCC};
use crate::peripherals;
use crate::time::Hertz;
@ -27,7 +26,6 @@ pub struct Config {
pub sys_ck: Option<Hertz>,
pub hclk: Option<Hertz>,
pub pclk: Option<Hertz>,
pub enable_debug_wfe: bool,
}
pub struct Rcc<'d> {
@ -190,12 +188,6 @@ impl<'d> Rcc<'d> {
}
})
}
if self.config.enable_debug_wfe {
RCC.ahbenr().modify(|w| w.set_dmaen(true));
critical_section::with(|_| Dbgmcu::enable_all());
}
}
Clocks {

View File

@ -21,7 +21,6 @@ pub struct Config {
pub hclk: Option<Hertz>,
pub pclk1: Option<Hertz>,
pub pclk2: Option<Hertz>,
pub enable_debug_wfe: bool,
}
/// RCC peripheral
@ -176,15 +175,6 @@ impl<'d> Rcc<'d> {
});
}
if self.config.enable_debug_wfe {
unsafe {
RCC.ahb1enr().modify(|w| w.set_dma1en(true));
critical_section::with(|_| {
crate::dbgmcu::Dbgmcu::enable_all();
});
}
}
Clocks {
sys: Hertz(sysclk),
apb1: Hertz(pclk1),

View File

@ -3,7 +3,7 @@ use core::marker::PhantomData;
use embassy::util::Unborrow;
use crate::pac::rcc::vals::Timpre;
use crate::pac::{DBGMCU, RCC, SYSCFG};
use crate::pac::{RCC, SYSCFG};
use crate::peripherals;
use crate::pwr::{Power, VoltageScale};
use crate::rcc::{set_freqs, Clocks};
@ -363,25 +363,6 @@ impl<'d> Rcc<'d> {
}
}
/// Enables debugging during WFI/WFE
///
/// Set `enable_dma1` to true if you do not have at least one bus master (other than the CPU)
/// enable during WFI/WFE
pub fn enable_debug_wfe(&mut self, _dbg: &mut peripherals::DBGMCU, enable_dma1: bool) {
// NOTE(unsafe) We have exclusive access to the RCC and DBGMCU
unsafe {
if enable_dma1 {
RCC.ahb1enr().modify(|w| w.set_dma1en(true));
}
DBGMCU.cr().modify(|w| {
w.set_dbgsleep_d1(true);
w.set_dbgstby_d1(true);
w.set_dbgstop_d1(true);
});
}
}
/// Setup traceclk
/// Returns a pll1_r_ck
fn traceclk_setup(&mut self, sys_use_pll1_p: bool) {

View File

@ -1,5 +1,4 @@
pub use super::types::*;
use crate::dbgmcu::Dbgmcu;
use crate::pac;
use crate::peripherals::{self, CRS, RCC, SYSCFG};
use crate::rcc::{get_freqs, set_freqs, Clocks};
@ -168,15 +167,6 @@ impl<'d> Rcc<'d> {
unsafe { get_freqs() }
}
pub fn enable_debug_wfe(&mut self, _dbg: &mut peripherals::DBGMCU, enable_dma: bool) {
// NOTE(unsafe) We have exclusive access to the RCC and DBGMCU
unsafe {
pac::RCC.ahbenr().modify(|w| w.set_dma1en(enable_dma));
Dbgmcu::enable_all();
}
}
pub fn enable_hsi48(&mut self, _syscfg: &mut SYSCFG, _crs: CRS) -> HSI48 {
let rcc = pac::RCC;
unsafe {

View File

@ -12,7 +12,7 @@ use embassy_stm32::Peripherals;
#[path = "../example_common.rs"]
mod example_common;
#[embassy::main(config = "example_common::config()")]
#[embassy::main]
async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
loop {
Timer::after(Duration::from_secs(1)).await;

View File

@ -6,13 +6,6 @@ use panic_probe as _;
pub use defmt::*;
use core::sync::atomic::{AtomicUsize, Ordering};
use embassy_stm32::Config;
pub fn config() -> Config {
let mut config = Config::default();
config.rcc.enable_debug_wfe = true;
config
}
defmt::timestamp! {"{=u64}", {
static COUNT: AtomicUsize = AtomicUsize::new(0);

View File

@ -8,7 +8,6 @@
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;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let mut led = Output::new(p.PB7, Level::High, Speed::Low);
loop {

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embedded_hal::digital::v2::{InputPin, OutputPin};
use example_common::*;
@ -16,10 +15,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let button = Input::new(p.PC13, Pull::Down);

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let button = Input::new(p.PC13, Pull::Down);
let mut button = ExtiInput::new(button, p.EXTI13);

View File

@ -10,7 +10,6 @@ mod example_common;
use cortex_m_rt::entry;
use embassy_stm32::can::filter::Mask32;
use embassy_stm32::can::{Can, Frame, StandardId};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Input, Pull};
use example_common::*;
@ -18,10 +17,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let mut p = embassy_stm32::init(Default::default());
// The next two lines are a workaround for testing without transceiver.

View File

@ -17,7 +17,6 @@ mod example_common;
fn config() -> Config {
let mut config = Config::default();
config.rcc.sys_ck = Some(Hertz(84_000_000));
config.rcc.enable_debug_wfe = true;
config
}

View File

@ -8,7 +8,6 @@
mod example_common;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi};
@ -21,10 +20,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World, dude!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let mut spi = Spi::new(

View File

@ -9,7 +9,6 @@ mod example_common;
use core::fmt::Write;
use core::str::from_utf8;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use embassy_stm32::Peripherals;
@ -21,10 +20,6 @@ use heapless::String;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let mut spi = Spi::new(
p.SPI1,
p.PB3,

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embedded_hal::blocking::serial::Write;
@ -17,10 +16,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let config = Config::default();

View File

@ -8,7 +8,6 @@
mod example_common;
use core::fmt::Write;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::Peripherals;
@ -20,10 +19,6 @@ use heapless::String;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let config = Config::default();
let mut usart = Uart::new(p.USART3, p.PD9, p.PD8, p.DMA1_CH3, NoDma, config);

View File

@ -8,7 +8,6 @@
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;
@ -18,8 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe { Dbgmcu::enable_all() };
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
loop {

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let button = Input::new(p.PC13, Pull::Down);
let mut button = ExtiInput::new(button, p.EXTI13);

View File

@ -19,10 +19,6 @@ fn main() -> ! {
let p = embassy_stm32::init(config());
unsafe {
Dbgmcu::enable_all();
}
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
loop {
@ -33,7 +29,6 @@ fn main() -> ! {
}
}
use embassy_stm32::dbgmcu::Dbgmcu;
use micromath::F32Ext;
fn to_sine_wave(v: u8) -> u8 {

View File

@ -19,7 +19,6 @@ use embassy_macros::interrupt_take;
use embassy_net::{
Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket,
};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::eth::lan8742a::LAN8742A;
use embassy_stm32::eth::{Ethernet, State};
use embassy_stm32::rng::Random;
@ -96,10 +95,6 @@ fn main() -> ! {
info!("Setup RCC...");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(config());
let rng = Random::new(p.RNG);

View File

@ -17,7 +17,6 @@ use example_common::*;
use core::str::from_utf8;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::peripherals::SPI3;
use embassy_stm32::time::U32Ext;
use heapless::String;
@ -43,10 +42,6 @@ static EXECUTOR: Forever<Executor> = Forever::new();
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(config());
let spi = spi::Spi::new(

View File

@ -16,7 +16,6 @@ use example_common::*;
use core::str::from_utf8;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::peripherals::{DMA1_CH3, DMA1_CH4, SPI3};
use embassy_stm32::spi;
use heapless::String;
@ -39,10 +38,6 @@ static EXECUTOR: Forever<Executor> = Forever::new();
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(config());
let spi = spi::Spi::new(

View File

@ -14,7 +14,6 @@ use embassy_stm32::usart::{Config, Uart};
use example_common::*;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
#[embassy::task]
async fn main_task() {
@ -39,10 +38,6 @@ static EXECUTOR: Forever<Executor> = Forever::new();
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {

View File

@ -9,7 +9,6 @@ mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
use embassy::util::Forever;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embassy_traits::uart::Write as _Write;
@ -41,10 +40,6 @@ static EXECUTOR: Forever<Executor> = Forever::new();
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {

View File

@ -27,7 +27,7 @@ defmt = "0.2.0"
defmt-rtt = "0.2.0"
cortex-m = "0.7.1"
cortex-m-rt = "0.6.14"
cortex-m-rt = "0.7.0"
embedded-hal = { version = "0.2.4" }
panic-probe = { version = "0.2.0", features= ["print-defmt"] }
futures = { version = "0.3.8", default-features = false, features = ["async-await"] }

View File

@ -10,17 +10,14 @@ mod example_common;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::rcc::Rcc;
use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::OutputPin;
use example_common::*;
#[embassy::main]
async fn main(_spawner: Spawner, mut p: Peripherals) {
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
Rcc::new(p.RCC).enable_debug_wfe(&mut p.DBGMCU, true);
let mut led = Output::new(p.PB5, Level::High, Speed::Low);
loop {

View File

@ -6,22 +6,16 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::{
gpio::{Input, Level, Output, Pull, Speed},
rcc::*,
};
use embassy::executor::Spawner;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::{InputPin, 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 mut p = embassy_stm32::init(Default::default());
Rcc::new(p.RCC).enable_debug_wfe(&mut p.DBGMCU, true);
let button = Input::new(p.PB2, Pull::Up);
let mut led1 = Output::new(p.PA5, Level::High, Speed::Low);
let mut led2 = Output::new(p.PB5, Level::High, Speed::Low);

View File

@ -17,7 +17,6 @@ use example_common::*;
#[embassy::main]
async fn main(_spawner: Spawner, mut p: Peripherals) {
let mut rcc = rcc::Rcc::new(p.RCC);
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
// Enables SYSCFG
let _ = rcc.enable_hsi48(&mut p.SYSCFG, p.CRS);

View File

@ -7,25 +7,21 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::gpio::{Level, Output, Speed};
use embedded_hal::digital::v2::OutputPin;
use example_common::*;
use cortex_m_rt::entry;
use embassy_stm32::dma::NoDma;
use embassy_stm32::rcc;
use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use embassy_stm32::Peripherals;
use embedded_hal::blocking::spi::Transfer;
#[entry]
fn main() -> ! {
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World, folks!");
let mut p = embassy_stm32::init(Default::default());
let mut rcc = rcc::Rcc::new(p.RCC);
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
let mut spi = Spi::new(
p.SPI1,
p.PB3,
@ -40,7 +36,7 @@ fn main() -> ! {
let mut cs = Output::new(p.PA15, Level::High, Speed::VeryHigh);
loop {
let mut buf = [0x0A; 4];
let mut buf = [0x0Au8; 4];
unwrap!(cs.set_low());
unwrap!(spi.transfer(&mut buf));
unwrap!(cs.set_high());

View File

@ -11,14 +11,11 @@ use example_common::*;
use embassy::executor::Spawner;
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::{rcc, Peripherals};
use embassy_stm32::Peripherals;
use embassy_traits::uart::{Read, Write};
#[embassy::main]
async fn main(_spawner: Spawner, mut p: Peripherals) {
let mut rcc = rcc::Rcc::new(p.RCC);
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
async fn main(_spawner: Spawner, p: Peripherals) {
let mut usart = Uart::new(
p.USART1,
p.PB7,

View File

@ -15,13 +15,10 @@ use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
use embassy_stm32::dma::NoDma;
use embassy_stm32::interrupt;
use embassy_stm32::usart::{BufferedUart, Config, State, Uart};
use embassy_stm32::{rcc, Peripherals};
use embassy_stm32::Peripherals;
#[embassy::main]
async fn main(_spawner: Spawner, mut p: Peripherals) {
let mut rcc = rcc::Rcc::new(p.RCC);
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
async fn main(_spawner: Spawner, p: Peripherals) {
static mut TX_BUFFER: [u8; 8] = [0; 8];
static mut RX_BUFFER: [u8; 256] = [0; 256];

View File

@ -26,7 +26,7 @@ defmt = "0.2.0"
defmt-rtt = "0.2.0"
cortex-m = "0.7.1"
cortex-m-rt = "0.6.14"
cortex-m-rt = "0.7.0"
embedded-hal = { version = "0.2.4" }
panic-probe = { version = "0.2.0", features= ["print-defmt"] }
futures = { version = "0.3.8", default-features = false, features = ["async-await"] }

View File

@ -9,7 +9,6 @@ mod example_common;
use embassy::time::Delay;
use embassy_stm32::adc::{Adc, Resolution};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::pac;
use example_common::*;
@ -18,8 +17,6 @@ fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
pac::RCC.ccipr().modify(|w| {
w.set_adcsel(0b11);
});

View File

@ -8,7 +8,6 @@
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;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
loop {

View File

@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Input, Pull};
use embedded_hal::digital::v2::InputPin;
use example_common::*;
@ -15,10 +14,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let button = Input::new(p.PC13, Pull::Up);

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let button = Input::new(p.PC13, Pull::Up);
let mut button = ExtiInput::new(button, p.EXTI13);

View File

@ -8,7 +8,6 @@
mod example_common;
use embassy_stm32::dac::{Channel, Dac, Value};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::NoPin;
use embassy_stm32::pac;
use example_common::*;
@ -18,8 +17,6 @@ fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
pac::RCC.apb1enr1().modify(|w| {
w.set_dac1en(true);
});

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi};
@ -20,10 +19,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let mut spi = Spi::new(

View File

@ -8,7 +8,6 @@
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
@ -21,10 +20,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let mut spi = Spi::new(
p.SPI3,
p.PC10,

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embedded_hal::blocking::serial::Write;
@ -17,10 +16,6 @@ use example_common::*;
fn main() -> ! {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Default::default());
let config = Config::default();

View File

@ -8,7 +8,6 @@
mod example_common;
use core::fmt::Write;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::Peripherals;
@ -20,10 +19,6 @@ use heapless::String;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let config = Config::default();
let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, p.DMA1_CH3, NoDma, config);

View File

@ -8,7 +8,6 @@
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;
@ -18,8 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe { Dbgmcu::enable_all() };
let mut led = Output::new(p.PB0, Level::High, Speed::Low);
loop {

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
@ -18,10 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe {
Dbgmcu::enable_all();
}
let button = Input::new(p.PC4, Pull::Up);
let mut button = ExtiInput::new(button, p.EXTI4);

View File

@ -8,7 +8,6 @@
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;
@ -18,8 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe { Dbgmcu::enable_all() };
let mut led = Output::new(p.PB15, Level::High, Speed::Low);
loop {

View File

@ -6,10 +6,7 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy_stm32::{
dbgmcu::Dbgmcu,
gpio::{Input, Level, Output, Pull, Speed},
};
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embedded_hal::digital::v2::{InputPin, OutputPin};
use example_common::*;
@ -21,8 +18,6 @@ fn main() -> ! {
let p = embassy_stm32::init(Default::default());
unsafe { Dbgmcu::enable_all() };
let button = Input::new(p.PA0, Pull::Up);
let mut led1 = Output::new(p.PB15, Level::High, Speed::Low);
let mut led2 = Output::new(p.PB9, Level::High, Speed::Low);

View File

@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
@ -18,8 +17,6 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe { Dbgmcu::enable_all() };
let button = Input::new(p.PA0, Pull::Up);
let mut button = ExtiInput::new(button, p.EXTI0);