aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer/low_level.rs
diff options
context:
space:
mode:
authorJan Špaček <[email protected]>2024-05-24 22:04:04 +0200
committerJan Špaček <[email protected]>2024-05-25 18:44:55 +0200
commit081afca3f065dfd91e157d7c9a9477e2d914c99d (patch)
tree574b29636674d3e5a9e3763d00f709635856403e /embassy-stm32/src/timer/low_level.rs
parent01c1cb2764300625f80b24e70052f250de27d814 (diff)
stm32/rcc: replace generated enable/disable code with runtime info
Diffstat (limited to 'embassy-stm32/src/timer/low_level.rs')
-rw-r--r--embassy-stm32/src/timer/low_level.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-stm32/src/timer/low_level.rs b/embassy-stm32/src/timer/low_level.rs
index 7f533b75c..9932c04cd 100644
--- a/embassy-stm32/src/timer/low_level.rs
+++ b/embassy-stm32/src/timer/low_level.rs
@@ -10,6 +10,7 @@ use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef};
10 10
11use super::*; 11use super::*;
12use crate::pac::timer::vals; 12use crate::pac::timer::vals;
13use crate::rcc;
13use crate::time::Hertz; 14use crate::time::Hertz;
14 15
15/// Input capture mode. 16/// Input capture mode.
@@ -181,7 +182,7 @@ pub struct Timer<'d, T: CoreInstance> {
181 182
182impl<'d, T: CoreInstance> Drop for Timer<'d, T> { 183impl<'d, T: CoreInstance> Drop for Timer<'d, T> {
183 fn drop(&mut self) { 184 fn drop(&mut self) {
184 T::disable() 185 rcc::disable::<T>();
185 } 186 }
186} 187}
187 188
@@ -190,7 +191,7 @@ impl<'d, T: CoreInstance> Timer<'d, T> {
190 pub fn new(tim: impl Peripheral<P = T> + 'd) -> Self { 191 pub fn new(tim: impl Peripheral<P = T> + 'd) -> Self {
191 into_ref!(tim); 192 into_ref!(tim);
192 193
193 T::enable_and_reset(); 194 rcc::enable_and_reset::<T>();
194 195
195 Self { tim } 196 Self { tim }
196 } 197 }