diff options
| author | Michael Beaumont <[email protected]> | 2021-03-17 23:59:26 +0100 |
|---|---|---|
| committer | Michael Beaumont <[email protected]> | 2021-03-18 00:00:18 +0100 |
| commit | 5fd0e30b488f3226bf4d51fe9268baae7d3a23c9 (patch) | |
| tree | 296c6fa19b04aa35ef7458a17a26ae2d9e60c26b | |
| parent | 32c7aa4045453a07b8ae0a751d74b8eba237f06f (diff) | |
Remove extraneous generic type
| -rw-r--r-- | embassy-stm32l0/src/exti.rs | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/embassy-stm32l0/src/exti.rs b/embassy-stm32l0/src/exti.rs index 7958bd948..c93d213ef 100644 --- a/embassy-stm32l0/src/exti.rs +++ b/embassy-stm32l0/src/exti.rs | |||
| @@ -2,7 +2,6 @@ use core::future::Future; | |||
| 2 | use core::mem; | 2 | use core::mem; |
| 3 | use core::pin::Pin; | 3 | use core::pin::Pin; |
| 4 | 4 | ||
| 5 | use embassy::interrupt::Interrupt; | ||
| 6 | use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; | 5 | use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; |
| 7 | use embassy::util::InterruptFuture; | 6 | use embassy::util::InterruptFuture; |
| 8 | 7 | ||
| @@ -23,10 +22,9 @@ impl<'a> ExtiManager { | |||
| 23 | Self { syscfg } | 22 | Self { syscfg } |
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | pub fn new_pin<T, I>(&'static mut self, pin: T, interrupt: I) -> ExtiPin<T, I> | 25 | pub fn new_pin<T>(&'static mut self, pin: T, interrupt: T::Interrupt) -> ExtiPin<T> |
| 27 | where | 26 | where |
| 28 | T: PinWithInterrupt<Interrupt = I>, | 27 | T: PinWithInterrupt, |
| 29 | I: Interrupt, | ||
| 30 | { | 28 | { |
| 31 | ExtiPin { | 29 | ExtiPin { |
| 32 | pin, | 30 | pin, |
| @@ -36,13 +34,13 @@ impl<'a> ExtiManager { | |||
| 36 | } | 34 | } |
| 37 | } | 35 | } |
| 38 | 36 | ||
| 39 | pub struct ExtiPin<T, I> { | 37 | pub struct ExtiPin<T: PinWithInterrupt> { |
| 40 | pin: T, | 38 | pin: T, |
| 41 | interrupt: I, | 39 | interrupt: T::Interrupt, |
| 42 | mgr: &'static ExtiManager, | 40 | mgr: &'static ExtiManager, |
| 43 | } | 41 | } |
| 44 | 42 | ||
| 45 | impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> ExtiPin<T, I> { | 43 | impl<T: PinWithInterrupt + 'static> ExtiPin<T> { |
| 46 | fn wait_for_edge<'a>( | 44 | fn wait_for_edge<'a>( |
| 47 | self: Pin<&'a mut Self>, | 45 | self: Pin<&'a mut Self>, |
| 48 | edge: TriggerEdge, | 46 | edge: TriggerEdge, |
| @@ -72,9 +70,7 @@ impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> ExtiP | |||
| 72 | } | 70 | } |
| 73 | } | 71 | } |
| 74 | 72 | ||
| 75 | impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitForRisingEdge | 73 | impl<T: PinWithInterrupt + 'static> WaitForRisingEdge for ExtiPin<T> { |
| 76 | for ExtiPin<T, I> | ||
| 77 | { | ||
| 78 | type Future<'a> = impl Future<Output = ()> + 'a; | 74 | type Future<'a> = impl Future<Output = ()> + 'a; |
| 79 | 75 | ||
| 80 | fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | 76 | fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { |
| @@ -82,9 +78,7 @@ impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitF | |||
| 82 | } | 78 | } |
| 83 | } | 79 | } |
| 84 | 80 | ||
| 85 | impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitForFallingEdge | 81 | impl<T: PinWithInterrupt + 'static> WaitForFallingEdge for ExtiPin<T> { |
| 86 | for ExtiPin<T, I> | ||
| 87 | { | ||
| 88 | type Future<'a> = impl Future<Output = ()> + 'a; | 82 | type Future<'a> = impl Future<Output = ()> + 'a; |
| 89 | 83 | ||
| 90 | fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | 84 | fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { |
| @@ -92,9 +86,7 @@ impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitF | |||
| 92 | } | 86 | } |
| 93 | } | 87 | } |
| 94 | 88 | ||
| 95 | impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitForAnyEdge | 89 | impl<T: PinWithInterrupt + 'static> WaitForAnyEdge for ExtiPin<T> { |
| 96 | for ExtiPin<T, I> | ||
| 97 | { | ||
| 98 | type Future<'a> = impl Future<Output = ()> + 'a; | 90 | type Future<'a> = impl Future<Output = ()> + 'a; |
| 99 | 91 | ||
| 100 | fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | 92 | fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { |
| @@ -107,7 +99,7 @@ mod private { | |||
| 107 | } | 99 | } |
| 108 | 100 | ||
| 109 | pub trait PinWithInterrupt: private::Sealed { | 101 | pub trait PinWithInterrupt: private::Sealed { |
| 110 | type Interrupt; | 102 | type Interrupt: interrupt::Interrupt; |
| 111 | fn port(&self) -> gpio::Port; | 103 | fn port(&self) -> gpio::Port; |
| 112 | fn line(&self) -> GpioLine; | 104 | fn line(&self) -> GpioLine; |
| 113 | } | 105 | } |
