Thank you very much for swift reply.
Now I face another issue while using it as following, do you have any suggestion?
I just want to detect press & release events on the same button in a no-std, async code and using that elegant select().
let mut but15: esp_hal::gpio::GpioPin<Input<PullDown>, 15> = io.pins.gpio15.into_pull_down_input();
loop
{
match select (
but15.wait_for_rising_edge(), <---- first mutable borrow
but15.wait_for_falling_edge(), <---- second mutable borrow hence compile error
).await {
Either::First(_) => log::info!("Button Pressed!"),
Either::Second(_) => log::info!("Button Released!"),
}
}
Maybe check if the pin is currently high or low and depending on that decide to either call wait_for_rising_edge().await of wait_for_falling_edge().await. That is what wait_for_any_edge effectively does: embassy/embassy-nrf/src/gpiote.rs at 4e2296e34458382be4b548fa10e5f6a782059e8d · embassy-rs/embassy · GitHub It seems like wait_for_any_edge is not directly useful to you as it doesn't return whether it is a rising or falling edge.
I've just noticed that this is on the "internals" forum, which is more commonly used for discussing the Rust toolchain internals, and not how to use Rust - questions like this are better asked on https://users.rust-lang.org/ where there's plenty of people who can help.