Async button handling crate for no_std
environments. Built around embedded-hal 1.0
traits and embassy-time
.
let pin = /* Input pin */;
let mut button = Button::new(pin, ButtonConfig::default());
// In a separate task:
loop {
match button.update().await {
ButtonEvent::ShortPress { count } => {/* Do something with short presses */},
ButtonEvent::LongPress => {/* Do something with long press */},
}
}
defmt
: derivesdefmt::Format
on public types (exceptButton
).
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.