aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer
diff options
context:
space:
mode:
authorEicke Hecht <[email protected]>2025-11-23 12:29:56 +0100
committerEicke Hecht <[email protected]>2025-11-23 12:29:56 +0100
commit36f4075b9054576ccf6dba2dedb08c62484a0599 (patch)
treebdc5e19df803ace7073a9d212327ae64fedb704e /embassy-stm32/src/timer
parentac1f0ec4ecc6450de7d1c6044e799bca8791f7e5 (diff)
fix: Fix waveform for channels > 1 and disallow for unsupported dmas
Diffstat (limited to 'embassy-stm32/src/timer')
-rw-r--r--embassy-stm32/src/timer/low_level.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/embassy-stm32/src/timer/low_level.rs b/embassy-stm32/src/timer/low_level.rs
index 670298d23..307d614bf 100644
--- a/embassy-stm32/src/timer/low_level.rs
+++ b/embassy-stm32/src/timer/low_level.rs
@@ -781,7 +781,7 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
781 let cc_channel = C::CHANNEL; 781 let cc_channel = C::CHANNEL;
782 782
783 let original_cc_dma_on_update = self.get_cc_dma_selection() == Ccds::ON_UPDATE; 783 let original_cc_dma_on_update = self.get_cc_dma_selection() == Ccds::ON_UPDATE;
784 let original_cc_dma_enabled = self.get_c fsc_dma_enable_state(cc_channel); 784 let original_cc_dma_enabled = self.get_cc_dma_enable_state(cc_channel);
785 785
786 // redirect CC DMA request onto Update Event 786 // redirect CC DMA request onto Update Event
787 if !original_cc_dma_on_update { 787 if !original_cc_dma_on_update {
@@ -810,7 +810,12 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
810 810
811 /// Generate a sequence of PWM waveform that will run continously 811 /// Generate a sequence of PWM waveform that will run continously
812 /// You may want to start this in a new thread as this will block forever 812 /// You may want to start this in a new thread as this will block forever
813
813 pub async fn waveform_continuous<C: TimerChannel>(&mut self, dma: Peri<'_, impl super::Dma<T, C>>, duty: &[u16]) { 814 pub async fn waveform_continuous<C: TimerChannel>(&mut self, dma: Peri<'_, impl super::Dma<T, C>>, duty: &[u16]) {
815
816 #[cfg(any(bdma, gpdma))]
817 panic!("unsupported DMA");
818
814 use crate::pac::timer::vals::Ccds; 819 use crate::pac::timer::vals::Ccds;
815 820
816 #[allow(clippy::let_unit_value)] // eg. stm32f334 821 #[allow(clippy::let_unit_value)] // eg. stm32f334
@@ -871,6 +876,7 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
871 fifo_threshold: Some(FifoThreshold::Full), 876 fifo_threshold: Some(FifoThreshold::Full),
872 #[cfg(not(any(bdma, gpdma)))] 877 #[cfg(not(any(bdma, gpdma)))]
873 mburst: Burst::Incr8, 878 mburst: Burst::Incr8,
879 #[cfg(not(any(bdma, gpdma)))]
874 circular: circular, 880 circular: circular,
875 ..Default::default() 881 ..Default::default()
876 }; 882 };
@@ -881,7 +887,7 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
881 dma, 887 dma,
882 req, 888 req,
883 duty, 889 duty,
884 self.regs_1ch().ccr(channel.index()).as_ptr() as *mut u16, 890 self.regs_gp16().ccr(channel.index()).as_ptr() as *mut u16,
885 dma_transfer_option, 891 dma_transfer_option,
886 ) 892 )
887 .await 893 .await
@@ -896,7 +902,7 @@ impl<'d, T: GeneralInstance4Channel> Timer<'d, T> {
896 dma, 902 dma,
897 req, 903 req,
898 duty, 904 duty,
899 self.regs_1ch().ccr(channel.index()).as_ptr() as *mut u32, 905 self.regs_gp16().ccr(channel.index()).as_ptr() as *mut u32,
900 dma_transfer_option, 906 dma_transfer_option,
901 ) 907 )
902 .await 908 .await