From 06fb2a7a808d9c05d9724fc4239e2efde1d3511a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Kr=C3=B6ger?= Date: Thu, 22 Jul 2021 23:12:07 +0200 Subject: [PATCH] Enable SYSCFG clock in `exti::init()` --- embassy-stm32/src/exti/mod.rs | 3 +++ examples/stm32f4/src/bin/button_exti.rs | 10 +--------- examples/stm32l4/src/bin/button.rs | 4 ---- examples/stm32l4/src/bin/button_exti.rs | 4 ---- examples/stm32l4/src/bin/spi.rs | 6 +----- examples/stm32l4/src/bin/spi_dma.rs | 8 -------- examples/stm32l4/src/bin/usart.rs | 4 ---- examples/stm32l4/src/bin/usart_dma.rs | 6 +----- 8 files changed, 6 insertions(+), 39 deletions(-) diff --git a/embassy-stm32/src/exti/mod.rs b/embassy-stm32/src/exti/mod.rs index 126a6fb6..217c8173 100644 --- a/embassy-stm32/src/exti/mod.rs +++ b/embassy-stm32/src/exti/mod.rs @@ -108,4 +108,7 @@ pub(crate) unsafe fn init() { use embassy::interrupt::InterruptExt; foreach_exti_irq!(enable_irq); + + #[cfg(not(rcc_wb55))] + ::enable(); } diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs index 6c51095e..bc48c2b1 100644 --- a/examples/stm32f4/src/bin/button_exti.rs +++ b/examples/stm32f4/src/bin/button_exti.rs @@ -17,7 +17,6 @@ use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; use example_common::*; use cortex_m_rt::entry; -use embassy_stm32::pac; #[embassy::task] async fn main_task() { @@ -42,14 +41,7 @@ static EXECUTOR: Forever = Forever::new(); fn main() -> ! { info!("Hello World!"); - unsafe { - Dbgmcu::enable_all(); - - // EXTI clock - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); - } + unsafe { Dbgmcu::enable_all() } let executor = EXECUTOR.put(Executor::new()); diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs index 9d2fc2f2..eff9189e 100644 --- a/examples/stm32l4/src/bin/button.rs +++ b/examples/stm32l4/src/bin/button.rs @@ -24,10 +24,6 @@ fn main() -> ! { w.set_dbg_standby(true); w.set_dbg_stop(true); }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); } let p = embassy_stm32::init(Default::default()); diff --git a/examples/stm32l4/src/bin/button_exti.rs b/examples/stm32l4/src/bin/button_exti.rs index 83537d92..a7e08afd 100644 --- a/examples/stm32l4/src/bin/button_exti.rs +++ b/examples/stm32l4/src/bin/button_exti.rs @@ -55,10 +55,6 @@ fn main() -> ! { w.set_dbg_standby(true); w.set_dbg_stop(true); }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); } unsafe { embassy::time::set_clock(&ZeroClock) }; diff --git a/examples/stm32l4/src/bin/spi.rs b/examples/stm32l4/src/bin/spi.rs index 14605283..1830fcb5 100644 --- a/examples/stm32l4/src/bin/spi.rs +++ b/examples/stm32l4/src/bin/spi.rs @@ -10,6 +10,7 @@ mod example_common; use cortex_m_rt::entry; +use embassy_stm32::dma::NoDma; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::pac; use embassy_stm32::spi::{Config, Spi}; @@ -17,7 +18,6 @@ use embassy_stm32::time::Hertz; use embedded_hal::blocking::spi::Transfer; use embedded_hal::digital::v2::OutputPin; use example_common::*; -use embassy_stm32::dma::NoDma; #[entry] fn main() -> ! { @@ -29,10 +29,6 @@ fn main() -> ! { w.set_dbg_standby(true); w.set_dbg_stop(true); }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); } let p = embassy_stm32::init(Default::default()); diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs index ba03ff44..0b66f574 100644 --- a/examples/stm32l4/src/bin/spi_dma.rs +++ b/examples/stm32l4/src/bin/spi_dma.rs @@ -82,14 +82,6 @@ fn main() -> ! { w.set_dbg_stop(true); }); - //pac::RCC.apbenr().modify(|w| { - //w.set_spi3en(true); - // }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); - pac::RCC.ahb1enr().modify(|w| { w.set_dmamux1en(true); w.set_dma1en(true); diff --git a/examples/stm32l4/src/bin/usart.rs b/examples/stm32l4/src/bin/usart.rs index 1c2a861e..8b1180a5 100644 --- a/examples/stm32l4/src/bin/usart.rs +++ b/examples/stm32l4/src/bin/usart.rs @@ -63,10 +63,6 @@ fn main() -> ! { pac::RCC.apb1enr1().modify(|w| { w.set_uart4en(true); }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); } unsafe { embassy::time::set_clock(&ZeroClock) }; diff --git a/examples/stm32l4/src/bin/usart_dma.rs b/examples/stm32l4/src/bin/usart_dma.rs index b51699ac..6262b6c8 100644 --- a/examples/stm32l4/src/bin/usart_dma.rs +++ b/examples/stm32l4/src/bin/usart_dma.rs @@ -57,11 +57,7 @@ fn main() -> ! { w.set_dbg_standby(true); w.set_dbg_stop(true); }); - - pac::RCC.apb2enr().modify(|w| { - w.set_syscfgen(true); - }); - + pac::RCC.ahb1enr().modify(|w| { w.set_dmamux1en(true); w.set_dma1en(true);