Skip to content

Commit 1e7823a

Browse files
committed
HRTIM: Start work on capture support
1 parent 098fcb9 commit 1e7823a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/hrtim/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pub mod adc_trigger;
2+
pub mod capture;
23
pub mod compare_register;
34
pub mod control;
45
pub mod deadtime;

src/hrtim/timer.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ use super::{
88
event::{
99
TimerAResetEventSource, TimerBResetEventSource, TimerCResetEventSource,
1010
TimerDResetEventSource, TimerEResetEventSource, TimerFResetEventSource,
11-
},
11+
}, capture::{HrCapt, self},
1212
};
1313

1414
pub struct HrTim<TIM, PSCL> {
1515
_timer: PhantomData<TIM>,
1616
_prescaler: PhantomData<PSCL>,
17+
capture_ch1: HrCapt<TIM, PSCL, capture::Ch1>,
18+
capture_ch2: HrCapt<TIM, PSCL, capture::Ch2>,
1719
}
1820

1921
pub trait HrTimer<TIM, PSCL>: Sized {
@@ -159,6 +161,14 @@ macro_rules! hrtim_timer {
159161

160162
tim.$icr.write(|w| w.$repc().set_bit());
161163
}
164+
165+
pub fn capture_ch1(&mut self) -> &mut HrCapt<$TIMX, PSCL, capture::Ch1> {
166+
&mut self.capture_ch1
167+
}
168+
169+
pub fn capture_ch2(&mut self) -> &mut HrCapt<$TIMX, PSCL, capture::Ch2> {
170+
&mut self.capture_ch2
171+
}
162172
}
163173

164174
$(

0 commit comments

Comments
 (0)