Merge pull request #329 from timokroeger/misc-stm32-fixes
Misc stm32 fixes
This commit is contained in:
commit
e9885a61f8
@ -2,7 +2,8 @@ use core::marker::PhantomData;
|
|||||||
|
|
||||||
use embassy::util::Unborrow;
|
use embassy::util::Unborrow;
|
||||||
|
|
||||||
use crate::pac::{DBGMCU, FLASH, RCC};
|
use crate::dbgmcu::Dbgmcu;
|
||||||
|
use crate::pac::{FLASH, RCC};
|
||||||
use crate::peripherals;
|
use crate::peripherals;
|
||||||
use crate::time::Hertz;
|
use crate::time::Hertz;
|
||||||
|
|
||||||
@ -193,12 +194,7 @@ impl<'d> Rcc<'d> {
|
|||||||
if self.config.enable_debug_wfe {
|
if self.config.enable_debug_wfe {
|
||||||
RCC.ahbenr().modify(|w| w.set_dmaen(true));
|
RCC.ahbenr().modify(|w| w.set_dmaen(true));
|
||||||
|
|
||||||
critical_section::with(|_| {
|
critical_section::with(|_| Dbgmcu::enable_all());
|
||||||
DBGMCU.cr().modify(|w| {
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
pub use super::types::*;
|
pub use super::types::*;
|
||||||
|
use crate::dbgmcu::Dbgmcu;
|
||||||
use crate::pac;
|
use crate::pac;
|
||||||
use crate::peripherals::{self, CRS, RCC, SYSCFG};
|
use crate::peripherals::{self, CRS, RCC, SYSCFG};
|
||||||
use crate::rcc::{get_freqs, set_freqs, Clocks};
|
use crate::rcc::{get_freqs, set_freqs, Clocks};
|
||||||
@ -172,11 +173,7 @@ impl<'d> Rcc<'d> {
|
|||||||
unsafe {
|
unsafe {
|
||||||
pac::RCC.ahbenr().modify(|w| w.set_dma1en(enable_dma));
|
pac::RCC.ahbenr().modify(|w| w.set_dma1en(enable_dma));
|
||||||
|
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,11 +122,7 @@ impl<'d> Rcc<'d> {
|
|||||||
unsafe {
|
unsafe {
|
||||||
pac::RCC.ahb1enr().modify(|w| w.set_dma1en(enable_dma));
|
pac::RCC.ahb1enr().modify(|w| w.set_dma1en(enable_dma));
|
||||||
|
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use embassy_stm32::Peripherals;
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
#[embassy::main]
|
#[embassy::main(config = "example_common::config()")]
|
||||||
async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
|
async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
|
||||||
loop {
|
loop {
|
||||||
Timer::after(Duration::from_secs(1)).await;
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
@ -6,6 +6,14 @@ use panic_probe as _;
|
|||||||
pub use defmt::*;
|
pub use defmt::*;
|
||||||
|
|
||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
use embassy_stm32::rcc;
|
||||||
|
use embassy_stm32::Config;
|
||||||
|
|
||||||
|
pub fn config() -> Config {
|
||||||
|
let mut rcc_config = rcc::Config::default();
|
||||||
|
rcc_config.enable_debug_wfe = true;
|
||||||
|
Config::default().rcc(rcc_config)
|
||||||
|
}
|
||||||
|
|
||||||
defmt::timestamp! {"{=u64}", {
|
defmt::timestamp! {"{=u64}", {
|
||||||
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
@ -8,21 +8,20 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use embassy_stm32::{
|
|
||||||
gpio::{Level, Output, Speed},
|
use defmt::panic;
|
||||||
rcc::*,
|
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 embedded_hal::digital::v2::OutputPin;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
#[embassy::main]
|
||||||
|
async fn main(_spawner: Spawner, mut p: Peripherals) {
|
||||||
#[entry]
|
|
||||||
fn main() -> ! {
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut p = embassy_stm32::init(Default::default());
|
|
||||||
|
|
||||||
Rcc::new(p.RCC).enable_debug_wfe(&mut p.DBGMCU, true);
|
Rcc::new(p.RCC).enable_debug_wfe(&mut p.DBGMCU, true);
|
||||||
|
|
||||||
let mut led = Output::new(p.PB5, Level::High, Speed::Low);
|
let mut led = Output::new(p.PB5, Level::High, Speed::Low);
|
||||||
@ -30,10 +29,10 @@ fn main() -> ! {
|
|||||||
loop {
|
loop {
|
||||||
info!("high");
|
info!("high");
|
||||||
led.set_high().unwrap();
|
led.set_high().unwrap();
|
||||||
cortex_m::asm::delay(1_000_000);
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
info!("low");
|
info!("low");
|
||||||
led.set_low().unwrap();
|
led.set_low().unwrap();
|
||||||
cortex_m::asm::delay(1_000_000);
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,20 +8,17 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use embassy::executor::Executor;
|
|
||||||
use embassy::time::Clock;
|
use defmt::panic;
|
||||||
use embassy::util::Forever;
|
use embassy::executor::Spawner;
|
||||||
use embassy_stm32::exti::ExtiInput;
|
use embassy_stm32::exti::ExtiInput;
|
||||||
use embassy_stm32::gpio::{Input, Pull};
|
use embassy_stm32::gpio::{Input, Pull};
|
||||||
use embassy_stm32::rcc;
|
use embassy_stm32::{rcc, Peripherals};
|
||||||
use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
#[embassy::main]
|
||||||
|
async fn main(_spawner: Spawner, mut p: Peripherals) {
|
||||||
#[embassy::task]
|
|
||||||
async fn main_task() {
|
|
||||||
let mut p = embassy_stm32::init(Default::default());
|
|
||||||
let mut rcc = rcc::Rcc::new(p.RCC);
|
let mut rcc = rcc::Rcc::new(p.RCC);
|
||||||
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
|
rcc.enable_debug_wfe(&mut p.DBGMCU, true);
|
||||||
// Enables SYSCFG
|
// Enables SYSCFG
|
||||||
@ -39,26 +36,3 @@ async fn main_task() {
|
|||||||
info!("Released!");
|
info!("Released!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ZeroClock;
|
|
||||||
|
|
||||||
impl Clock for ZeroClock {
|
|
||||||
fn now(&self) -> u64 {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static EXECUTOR: Forever<Executor> = Forever::new();
|
|
||||||
|
|
||||||
#[entry]
|
|
||||||
fn main() -> ! {
|
|
||||||
info!("Hello World!");
|
|
||||||
|
|
||||||
unsafe { embassy::time::set_clock(&ZeroClock) };
|
|
||||||
|
|
||||||
let executor = EXECUTOR.put(Executor::new());
|
|
||||||
|
|
||||||
executor.run(|spawner| {
|
|
||||||
unwrap!(spawner.spawn(main_task()));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
|
authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "embassy-stm32f4-examples"
|
name = "embassy-stm32l4-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
@ -9,29 +9,27 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
|
||||||
use embassy::time::Delay;
|
use embassy::time::Delay;
|
||||||
use embassy_stm32::adc::{Adc, Resolution};
|
use embassy_stm32::adc::{Adc, Resolution};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
use embassy_stm32::pac;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
#[embassy::main]
|
#[cortex_m_rt::entry]
|
||||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Dbgmcu::enable_all();
|
||||||
|
|
||||||
pac::RCC.ccipr().modify(|w| {
|
pac::RCC.ccipr().modify(|w| {
|
||||||
w.set_adcsel(0b11);
|
w.set_adcsel(0b11);
|
||||||
});
|
});
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
pac::RCC.ahb2enr().modify(|w| w.set_adcen(true));
|
pac::RCC.ahb2enr().modify(|w| w.set_adcen(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let mut adc = Adc::new(p.ADC1, &mut Delay);
|
let mut adc = Adc::new(p.ADC1, &mut Delay);
|
||||||
//adc.enable_vref();
|
//adc.enable_vref();
|
||||||
adc.set_resolution(Resolution::EightBit);
|
adc.set_resolution(Resolution::EightBit);
|
||||||
|
@ -11,8 +11,9 @@ mod example_common;
|
|||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::time::{Duration, Timer};
|
use embassy::time::{Duration, Timer};
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::Peripherals;
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
@ -21,11 +22,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
|
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
|
||||||
|
@ -8,25 +8,21 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use defmt::panic;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy::executor::Spawner;
|
|
||||||
use embassy_stm32::gpio::{Input, Pull};
|
use embassy_stm32::gpio::{Input, Pull};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
|
||||||
use embedded_hal::digital::v2::InputPin;
|
use embedded_hal::digital::v2::InputPin;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
#[embassy::main]
|
#[cortex_m_rt::entry]
|
||||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy_stm32::exti::ExtiInput;
|
use embassy_stm32::exti::ExtiInput;
|
||||||
use embassy_stm32::gpio::{Input, Pull};
|
use embassy_stm32::gpio::{Input, Pull};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::Peripherals;
|
||||||
use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
@ -21,11 +22,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
@ -9,28 +9,26 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
|
||||||
use embassy_stm32::dac::{Channel, Dac, Value};
|
use embassy_stm32::dac::{Channel, Dac, Value};
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy_stm32::gpio::NoPin;
|
use embassy_stm32::gpio::NoPin;
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::pac;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
#[embassy::main]
|
#[cortex_m_rt::entry]
|
||||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
pac::RCC.apb1enr1().modify(|w| {
|
pac::RCC.apb1enr1().modify(|w| {
|
||||||
w.set_dac1en(true);
|
w.set_dac1en(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
|
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -9,29 +9,25 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::panic;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy::executor::Spawner;
|
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||||
use embassy_stm32::spi::{Config, Spi};
|
use embassy_stm32::spi::{Config, Spi};
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::time::Hertz;
|
||||||
use embassy_stm32::{pac, Peripherals};
|
|
||||||
use embedded_hal::blocking::spi::Transfer;
|
use embedded_hal::blocking::spi::Transfer;
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
#[embassy::main]
|
#[cortex_m_rt::entry]
|
||||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let mut spi = Spi::new(
|
let mut spi = Spi::new(
|
||||||
p.SPI3,
|
p.SPI3,
|
||||||
p.PC10,
|
p.PC10,
|
||||||
|
@ -11,10 +11,11 @@ mod example_common;
|
|||||||
|
|
||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||||
use embassy_stm32::spi::{Config, Spi};
|
use embassy_stm32::spi::{Config, Spi};
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::time::Hertz;
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::Peripherals;
|
||||||
use embassy_traits::spi::FullDuplex;
|
use embassy_traits::spi::FullDuplex;
|
||||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
@ -24,11 +25,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut spi = Spi::new(
|
let mut spi = Spi::new(
|
||||||
|
@ -8,26 +8,23 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use cortex_m::prelude::_embedded_hal_blocking_serial_Write;
|
|
||||||
use defmt::panic;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy::executor::Spawner;
|
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
use embassy_stm32::usart::{Config, Uart};
|
use embassy_stm32::usart::{Config, Uart};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embedded_hal::blocking::serial::Write;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
#[embassy::main]
|
#[cortex_m_rt::entry]
|
||||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config);
|
let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config);
|
||||||
|
|
||||||
|
@ -11,9 +11,10 @@ mod example_common;
|
|||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
use embassy_stm32::usart::{Config, Uart};
|
use embassy_stm32::usart::{Config, Uart};
|
||||||
use embassy_stm32::{pac, Peripherals};
|
use embassy_stm32::Peripherals;
|
||||||
use embassy_traits::uart::Write as _;
|
use embassy_traits::uart::Write as _;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
@ -23,11 +24,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
pac::DBGMCU.cr().modify(|w| {
|
Dbgmcu::enable_all();
|
||||||
w.set_dbg_sleep(true);
|
|
||||||
w.set_dbg_standby(true);
|
|
||||||
w.set_dbg_stop(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user