embedded_hal_async::digital

Trait Wait

source
pub trait Wait: ErrorType {
    // Required methods
    async fn wait_for_high(&mut self) -> Result<(), Self::Error>;
    async fn wait_for_low(&mut self) -> Result<(), Self::Error>;
    async fn wait_for_rising_edge(&mut self) -> Result<(), Self::Error>;
    async fn wait_for_falling_edge(&mut self) -> Result<(), Self::Error>;
    async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error>;
}
Expand description

Asynchronously wait for GPIO pin state.

Required Methods§

source

async fn wait_for_high(&mut self) -> Result<(), Self::Error>

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.

source

async fn wait_for_low(&mut self) -> Result<(), Self::Error>

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.

source

async fn wait_for_rising_edge(&mut self) -> Result<(), Self::Error>

Wait for the pin to undergo a transition from low to high.

If the pin is already high, this does not return immediately, it’ll wait for the pin to go low and then high again.

source

async fn wait_for_falling_edge(&mut self) -> Result<(), Self::Error>

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.

source

async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error>

Wait for the pin to undergo any transition, i.e low to high OR high to low.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: Wait + ?Sized> Wait for &mut T

source§

async fn wait_for_high(&mut self) -> Result<(), Self::Error>

source§

async fn wait_for_low(&mut self) -> Result<(), Self::Error>

source§

async fn wait_for_rising_edge(&mut self) -> Result<(), Self::Error>

source§

async fn wait_for_falling_edge(&mut self) -> Result<(), Self::Error>

source§

async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error>

Implementors§