From 5e8156a47dd016618eadc5c288406f1e201f1b8b Mon Sep 17 00:00:00 2001 From: Michael Beaumont Date: Tue, 9 Mar 2021 16:02:52 +0100 Subject: [PATCH] Add WaitForAnyEdge --- embassy-stm32l0/src/exti.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; use core::pin::Pin; use embassy::interrupt::Interrupt; -use embassy::traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; +use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; use embassy::util::InterruptFuture; use crate::hal::{ @@ -92,6 +92,16 @@ impl + 'static, I: Interrupt + 'static> WaitF } } +impl + 'static, I: Interrupt + 'static> WaitForAnyEdge + for ExtiPin +{ + type Future<'a> = impl Future + 'a; + + fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { + self.wait_for_edge(TriggerEdge::Both) + } +} + mod private { pub trait Sealed {} }