aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-06-25 15:33:57 -0500
committerxoviat <[email protected]>2023-06-30 18:21:42 -0500
commitcdb3fb059f32a5669856390cfe379da71092d545 (patch)
tree54722ba00c8ad1000d2bdcb53398f5a53a2d3348 /embassy-stm32/src/timer
parent45561f1622c9d883c8a9fa990c22a8a373d6ce5e (diff)
stm32/hrtim: first draft
Diffstat (limited to 'embassy-stm32/src/timer')
-rw-r--r--embassy-stm32/src/timer/mod.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs
index 09b7a3776..34ad5db11 100644
--- a/embassy-stm32/src/timer/mod.rs
+++ b/embassy-stm32/src/timer/mod.rs
@@ -43,6 +43,21 @@ pub(crate) mod sealed {
43 pub trait AdvancedControlInstance: GeneralPurpose16bitInstance { 43 pub trait AdvancedControlInstance: GeneralPurpose16bitInstance {
44 fn regs_advanced() -> crate::pac::timer::TimAdv; 44 fn regs_advanced() -> crate::pac::timer::TimAdv;
45 } 45 }
46
47 #[cfg(hrtim_v1)]
48 pub trait HighResolutionControlInstance: RccPeripheral {
49 type Interrupt: interrupt::typelevel::Interrupt;
50
51 fn regs_highres() -> crate::pac::hrtim::Hrtim;
52
53 fn start(&mut self);
54
55 fn stop(&mut self);
56
57 fn reset(&mut self);
58
59 fn set_frequency(&mut self, frequency: Hertz);
60 }
46} 61}
47 62
48pub trait GeneralPurpose16bitInstance: sealed::GeneralPurpose16bitInstance + 'static {} 63pub trait GeneralPurpose16bitInstance: sealed::GeneralPurpose16bitInstance + 'static {}
@@ -51,6 +66,9 @@ pub trait GeneralPurpose32bitInstance: sealed::GeneralPurpose32bitInstance + 'st
51 66
52pub trait AdvancedControlInstance: sealed::AdvancedControlInstance + 'static {} 67pub trait AdvancedControlInstance: sealed::AdvancedControlInstance + 'static {}
53 68
69#[cfg(hrtim_v1)]
70pub trait HighResolutionControlInstance: sealed::HighResolutionControlInstance + 'static {}
71
54pub trait Basic16bitInstance: sealed::Basic16bitInstance + 'static {} 72pub trait Basic16bitInstance: sealed::Basic16bitInstance + 'static {}
55 73
56#[allow(unused)] 74#[allow(unused)]
@@ -208,4 +226,25 @@ foreach_interrupt! {
208 impl AdvancedControlInstance for crate::peripherals::$inst { 226 impl AdvancedControlInstance for crate::peripherals::$inst {
209 } 227 }
210 }; 228 };
229
230 ($inst:ident, hrtim, HRTIM, MASTER, $irq:ident) => {
231 impl sealed::HighResolutionControlInstance for crate::peripherals::$inst {
232 type Interrupt = crate::interrupt::typelevel::$irq;
233
234 fn regs_highres() -> crate::pac::hrtim::Hrtim {
235 crate::pac::$inst
236 }
237
238 fn start(&mut self) { todo!() }
239
240 fn stop(&mut self) { todo!() }
241
242 fn reset(&mut self) { todo!() }
243
244 fn set_frequency(&mut self, frequency: Hertz) { todo!() }
245 }
246
247 impl HighResolutionControlInstance for crate::peripherals::$inst {
248 }
249 };
211} 250}