aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-11-25 08:23:53 -0600
committerxoviat <[email protected]>2025-11-25 08:23:53 -0600
commit424d9d3aa961d4170be96ac23331aa5a3cba3e5b (patch)
treee65195ae5d8bb02d32b2009316da22faef3f643f /embassy-stm32/src/timer
parent9e82cdc023cf001bd628ad68a712a41f8045455d (diff)
stm32: remove waveform method
Diffstat (limited to 'embassy-stm32/src/timer')
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs6
-rw-r--r--embassy-stm32/src/timer/low_level.rs37
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs6
3 files changed, 0 insertions, 49 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs
index 6d4c70dff..9f34f3ec7 100644
--- a/embassy-stm32/src/timer/complementary_pwm.rs
+++ b/embassy-stm32/src/timer/complementary_pwm.rs
@@ -266,12 +266,6 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
266 .waveform_up_multi_channel(dma, starting_channel, ending_channel, duty) 266 .waveform_up_multi_channel(dma, starting_channel, ending_channel, duty)
267 .await; 267 .await;
268 } 268 }
269
270 /// Generate a sequence of PWM waveform
271 #[inline(always)]
272 pub async fn waveform<C: TimerChannel>(&mut self, dma: Peri<'_, impl super::Dma<T, C>>, duty: &[u16]) {
273 self.inner.waveform(dma, duty).await;
274 }
275} 269}
276 270
277impl<'d, T: AdvancedInstance4Channel> embedded_hal_02::Pwm for ComplementaryPwm<'d, T> { 271impl<'d, T: AdvancedInstance4Channel> embedded_hal_02::Pwm for ComplementaryPwm<'d, T> {
diff --git a/embassy-stm32/src/timer/low_level.rs b/embassy-stm32/src/timer/low_level.rs
index f0105ece8..8fbedafdf 100644
--- a/embassy-stm32/src/timer/low_level.rs
+++ b/embassy-stm32/src/timer/low_level.rs
@@ -771,43 +771,6 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
771 } 771 }
772 } 772 }
773 773
774 /// Generate a sequence of PWM waveform
775 pub async fn waveform<C: TimerChannel>(&mut self, dma: Peri<'_, impl super::Dma<T, C>>, duty: &[u16]) {
776 use crate::pac::timer::vals::Ccds;
777
778 #[allow(clippy::let_unit_value)] // eg. stm32f334
779 let req = dma.request();
780
781 let cc_channel = C::CHANNEL;
782
783 let original_cc_dma_on_update = self.get_cc_dma_selection() == Ccds::ON_UPDATE;
784 let original_cc_dma_enabled = self.get_cc_dma_enable_state(cc_channel);
785
786 // redirect CC DMA request onto Update Event
787 if !original_cc_dma_on_update {
788 self.set_cc_dma_selection(Ccds::ON_UPDATE)
789 }
790
791 if !original_cc_dma_enabled {
792 self.set_cc_dma_enable_state(cc_channel, true);
793 }
794
795 self.waveform_helper(dma, req, cc_channel, duty).await;
796
797 // Since DMA is closed before timer Capture Compare Event trigger DMA is turn off,
798 // this can almost always trigger a DMA FIFO error.
799 //
800 // optional TODO:
801 // clean FEIF after disable UDE
802 if !original_cc_dma_enabled {
803 self.set_cc_dma_enable_state(cc_channel, false);
804 }
805
806 if !original_cc_dma_on_update {
807 self.set_cc_dma_selection(Ccds::ON_COMPARE)
808 }
809 }
810
811 async fn waveform_helper( 774 async fn waveform_helper(
812 &mut self, 775 &mut self,
813 dma: Peri<'_, impl dma::Channel>, 776 dma: Peri<'_, impl dma::Channel>,
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs
index 6c9ef17e0..15399b108 100644
--- a/embassy-stm32/src/timer/simple_pwm.rs
+++ b/embassy-stm32/src/timer/simple_pwm.rs
@@ -362,12 +362,6 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> {
362 .waveform_up_multi_channel(dma, starting_channel, ending_channel, duty) 362 .waveform_up_multi_channel(dma, starting_channel, ending_channel, duty)
363 .await; 363 .await;
364 } 364 }
365
366 /// Generate a sequence of PWM waveform
367 #[inline(always)]
368 pub async fn waveform<C: TimerChannel>(&mut self, dma: Peri<'_, impl super::Dma<T, C>>, duty: &[u16]) {
369 self.inner.waveform(dma, duty).await;
370 }
371} 365}
372 366
373impl<'d, T: GeneralInstance4Channel> embedded_hal_1::pwm::ErrorType for SimplePwmChannel<'d, T> { 367impl<'d, T: GeneralInstance4Channel> embedded_hal_1::pwm::ErrorType for SimplePwmChannel<'d, T> {