Skip to content

Commit eb075b0

Browse files
committed
HRTIM: Move clear_repetition_interrupt to trait
1 parent 944985b commit eb075b0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/hrtim/timer.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ pub trait HrTimer<TIM, PSCL>: Sized {
3535
/// Stop timer and reset counter
3636
fn stop_and_reset(&mut self, _hr_control: &mut HrPwmControl);
3737

38+
fn clear_repetition_interrupt(&mut self);
39+
3840
/// Make a handle to this timers reset event to use as adc trigger
3941
fn as_reset_adc_trigger(&self) -> super::adc_trigger::TimerReset<Self>;
4042

@@ -105,6 +107,12 @@ macro_rules! hrtim_timer {
105107
fn as_period_adc_trigger(&self) -> super::adc_trigger::TimerPeriod<Self> {
106108
super::adc_trigger::TimerPeriod(PhantomData)
107109
}
110+
111+
fn clear_repetition_interrupt(&mut self) {
112+
let tim = unsafe { &*$TIMX::ptr() };
113+
114+
tim.$icr.write(|w| w.$repc().set_bit());
115+
}
108116
}
109117

110118
impl<PSCL> HrTim<$TIMX, PSCL> {
@@ -120,12 +128,6 @@ macro_rules! hrtim_timer {
120128
tim.$dier.modify(|_r, w| w.$repie().bit(enable));
121129
}
122130

123-
pub fn clear_repetition_interrupt(&mut self) {
124-
let tim = unsafe { &*$TIMX::ptr() };
125-
126-
tim.$icr.write(|w| w.$repc().set_bit());
127-
}
128-
129131
pub fn capture_ch1(&mut self) -> &mut HrCapt<$TIMX, PSCL, capture::Ch1> {
130132
&mut self.capture_ch1
131133
}

0 commit comments

Comments
 (0)