diff options
| author | Michael Beaumont <[email protected]> | 2021-03-09 16:02:52 +0100 |
|---|---|---|
| committer | Michael Beaumont <[email protected]> | 2021-03-09 16:03:19 +0100 |
| commit | 5e8156a47dd016618eadc5c288406f1e201f1b8b (patch) | |
| tree | 3c9def663ea755a0ce2442087d65c6afafbce142 | |
| parent | 6278ecf4b0c312894821c2e4b4f5a1b6ea5688d4 (diff) | |
Add WaitForAnyEdge
| -rw-r--r-- | embassy-stm32l0/src/exti.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/embassy-stm32l0/src/exti.rs b/embassy-stm32l0/src/exti.rs index ca699a086..7958bd948 100644 --- a/embassy-stm32l0/src/exti.rs +++ b/embassy-stm32l0/src/exti.rs | |||
| @@ -3,7 +3,7 @@ use core::mem; | |||
| 3 | use core::pin::Pin; | 3 | use core::pin::Pin; |
| 4 | 4 | ||
| 5 | use embassy::interrupt::Interrupt; | 5 | use embassy::interrupt::Interrupt; |
| 6 | use embassy::traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; | 6 | use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; |
| 7 | use embassy::util::InterruptFuture; | 7 | use embassy::util::InterruptFuture; |
| 8 | 8 | ||
| 9 | use crate::hal::{ | 9 | use crate::hal::{ |
| @@ -92,6 +92,16 @@ impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitF | |||
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitForAnyEdge | ||
| 96 | for ExtiPin<T, I> | ||
| 97 | { | ||
| 98 | type Future<'a> = impl Future<Output = ()> + 'a; | ||
| 99 | |||
| 100 | fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | ||
| 101 | self.wait_for_edge(TriggerEdge::Both) | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 95 | mod private { | 105 | mod private { |
| 96 | pub trait Sealed {} | 106 | pub trait Sealed {} |
| 97 | } | 107 | } |
