diff --git a/embassy-stm32/src/timer/input_capture.rs b/embassy-stm32/src/timer/input_capture.rs index 5dadc9131..000938a70 100644 --- a/embassy-stm32/src/timer/input_capture.rs +++ b/embassy-stm32/src/timer/input_capture.rs @@ -26,10 +26,6 @@ pub enum Ch3 {} /// Channel 4 marker type. pub enum Ch4 {} -fn regs_gp16(ptr: *mut ()) -> crate::pac::timer::TimGp16 { - unsafe { crate::pac::timer::TimGp16::from_ptr(ptr) } -} - /// Capture pin wrapper. /// /// This wraps a pin to make it usable with capture. @@ -80,6 +76,10 @@ impl<'d, T: GeneralInstance4Channel> InputCapture<'d, T> { freq: Hertz, counting_mode: CountingMode, ) -> Self { + Self::new_inner(tim, freq, counting_mode) + } + + fn new_inner(tim: impl Peripheral
+ 'd, freq: Hertz, counting_mode: CountingMode) -> Self {
let mut this = Self { inner: Timer::new(tim) };
this.inner.set_counting_mode(counting_mode);
@@ -150,6 +150,7 @@ impl<'d, T: GeneralInstance4Channel> InputCapture<'d, T> {
fn new_future(&self, channel: Channel, mode: InputCaptureMode, tisel: InputTISelection) -> InputCaptureFuture