Trait embedded_hal_async::digital::Wait
source · [−]pub trait Wait: ErrorType {
type WaitForHighFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
type WaitForLowFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
type WaitForRisingEdgeFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
type WaitForFallingEdgeFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
type WaitForAnyEdgeFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a>;
fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a>;
fn wait_for_rising_edge<'a>(
&'a mut self
) -> Self::WaitForRisingEdgeFuture<'a>;
fn wait_for_falling_edge<'a>(
&'a mut self
) -> Self::WaitForFallingEdgeFuture<'a>;
fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a>;
}
Expand description
Asynchronously wait for GPIO pin state.
Required Associated Types
The future returned by the wait_for_high
function.
The future returned by wait_for_low
.
The future returned from wait_for_rising_edge
.
The future returned from wait_for_falling_edge
.
Required Methods
fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a>
fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a>
Wait until the pin is high. If it is already high, return immediately.
Note for implementers
The pin may have switched back to low before the task was run after being woken. The future should still resolve in that case.
fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a>
fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a>
Wait until the pin is low. If it is already low, return immediately.
Note for implementers
The pin may have switched back to high before the task was run after being woken. The future should still resolve in that case.
fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a>
fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a>
Wait for the pin to undergo a transition from low to high.
If the pin is already low, this does not return immediately, it’ll wait for the pin to go high and then low again.
fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a>
fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a>
Wait for the pin to undergo a transition from high to low.
If the pin is already low, this does not return immediately, it’ll wait for the pin to go high and then low again.
fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a>
fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a>
Wait for the pin to undergo any transition, i.e low to high OR high to low.