Skip to content

Commit b97dada

Browse files
committed
HRTIM: Add forgotten traitification impls
1 parent 6e1d446 commit b97dada

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/hrtim/external_event.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ macro_rules! impl_eev1_5_to_es {
298298
ExternalEventSource { _x: PhantomData }
299299
}
300300
}
301+
302+
/// EEV$1 event
303+
impl<const IS_FAST: bool, DST, PSCL> super::event::EventSource<DST, PSCL>
304+
for ExternalEventSource<$N, IS_FAST>
305+
{
306+
const BITS: u32 = 1 << ($N + 20); // EEV1 is at bit 21
307+
}
301308
};
302309
}
303310

@@ -333,6 +340,11 @@ macro_rules! impl_eev6_10_to_es {
333340
ExternalEventSource { _x: PhantomData }
334341
}
335342
}
343+
344+
/// EEV$1 event
345+
impl<DST, PSCL> super::event::EventSource<DST, PSCL> for ExternalEventSource<$N, false> {
346+
const BITS: u32 = 1 << ($N + 20); // EEV1 is at bit 21
347+
}
336348
};
337349
}
338350

src/hrtim/output.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::stm32::{
2-
HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME, HRTIM_TIMF,
3-
};
1+
use crate::stm32::{HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME, HRTIM_TIMF};
42
use core::marker::PhantomData;
53

64
use super::event::EventSource;

src/hrtim/timer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ macro_rules! hrtim_timer {
154154
/// * `HrTimerMode::Continuous`: Enabling the timer enables and starts it simultaneously.
155155
/// When the counter reaches the PER value, it rolls-over to 0x0000 and resumes counting.
156156
/// The counter can be reset at any time
157-
pub fn enable_reset_event<E: super::event::TimerResetEventSource<$TIMX, PSCL>>(&mut self, _event: E) {
157+
pub fn enable_reset_event<E: super::event::TimerResetEventSource<$TIMX, PSCL>>(&mut self, _event: &E) {
158158
let tim = unsafe { &*$TIMX::ptr() };
159159

160160
unsafe { tim.$rstXr.modify(|r, w| w.bits(r.bits() | E::BITS)); }
161161
}
162162

163163
/// Stop listening to the specified event
164-
pub fn disable_reset_event<E: super::event::TimerResetEventSource<$TIMX, PSCL>>(&mut self, _event: E) {
164+
pub fn disable_reset_event<E: super::event::TimerResetEventSource<$TIMX, PSCL>>(&mut self, _event: &E) {
165165
let tim = unsafe { &*$TIMX::ptr() };
166166

167167
unsafe { tim.$rstXr.modify(|r, w| w.bits(r.bits() & !E::BITS)); }
@@ -230,6 +230,12 @@ hrtim_timer_adc_trigger! {
230230
HRTIM_TIMF: [(Adc13: [(PER: 1 << 24), (RST: 1 << 28)]), (Adc24: [(PER: 1 << 24), ]), (Adc579: [(PER: 30), (RST: 31)]), (Adc6810: [(PER: 31), ])]
231231
}
232232

233+
/// Master Timer Period event
233234
impl<DST, PSCL> super::event::TimerResetEventSource<DST, PSCL> for HrTim<HRTIM_MASTER, PSCL> {
234235
const BITS: u32 = 1 << 4; // MSTPER
235236
}
237+
238+
/// Master Timer Period event
239+
impl<DST, PSCL> super::event::EventSource<DST, PSCL> for HrTim<HRTIM_MASTER, PSCL> {
240+
const BITS: u32 = 1 << 7; // MSTPER
241+
}

0 commit comments

Comments
 (0)