From 5fd0e30b488f3226bf4d51fe9268baae7d3a23c9 Mon Sep 17 00:00:00 2001 From: Michael Beaumont Date: Wed, 17 Mar 2021 23:59:26 +0100 Subject: [PATCH] Remove extraneous generic type --- embassy-stm32l0/src/exti.rs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/embassy-stm32l0/src/exti.rs b/embassy-stm32l0/src/exti.rs index 7958bd94..c93d213e 100644 --- a/embassy-stm32l0/src/exti.rs +++ b/embassy-stm32l0/src/exti.rs @@ -2,7 +2,6 @@ use core::future::Future; use core::mem; use core::pin::Pin; -use embassy::interrupt::Interrupt; use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; use embassy::util::InterruptFuture; @@ -23,10 +22,9 @@ impl<'a> ExtiManager { Self { syscfg } } - pub fn new_pin(&'static mut self, pin: T, interrupt: I) -> ExtiPin + pub fn new_pin(&'static mut self, pin: T, interrupt: T::Interrupt) -> ExtiPin where - T: PinWithInterrupt, - I: Interrupt, + T: PinWithInterrupt, { ExtiPin { pin, @@ -36,13 +34,13 @@ impl<'a> ExtiManager { } } -pub struct ExtiPin { +pub struct ExtiPin { pin: T, - interrupt: I, + interrupt: T::Interrupt, mgr: &'static ExtiManager, } -impl + 'static, I: Interrupt + 'static> ExtiPin { +impl ExtiPin { fn wait_for_edge<'a>( self: Pin<&'a mut Self>, edge: TriggerEdge, @@ -72,9 +70,7 @@ impl + 'static, I: Interrupt + 'static> ExtiP } } -impl + 'static, I: Interrupt + 'static> WaitForRisingEdge - for ExtiPin -{ +impl WaitForRisingEdge for ExtiPin { type Future<'a> = impl Future + 'a; fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { @@ -82,9 +78,7 @@ impl + 'static, I: Interrupt + 'static> WaitF } } -impl + 'static, I: Interrupt + 'static> WaitForFallingEdge - for ExtiPin -{ +impl WaitForFallingEdge for ExtiPin { type Future<'a> = impl Future + 'a; fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { @@ -92,9 +86,7 @@ impl + 'static, I: Interrupt + 'static> WaitF } } -impl + 'static, I: Interrupt + 'static> WaitForAnyEdge - for ExtiPin -{ +impl WaitForAnyEdge for ExtiPin { type Future<'a> = impl Future + 'a; fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { @@ -107,7 +99,7 @@ mod private { } pub trait PinWithInterrupt: private::Sealed { - type Interrupt; + type Interrupt: interrupt::Interrupt; fn port(&self) -> gpio::Port; fn line(&self) -> GpioLine; }