diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index d2b1cfd0..c2b84797 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -587,16 +587,16 @@ fn main() { (("timer", "BKIN2"), quote!(crate::pwm::BreakInput2Pin)), (("timer", "BKIN2_COMP1"), quote!(crate::pwm::BreakInput2Comparator1Pin)), (("timer", "BKIN2_COMP2"), quote!(crate::pwm::BreakInput2Comparator2Pin)), - (("hrtim", "CHA1"), quote!(crate::pwm::ChannelAPin)), - (("hrtim", "CHA2"), quote!(crate::pwm::ChannelAComplementaryPin)), - (("hrtim", "CHB1"), quote!(crate::pwm::ChannelBPin)), - (("hrtim", "CHB2"), quote!(crate::pwm::ChannelBComplementaryPin)), - (("hrtim", "CHC1"), quote!(crate::pwm::ChannelCPin)), - (("hrtim", "CHC2"), quote!(crate::pwm::ChannelCComplementaryPin)), - (("hrtim", "CHD1"), quote!(crate::pwm::ChannelDPin)), - (("hrtim", "CHD2"), quote!(crate::pwm::ChannelDComplementaryPin)), - (("hrtim", "CHE1"), quote!(crate::pwm::ChannelEPin)), - (("hrtim", "CHE2"), quote!(crate::pwm::ChannelEComplementaryPin)), + (("hrtim", "CHA1"), quote!(crate::hrtim::ChannelAPin)), + (("hrtim", "CHA2"), quote!(crate::hrtim::ChannelAComplementaryPin)), + (("hrtim", "CHB1"), quote!(crate::hrtim::ChannelBPin)), + (("hrtim", "CHB2"), quote!(crate::hrtim::ChannelBComplementaryPin)), + (("hrtim", "CHC1"), quote!(crate::hrtim::ChannelCPin)), + (("hrtim", "CHC2"), quote!(crate::hrtim::ChannelCComplementaryPin)), + (("hrtim", "CHD1"), quote!(crate::hrtim::ChannelDPin)), + (("hrtim", "CHD2"), quote!(crate::hrtim::ChannelDComplementaryPin)), + (("hrtim", "CHE1"), quote!(crate::hrtim::ChannelEPin)), + (("hrtim", "CHE2"), quote!(crate::hrtim::ChannelEComplementaryPin)), (("sdmmc", "CK"), quote!(crate::sdmmc::CkPin)), (("sdmmc", "CMD"), quote!(crate::sdmmc::CmdPin)), (("sdmmc", "D0"), quote!(crate::sdmmc::D0Pin)), diff --git a/embassy-stm32/src/pwm/advanced_pwm.rs b/embassy-stm32/src/hrtim/mod.rs similarity index 94% rename from embassy-stm32/src/pwm/advanced_pwm.rs rename to embassy-stm32/src/hrtim/mod.rs index 9e40c5bf..7e3a8f14 100644 --- a/embassy-stm32/src/pwm/advanced_pwm.rs +++ b/embassy-stm32/src/hrtim/mod.rs @@ -2,10 +2,10 @@ use core::marker::PhantomData; use embassy_hal_common::{into_ref, PeripheralRef}; -use super::*; #[allow(unused_imports)] use crate::gpio::sealed::{AFType, Pin}; use crate::gpio::AnyPin; +use crate::pwm::HighResolutionCaptureCompare16bitInstance; use crate::time::Hertz; use crate::Peripheral; @@ -394,3 +394,14 @@ impl> Resona self.max_period } } + +pin_trait!(ChannelAPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelAComplementaryPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelBPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelBComplementaryPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelCPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelCComplementaryPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelDPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelDComplementaryPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelEPin, HighResolutionCaptureCompare16bitInstance); +pin_trait!(ChannelEComplementaryPin, HighResolutionCaptureCompare16bitInstance); diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 45a7b547..8c005bfe 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -23,6 +23,8 @@ pub mod timer; pub mod adc; #[cfg(can)] pub mod can; +#[cfg(crc)] +pub mod crc; #[cfg(dac)] pub mod dac; #[cfg(dcmi)] @@ -31,14 +33,13 @@ pub mod dcmi; pub mod eth; #[cfg(feature = "exti")] pub mod exti; +pub mod flash; #[cfg(fmc)] pub mod fmc; +#[cfg(hrtim_v1)] +pub mod hrtim; #[cfg(i2c)] pub mod i2c; - -#[cfg(crc)] -pub mod crc; -pub mod flash; #[cfg(all(spi_v1, rcc_f4))] pub mod i2s; #[cfg(stm32wb)] diff --git a/embassy-stm32/src/pwm/mod.rs b/embassy-stm32/src/pwm/mod.rs index 429a290e..c4b38ebd 100644 --- a/embassy-stm32/src/pwm/mod.rs +++ b/embassy-stm32/src/pwm/mod.rs @@ -1,5 +1,3 @@ -#[cfg(hrtim_v1)] -pub mod advanced_pwm; pub mod complementary_pwm; pub mod simple_pwm; @@ -468,22 +466,3 @@ pin_trait!(BreakInputComparator2Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Comparator1Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Comparator2Pin, CaptureCompare16bitInstance); - -#[cfg(hrtim_v1)] -mod hrtim_pins { - use super::*; - - pin_trait!(ChannelAPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelAComplementaryPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelBPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelBComplementaryPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelCPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelCComplementaryPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelDPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelDComplementaryPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelEPin, HighResolutionCaptureCompare16bitInstance); - pin_trait!(ChannelEComplementaryPin, HighResolutionCaptureCompare16bitInstance); -} - -#[cfg(hrtim_v1)] -pub use hrtim_pins::*; diff --git a/examples/stm32f334/src/bin/pwm.rs b/examples/stm32f334/src/bin/pwm.rs index 36411974..2660b10c 100644 --- a/examples/stm32f334/src/bin/pwm.rs +++ b/examples/stm32f334/src/bin/pwm.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::pwm::advanced_pwm::*; +use embassy_stm32::hrtim::*; use embassy_stm32::time::{khz, mhz}; use embassy_stm32::Config; use embassy_time::{Duration, Timer};