| Crates.io | async-button |
| lib.rs | async-button |
| version | 0.2.0 |
| created_at | 2023-12-02 21:40:34.966127+00 |
| updated_at | 2025-01-24 23:12:11.394242+00 |
| description | Async button handling crate for no_std environments |
| homepage | |
| repository | https://github.com/avsaase/async-button |
| max_upload_size | |
| id | 1056399 |
| size | 49,411 |
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.