Skip to content

Commit 85bc958

Browse files
committed
Simplify mod export
1 parent fc79931 commit 85bc958

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

src/lib.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,34 +112,26 @@ pub use crate::pac as stm32;
112112
#[cfg(feature = "rt")]
113113
pub use crate::pac::interrupt;
114114

115+
cfg_if::cfg_if! {
116+
if #[cfg(feature = "device-selected")] {
117+
pub mod delay;
118+
pub mod flash;
119+
pub mod gpio;
120+
pub mod i2c;
121+
pub mod prelude;
122+
pub mod pwm;
123+
pub mod rcc;
124+
pub mod rtc;
125+
pub mod serial;
126+
pub mod spi;
127+
pub mod time;
128+
pub mod timer;
129+
}
130+
}
115131
#[cfg(feature = "stm32f303")]
116132
pub mod adc;
117-
#[cfg(feature = "device-selected")]
118-
pub mod delay;
119133
#[cfg(any(feature = "stm32f302", feature = "stm32f303"))]
120134
pub mod dma;
121-
#[cfg(feature = "device-selected")]
122-
pub mod flash;
123-
#[cfg(feature = "device-selected")]
124-
pub mod gpio;
125-
#[cfg(feature = "device-selected")]
126-
pub mod i2c;
127-
#[cfg(feature = "device-selected")]
128-
pub mod prelude;
129-
#[cfg(feature = "device-selected")]
130-
pub mod pwm;
131-
#[cfg(feature = "device-selected")]
132-
pub mod rcc;
133-
#[cfg(feature = "device-selected")]
134-
pub mod rtc;
135-
#[cfg(feature = "device-selected")]
136-
pub mod serial;
137-
#[cfg(feature = "device-selected")]
138-
pub mod spi;
139-
#[cfg(feature = "device-selected")]
140-
pub mod time;
141-
#[cfg(feature = "device-selected")]
142-
pub mod timer;
143135
#[cfg(all(
144136
feature = "stm32-usbd",
145137
any(

0 commit comments

Comments
 (0)