diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 737b6247..38413acb 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -646,13 +646,13 @@ fn main() { make_table(&mut m, "foreach_dma_channel", &dma_channels_table); let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); - let out_file = out_dir.join("macros.rs").to_string_lossy().to_string(); + let out_file = out_dir.join("_macros.rs").to_string_lossy().to_string(); fs::write(out_file, m).unwrap(); // ======== // Write generated.rs - let out_file = out_dir.join("generated.rs").to_string_lossy().to_string(); + let out_file = out_dir.join("_generated.rs").to_string_lossy().to_string(); fs::write(out_file, g.to_string()).unwrap(); // ======== @@ -773,7 +773,7 @@ impl IteratorExt for T { fn make_table(out: &mut String, name: &str, data: &Vec>) { write!( out, - "#[macro_export] + " macro_rules! {} {{ ($($pat:tt => $code:tt;)*) => {{ macro_rules! __{}_inner {{ diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index 4fafe7df..105bea50 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -6,8 +6,8 @@ use core::task::Waker; use embassy::interrupt::{Interrupt, InterruptExt}; use embassy::waitqueue::AtomicWaker; +use crate::_generated::BDMA_CHANNEL_COUNT; use crate::dma::Request; -use crate::generated::BDMA_CHANNEL_COUNT; use crate::pac; use crate::pac::bdma::vals; @@ -65,7 +65,7 @@ pub(crate) unsafe fn init() { crate::interrupt::$irq::steal().enable(); }; } - crate::generated::init_bdma(); + crate::_generated::init_bdma(); } foreach_dma_channel! { diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index fd1732fb..95a6eea2 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -4,7 +4,7 @@ use core::task::Waker; use embassy::interrupt::{Interrupt, InterruptExt}; use embassy::waitqueue::AtomicWaker; -use crate::generated::DMA_CHANNEL_COUNT; +use crate::_generated::DMA_CHANNEL_COUNT; use crate::interrupt; use crate::pac; use crate::pac::dma::{regs, vals}; @@ -59,7 +59,7 @@ pub(crate) unsafe fn init() { interrupt::$irq::steal().enable(); }; } - crate::generated::init_dma(); + crate::_generated::init_dma(); } foreach_dma_channel! { diff --git a/embassy-stm32/src/dma/dmamux.rs b/embassy-stm32/src/dma/dmamux.rs index 628f496b..c45bebe2 100644 --- a/embassy-stm32/src/dma/dmamux.rs +++ b/embassy-stm32/src/dma/dmamux.rs @@ -49,5 +49,5 @@ foreach_dma_channel! { /// safety: must be called only once pub(crate) unsafe fn init() { - crate::generated::init_dmamux(); + crate::_generated::init_dmamux(); } diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index 4837c412..3e108736 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -574,7 +574,7 @@ foreach_pin!( ); pub(crate) unsafe fn init() { - crate::generated::init_gpio(); + crate::_generated::init_gpio(); } mod eh02 { diff --git a/embassy-stm32/src/interrupt.rs b/embassy-stm32/src/interrupt.rs index c757b790..714dcc4c 100644 --- a/embassy-stm32/src/interrupt.rs +++ b/embassy-stm32/src/interrupt.rs @@ -3,4 +3,4 @@ pub use critical_section::CriticalSection; pub use embassy::interrupt::{take, Interrupt}; pub use embassy_hal_common::interrupt::Priority4 as Priority; -pub use crate::generated::interrupt::*; +pub use crate::_generated::interrupt::*; diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 5e8d6dd8..45b8e180 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -11,7 +11,7 @@ pub(crate) use stm32_metapac as pac; // This must go FIRST so that all the other modules see its macros. pub mod fmt; -include!(concat!(env!("OUT_DIR"), "/macros.rs")); +include!(concat!(env!("OUT_DIR"), "/_macros.rs")); // Utilities pub mod interrupt; @@ -63,16 +63,15 @@ pub mod usb_otg; pub mod subghz; // This must go last, so that it sees all the impl_foo! macros defined earlier. -pub(crate) mod generated { - +pub(crate) mod _generated { #![allow(dead_code)] #![allow(unused_imports)] #![allow(non_snake_case)] - include!(concat!(env!("OUT_DIR"), "/generated.rs")); + include!(concat!(env!("OUT_DIR"), "/_generated.rs")); } +pub use _generated::{peripherals, Peripherals}; pub use embassy_macros::interrupt; -pub use generated::{peripherals, Peripherals}; #[non_exhaustive] pub struct Config {