diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-07-24 11:18:46 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-24 11:18:46 +0200 |
| commit | 4899168534e70294dd9ec853cbf4efb417e0035a (patch) | |
| tree | 90166bba1d822e943a2719dd2f8f766acbbd6375 | |
| parent | ad7a1f1453264717fea90d5ce3ee66df8ff6130c (diff) | |
| parent | 06fb2a7a808d9c05d9724fc4239e2efde1d3511a (diff) | |
Merge pull request #312 from timokroeger/en-exti-clock
Enable SYSCFG clock in `exti::init()`
| -rw-r--r-- | embassy-stm32/src/exti/mod.rs | 3 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/button_exti.rs | 10 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/button.rs | 4 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/button_exti.rs | 4 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/spi.rs | 6 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/spi_dma.rs | 8 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/usart.rs | 4 | ||||
| -rw-r--r-- | 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 126a6fb64..217c8173b 100644 --- a/embassy-stm32/src/exti/mod.rs +++ b/embassy-stm32/src/exti/mod.rs | |||
| @@ -108,4 +108,7 @@ pub(crate) unsafe fn init() { | |||
| 108 | use embassy::interrupt::InterruptExt; | 108 | use embassy::interrupt::InterruptExt; |
| 109 | 109 | ||
| 110 | foreach_exti_irq!(enable_irq); | 110 | foreach_exti_irq!(enable_irq); |
| 111 | |||
| 112 | #[cfg(not(rcc_wb55))] | ||
| 113 | <crate::peripherals::SYSCFG as crate::rcc::sealed::RccPeripheral>::enable(); | ||
| 111 | } | 114 | } |
diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs index 6c51095eb..bc48c2b12 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}; | |||
| 17 | use example_common::*; | 17 | use example_common::*; |
| 18 | 18 | ||
| 19 | use cortex_m_rt::entry; | 19 | use cortex_m_rt::entry; |
| 20 | use embassy_stm32::pac; | ||
| 21 | 20 | ||
| 22 | #[embassy::task] | 21 | #[embassy::task] |
| 23 | async fn main_task() { | 22 | async fn main_task() { |
| @@ -42,14 +41,7 @@ static EXECUTOR: Forever<Executor> = Forever::new(); | |||
| 42 | fn main() -> ! { | 41 | fn main() -> ! { |
| 43 | info!("Hello World!"); | 42 | info!("Hello World!"); |
| 44 | 43 | ||
| 45 | unsafe { | 44 | unsafe { Dbgmcu::enable_all() } |
| 46 | Dbgmcu::enable_all(); | ||
| 47 | |||
| 48 | // EXTI clock | ||
| 49 | pac::RCC.apb2enr().modify(|w| { | ||
| 50 | w.set_syscfgen(true); | ||
| 51 | }); | ||
| 52 | } | ||
| 53 | 45 | ||
| 54 | let executor = EXECUTOR.put(Executor::new()); | 46 | let executor = EXECUTOR.put(Executor::new()); |
| 55 | 47 | ||
diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs index 9d2fc2f21..eff9189ec 100644 --- a/examples/stm32l4/src/bin/button.rs +++ b/examples/stm32l4/src/bin/button.rs | |||
| @@ -24,10 +24,6 @@ fn main() -> ! { | |||
| 24 | w.set_dbg_standby(true); | 24 | w.set_dbg_standby(true); |
| 25 | w.set_dbg_stop(true); | 25 | w.set_dbg_stop(true); |
| 26 | }); | 26 | }); |
| 27 | |||
| 28 | pac::RCC.apb2enr().modify(|w| { | ||
| 29 | w.set_syscfgen(true); | ||
| 30 | }); | ||
| 31 | } | 27 | } |
| 32 | 28 | ||
| 33 | let p = embassy_stm32::init(Default::default()); | 29 | 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 83537d92e..a7e08afd8 100644 --- a/examples/stm32l4/src/bin/button_exti.rs +++ b/examples/stm32l4/src/bin/button_exti.rs | |||
| @@ -55,10 +55,6 @@ fn main() -> ! { | |||
| 55 | w.set_dbg_standby(true); | 55 | w.set_dbg_standby(true); |
| 56 | w.set_dbg_stop(true); | 56 | w.set_dbg_stop(true); |
| 57 | }); | 57 | }); |
| 58 | |||
| 59 | pac::RCC.apb2enr().modify(|w| { | ||
| 60 | w.set_syscfgen(true); | ||
| 61 | }); | ||
| 62 | } | 58 | } |
| 63 | 59 | ||
| 64 | unsafe { embassy::time::set_clock(&ZeroClock) }; | 60 | unsafe { embassy::time::set_clock(&ZeroClock) }; |
diff --git a/examples/stm32l4/src/bin/spi.rs b/examples/stm32l4/src/bin/spi.rs index 14605283b..1830fcb51 100644 --- a/examples/stm32l4/src/bin/spi.rs +++ b/examples/stm32l4/src/bin/spi.rs | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | mod example_common; | 10 | mod example_common; |
| 11 | 11 | ||
| 12 | use cortex_m_rt::entry; | 12 | use cortex_m_rt::entry; |
| 13 | use embassy_stm32::dma::NoDma; | ||
| 13 | use embassy_stm32::gpio::{Level, Output, Speed}; | 14 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 14 | use embassy_stm32::pac; | 15 | use embassy_stm32::pac; |
| 15 | use embassy_stm32::spi::{Config, Spi}; | 16 | use embassy_stm32::spi::{Config, Spi}; |
| @@ -17,7 +18,6 @@ use embassy_stm32::time::Hertz; | |||
| 17 | use embedded_hal::blocking::spi::Transfer; | 18 | use embedded_hal::blocking::spi::Transfer; |
| 18 | use embedded_hal::digital::v2::OutputPin; | 19 | use embedded_hal::digital::v2::OutputPin; |
| 19 | use example_common::*; | 20 | use example_common::*; |
| 20 | use embassy_stm32::dma::NoDma; | ||
| 21 | 21 | ||
| 22 | #[entry] | 22 | #[entry] |
| 23 | fn main() -> ! { | 23 | fn main() -> ! { |
| @@ -29,10 +29,6 @@ fn main() -> ! { | |||
| 29 | w.set_dbg_standby(true); | 29 | w.set_dbg_standby(true); |
| 30 | w.set_dbg_stop(true); | 30 | w.set_dbg_stop(true); |
| 31 | }); | 31 | }); |
| 32 | |||
| 33 | pac::RCC.apb2enr().modify(|w| { | ||
| 34 | w.set_syscfgen(true); | ||
| 35 | }); | ||
| 36 | } | 32 | } |
| 37 | 33 | ||
| 38 | let p = embassy_stm32::init(Default::default()); | 34 | 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 ba03ff44e..0b66f574b 100644 --- a/examples/stm32l4/src/bin/spi_dma.rs +++ b/examples/stm32l4/src/bin/spi_dma.rs | |||
| @@ -82,14 +82,6 @@ fn main() -> ! { | |||
| 82 | w.set_dbg_stop(true); | 82 | w.set_dbg_stop(true); |
| 83 | }); | 83 | }); |
| 84 | 84 | ||
| 85 | //pac::RCC.apbenr().modify(|w| { | ||
| 86 | //w.set_spi3en(true); | ||
| 87 | // }); | ||
| 88 | |||
| 89 | pac::RCC.apb2enr().modify(|w| { | ||
| 90 | w.set_syscfgen(true); | ||
| 91 | }); | ||
| 92 | |||
| 93 | pac::RCC.ahb1enr().modify(|w| { | 85 | pac::RCC.ahb1enr().modify(|w| { |
| 94 | w.set_dmamux1en(true); | 86 | w.set_dmamux1en(true); |
| 95 | w.set_dma1en(true); | 87 | w.set_dma1en(true); |
diff --git a/examples/stm32l4/src/bin/usart.rs b/examples/stm32l4/src/bin/usart.rs index 1c2a861e2..8b1180a58 100644 --- a/examples/stm32l4/src/bin/usart.rs +++ b/examples/stm32l4/src/bin/usart.rs | |||
| @@ -63,10 +63,6 @@ fn main() -> ! { | |||
| 63 | pac::RCC.apb1enr1().modify(|w| { | 63 | pac::RCC.apb1enr1().modify(|w| { |
| 64 | w.set_uart4en(true); | 64 | w.set_uart4en(true); |
| 65 | }); | 65 | }); |
| 66 | |||
| 67 | pac::RCC.apb2enr().modify(|w| { | ||
| 68 | w.set_syscfgen(true); | ||
| 69 | }); | ||
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | unsafe { embassy::time::set_clock(&ZeroClock) }; | 68 | 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 b51699acf..6262b6c87 100644 --- a/examples/stm32l4/src/bin/usart_dma.rs +++ b/examples/stm32l4/src/bin/usart_dma.rs | |||
| @@ -57,11 +57,7 @@ fn main() -> ! { | |||
| 57 | w.set_dbg_standby(true); | 57 | w.set_dbg_standby(true); |
| 58 | w.set_dbg_stop(true); | 58 | w.set_dbg_stop(true); |
| 59 | }); | 59 | }); |
| 60 | 60 | ||
| 61 | pac::RCC.apb2enr().modify(|w| { | ||
| 62 | w.set_syscfgen(true); | ||
| 63 | }); | ||
| 64 | |||
| 65 | pac::RCC.ahb1enr().modify(|w| { | 61 | pac::RCC.ahb1enr().modify(|w| { |
| 66 | w.set_dmamux1en(true); | 62 | w.set_dmamux1en(true); |
| 67 | w.set_dma1en(true); | 63 | w.set_dma1en(true); |
