aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer
diff options
context:
space:
mode:
authorpbert <[email protected]>2023-10-11 18:06:43 +0200
committerpbert <[email protected]>2023-10-12 11:04:19 +0200
commitf65a96c54146179f76a7a2a784c5bb89590e5de1 (patch)
tree21b20805229d639f16f035a64f94cb896a636cd0 /embassy-stm32/src/timer
parenteb368f77a46682f76dcc4d75f9ba4ce80dfb4193 (diff)
STM32: combine RccPeripherals reset() and enable() to reset_and_enable()
Diffstat (limited to 'embassy-stm32/src/timer')
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs3
-rw-r--r--embassy-stm32/src/timer/qei.rs3
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs3
3 files changed, 3 insertions, 6 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs
index 0ab727344..3818cc03c 100644
--- a/embassy-stm32/src/timer/complementary_pwm.rs
+++ b/embassy-stm32/src/timer/complementary_pwm.rs
@@ -64,8 +64,7 @@ impl<'d, T: ComplementaryCaptureCompare16bitInstance> ComplementaryPwm<'d, T> {
64 fn new_inner(tim: impl Peripheral<P = T> + 'd, freq: Hertz) -> Self { 64 fn new_inner(tim: impl Peripheral<P = T> + 'd, freq: Hertz) -> Self {
65 into_ref!(tim); 65 into_ref!(tim);
66 66
67 T::enable(); 67 T::reset_and_enable();
68 <T as crate::rcc::sealed::RccPeripheral>::reset();
69 68
70 let mut this = Self { inner: tim }; 69 let mut this = Self { inner: tim };
71 70
diff --git a/embassy-stm32/src/timer/qei.rs b/embassy-stm32/src/timer/qei.rs
index 15f2c3a79..ecc9fabc7 100644
--- a/embassy-stm32/src/timer/qei.rs
+++ b/embassy-stm32/src/timer/qei.rs
@@ -55,8 +55,7 @@ impl<'d, T: CaptureCompare16bitInstance> Qei<'d, T> {
55 fn new_inner(tim: impl Peripheral<P = T> + 'd) -> Self { 55 fn new_inner(tim: impl Peripheral<P = T> + 'd) -> Self {
56 into_ref!(tim); 56 into_ref!(tim);
57 57
58 T::enable(); 58 T::reset_and_enable();
59 <T as crate::rcc::sealed::RccPeripheral>::reset();
60 59
61 // Configure TxC1 and TxC2 as captures 60 // Configure TxC1 and TxC2 as captures
62 T::regs_gp16().ccmr_input(0).modify(|w| { 61 T::regs_gp16().ccmr_input(0).modify(|w| {
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs
index 2b3a069a7..83c812775 100644
--- a/embassy-stm32/src/timer/simple_pwm.rs
+++ b/embassy-stm32/src/timer/simple_pwm.rs
@@ -63,8 +63,7 @@ impl<'d, T: CaptureCompare16bitInstance> SimplePwm<'d, T> {
63 fn new_inner(tim: impl Peripheral<P = T> + 'd, freq: Hertz) -> Self { 63 fn new_inner(tim: impl Peripheral<P = T> + 'd, freq: Hertz) -> Self {
64 into_ref!(tim); 64 into_ref!(tim);
65 65
66 T::enable(); 66 T::reset_and_enable();
67 <T as crate::rcc::sealed::RccPeripheral>::reset();
68 67
69 let mut this = Self { inner: tim }; 68 let mut this = Self { inner: tim };
70 69