From 12c510f22258af1a26ee47ee1ae07c6ebdb7ac65 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Wed, 5 May 2021 13:12:53 -0400 Subject: [PATCH] Rework `pac` re-exporting, canonicalize syscfg path, use it plus SYSCFG_BASE. --- embassy-stm32/src/exti.rs | 3 +-- embassy-stm32/src/lib.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index 9b2370f3..8fd9d91a 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -15,8 +15,7 @@ use crate::interrupt; use crate::pac; use crate::peripherals; -// TODO hardcoding peripheral addrs until we figure out how these are handled in the metapac -const SYSCFG: pac::syscfg_f4::Syscfg = pac::syscfg_f4::Syscfg(0x40013800 as *mut _); +const SYSCFG: pac::syscfg::Syscfg = pac::syscfg::Syscfg(crate::chip::SYSCFG_BASE as *mut _); const EXTI: pac::exti::Exti = pac::exti::Exti(crate::chip::EXTI_BASE as *mut _); const EXTI_COUNT: usize = 16; diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 4ea5f952..de697eac 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -10,7 +10,18 @@ pub mod fmt; use embassy::interrupt::{Interrupt, InterruptExt}; -pub(crate) use stm32_metapac as pac; +//pub(crate) use stm32_metapac as pac; + +pub mod pac { + pub use stm32_metapac::*; + + #[cfg(any(feature = "_syscfg_f4"))] + pub use stm32_metapac::syscfg_f4 as syscfg; + + #[cfg(any(feature = "_syscfg_l4"))] + pub use stm32_metapac::syscfg_l4 as syscfg; +} + #[macro_use] pub mod exti;