From 45964c658c2abd4bf063f386fed815b91dc49a1f Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Mon, 12 Jul 2021 11:41:46 -0400 Subject: [PATCH] Generalize RCC enabling for BDMA peris. --- embassy-stm32/src/bdma/v1.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/embassy-stm32/src/bdma/v1.rs b/embassy-stm32/src/bdma/v1.rs index 597cb0137..e5b0b18b1 100644 --- a/embassy-stm32/src/bdma/v1.rs +++ b/embassy-stm32/src/bdma/v1.rs @@ -164,6 +164,8 @@ unsafe fn on_irq() { } } +use crate::rcc::sealed::RccPeripheral; + /// safety: must be called only once pub(crate) unsafe fn init() { pac::interrupts! { @@ -172,11 +174,8 @@ pub(crate) unsafe fn init() { }; } pac::peripherals! { - (bdma, DMA1) => { - //critical_section::with(|_| { - //pac::RCC.ahbenr().modify(|w| w.set_dmaen(true)); - //}); - crate::peripherals::DMA1::enable(); + (bdma, $peri:ident) => { + crate::peripherals::$peri::enable(); }; } }