Add WaitForAnyEdge

This commit is contained in:
Michael Beaumont 2021-03-09 16:02:52 +01:00
parent 6278ecf4b0
commit 5e8156a47d
No known key found for this signature in database
GPG Key ID: 94C1243E6859F368

View File

@ -3,7 +3,7 @@ use core::mem;
use core::pin::Pin; use core::pin::Pin;
use embassy::interrupt::Interrupt; use embassy::interrupt::Interrupt;
use embassy::traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge};
use embassy::util::InterruptFuture; use embassy::util::InterruptFuture;
use crate::hal::{ use crate::hal::{
@ -92,6 +92,16 @@ impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitF
} }
} }
impl<T: PinWithInterrupt<Interrupt = I> + 'static, I: Interrupt + 'static> WaitForAnyEdge
for ExtiPin<T, I>
{
type Future<'a> = impl Future<Output = ()> + 'a;
fn wait_for_any_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
self.wait_for_edge(TriggerEdge::Both)
}
}
mod private { mod private {
pub trait Sealed {} pub trait Sealed {}
} }