stm32/hrtim: extract into mod

This commit is contained in:
xoviat 2023-07-28 17:07:08 -05:00
parent d42dff45de
commit 28136579e9
5 changed files with 28 additions and 37 deletions

View File

@ -587,16 +587,16 @@ fn main() {
(("timer", "BKIN2"), quote!(crate::pwm::BreakInput2Pin)), (("timer", "BKIN2"), quote!(crate::pwm::BreakInput2Pin)),
(("timer", "BKIN2_COMP1"), quote!(crate::pwm::BreakInput2Comparator1Pin)), (("timer", "BKIN2_COMP1"), quote!(crate::pwm::BreakInput2Comparator1Pin)),
(("timer", "BKIN2_COMP2"), quote!(crate::pwm::BreakInput2Comparator2Pin)), (("timer", "BKIN2_COMP2"), quote!(crate::pwm::BreakInput2Comparator2Pin)),
(("hrtim", "CHA1"), quote!(crate::pwm::ChannelAPin)), (("hrtim", "CHA1"), quote!(crate::hrtim::ChannelAPin)),
(("hrtim", "CHA2"), quote!(crate::pwm::ChannelAComplementaryPin)), (("hrtim", "CHA2"), quote!(crate::hrtim::ChannelAComplementaryPin)),
(("hrtim", "CHB1"), quote!(crate::pwm::ChannelBPin)), (("hrtim", "CHB1"), quote!(crate::hrtim::ChannelBPin)),
(("hrtim", "CHB2"), quote!(crate::pwm::ChannelBComplementaryPin)), (("hrtim", "CHB2"), quote!(crate::hrtim::ChannelBComplementaryPin)),
(("hrtim", "CHC1"), quote!(crate::pwm::ChannelCPin)), (("hrtim", "CHC1"), quote!(crate::hrtim::ChannelCPin)),
(("hrtim", "CHC2"), quote!(crate::pwm::ChannelCComplementaryPin)), (("hrtim", "CHC2"), quote!(crate::hrtim::ChannelCComplementaryPin)),
(("hrtim", "CHD1"), quote!(crate::pwm::ChannelDPin)), (("hrtim", "CHD1"), quote!(crate::hrtim::ChannelDPin)),
(("hrtim", "CHD2"), quote!(crate::pwm::ChannelDComplementaryPin)), (("hrtim", "CHD2"), quote!(crate::hrtim::ChannelDComplementaryPin)),
(("hrtim", "CHE1"), quote!(crate::pwm::ChannelEPin)), (("hrtim", "CHE1"), quote!(crate::hrtim::ChannelEPin)),
(("hrtim", "CHE2"), quote!(crate::pwm::ChannelEComplementaryPin)), (("hrtim", "CHE2"), quote!(crate::hrtim::ChannelEComplementaryPin)),
(("sdmmc", "CK"), quote!(crate::sdmmc::CkPin)), (("sdmmc", "CK"), quote!(crate::sdmmc::CkPin)),
(("sdmmc", "CMD"), quote!(crate::sdmmc::CmdPin)), (("sdmmc", "CMD"), quote!(crate::sdmmc::CmdPin)),
(("sdmmc", "D0"), quote!(crate::sdmmc::D0Pin)), (("sdmmc", "D0"), quote!(crate::sdmmc::D0Pin)),

View File

@ -2,10 +2,10 @@ use core::marker::PhantomData;
use embassy_hal_common::{into_ref, PeripheralRef}; use embassy_hal_common::{into_ref, PeripheralRef};
use super::*;
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::gpio::sealed::{AFType, Pin}; use crate::gpio::sealed::{AFType, Pin};
use crate::gpio::AnyPin; use crate::gpio::AnyPin;
use crate::pwm::HighResolutionCaptureCompare16bitInstance;
use crate::time::Hertz; use crate::time::Hertz;
use crate::Peripheral; use crate::Peripheral;
@ -394,3 +394,14 @@ impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> Resona
self.max_period 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);

View File

@ -23,6 +23,8 @@ pub mod timer;
pub mod adc; pub mod adc;
#[cfg(can)] #[cfg(can)]
pub mod can; pub mod can;
#[cfg(crc)]
pub mod crc;
#[cfg(dac)] #[cfg(dac)]
pub mod dac; pub mod dac;
#[cfg(dcmi)] #[cfg(dcmi)]
@ -31,14 +33,13 @@ pub mod dcmi;
pub mod eth; pub mod eth;
#[cfg(feature = "exti")] #[cfg(feature = "exti")]
pub mod exti; pub mod exti;
pub mod flash;
#[cfg(fmc)] #[cfg(fmc)]
pub mod fmc; pub mod fmc;
#[cfg(hrtim_v1)]
pub mod hrtim;
#[cfg(i2c)] #[cfg(i2c)]
pub mod i2c; pub mod i2c;
#[cfg(crc)]
pub mod crc;
pub mod flash;
#[cfg(all(spi_v1, rcc_f4))] #[cfg(all(spi_v1, rcc_f4))]
pub mod i2s; pub mod i2s;
#[cfg(stm32wb)] #[cfg(stm32wb)]

View File

@ -1,5 +1,3 @@
#[cfg(hrtim_v1)]
pub mod advanced_pwm;
pub mod complementary_pwm; pub mod complementary_pwm;
pub mod simple_pwm; pub mod simple_pwm;
@ -468,22 +466,3 @@ pin_trait!(BreakInputComparator2Pin, CaptureCompare16bitInstance);
pin_trait!(BreakInput2Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Pin, CaptureCompare16bitInstance);
pin_trait!(BreakInput2Comparator1Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Comparator1Pin, CaptureCompare16bitInstance);
pin_trait!(BreakInput2Comparator2Pin, 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::*;

View File

@ -4,7 +4,7 @@
use defmt::*; use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::pwm::advanced_pwm::*; use embassy_stm32::hrtim::*;
use embassy_stm32::time::{khz, mhz}; use embassy_stm32::time::{khz, mhz};
use embassy_stm32::Config; use embassy_stm32::Config;
use embassy_time::{Duration, Timer}; use embassy_time::{Duration, Timer};