Crates.io | async-button |
lib.rs | async-button |
version | 0.1.0 |
source | src |
created_at | 2023-12-02 21:40:34.966127 |
updated_at | 2023-12-02 21:40:34.966127 |
description | Async button handling crate for no_std environments |
homepage | |
repository | https://github.com/avsaase/async-button |
max_upload_size | |
id | 1056399 |
size | 34,123 |
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
: derives defmt::Format
on public types (except Button
).std
: uses tokio
instead of embassy-time
. Mainly useful for tests.Licensed under either of
at your option.