diff options
| author | Jakob <[email protected]> | 2025-11-04 19:55:09 +0100 |
|---|---|---|
| committer | Jakob <[email protected]> | 2025-11-04 19:55:09 +0100 |
| commit | 8184bb809b65281cfcf0035e40c7c215d6b9aeda (patch) | |
| tree | 46fbc20ff00150a6eb40ac0c87a214e5fac63b6a /embassy-stm32/src/timer | |
| parent | dda429ce6642deaa490f8737e1373e2e2ba79655 (diff) | |
Implement into_ring_buffered for g4. Add methods for configuring injected sampling for g4.
Diffstat (limited to 'embassy-stm32/src/timer')
| -rw-r--r-- | embassy-stm32/src/timer/complementary_pwm.rs | 12 | ||||
| -rw-r--r-- | embassy-stm32/src/timer/low_level.rs | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs index 75a83629c..9a56a41fb 100644 --- a/embassy-stm32/src/timer/complementary_pwm.rs +++ b/embassy-stm32/src/timer/complementary_pwm.rs | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | use core::marker::PhantomData; | 3 | use core::marker::PhantomData; |
| 4 | 4 | ||
| 5 | pub use stm32_metapac::timer::vals::{Ckd, Ossi, Ossr}; | 5 | pub use stm32_metapac::timer::vals::{Ckd, Mms2, Ossi, Ossr}; |
| 6 | 6 | ||
| 7 | use super::low_level::{CountingMode, OutputPolarity, Timer}; | 7 | use super::low_level::{CountingMode, OutputPolarity, Timer}; |
| 8 | use super::simple_pwm::PwmPin; | 8 | use super::simple_pwm::PwmPin; |
| @@ -136,6 +136,16 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> { | |||
| 136 | self.inner.get_moe() | 136 | self.inner.get_moe() |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | /// Set Master Slave Mode 2 | ||
| 140 | pub fn set_mms2(&mut self, mms2: Mms2) { | ||
| 141 | self.inner.set_mms2_selection(mms2); | ||
| 142 | } | ||
| 143 | |||
| 144 | /// Set Repetition Counter | ||
| 145 | pub fn set_repetition_counter(&mut self, val: u16) { | ||
| 146 | self.inner.set_repetition_counter(val); | ||
| 147 | } | ||
| 148 | |||
| 139 | /// Enable the given channel. | 149 | /// Enable the given channel. |
| 140 | pub fn enable(&mut self, channel: Channel) { | 150 | pub fn enable(&mut self, channel: Channel) { |
| 141 | self.inner.enable_channel(channel, true); | 151 | self.inner.enable_channel(channel, true); |
diff --git a/embassy-stm32/src/timer/low_level.rs b/embassy-stm32/src/timer/low_level.rs index 82645887e..0122fe4f7 100644 --- a/embassy-stm32/src/timer/low_level.rs +++ b/embassy-stm32/src/timer/low_level.rs | |||
| @@ -814,6 +814,16 @@ impl<'d, T: AdvancedInstance4Channel> Timer<'d, T> { | |||
| 814 | self.regs_advanced().cr2().modify(|w| w.set_oisn(channel.index(), val)); | 814 | self.regs_advanced().cr2().modify(|w| w.set_oisn(channel.index(), val)); |
| 815 | } | 815 | } |
| 816 | 816 | ||
| 817 | /// Set master mode selection 2 | ||
| 818 | pub fn set_mms2_selection(&self, mms2: vals::Mms2) { | ||
| 819 | self.regs_advanced().cr2().modify(|w| w.set_mms2(mms2)); | ||
| 820 | } | ||
| 821 | |||
| 822 | /// Set repetition counter | ||
| 823 | pub fn set_repetition_counter(&self, val: u16) { | ||
| 824 | self.regs_advanced().rcr().modify(|w| w.set_rep(val)); | ||
| 825 | } | ||
| 826 | |||
| 817 | /// Trigger software break 1 or 2 | 827 | /// Trigger software break 1 or 2 |
| 818 | /// Setting this bit generates a break event. This bit is automatically cleared by the hardware. | 828 | /// Setting this bit generates a break event. This bit is automatically cleared by the hardware. |
| 819 | pub fn trigger_software_break(&self, n: usize) { | 829 | pub fn trigger_software_break(&self, n: usize) { |
