Skip to content

Commit da834eb

Browse files
committed
Update docs
1 parent aa0b11c commit da834eb

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Async button handling crate for `no_std` environments. Built around `embedded-hal 1.0` traits and `embassy-time`.
44

5+
- [x] Detect button presses without blocking execution of other tasks or unnecessary polling.
6+
- [x] Debouncing
7+
- [x] Detect single and multiple short presses
8+
- [x] Detect long presses
9+
- [ ] Detect sequences of short and long presses or multiple long presses. Open an issue if this would be useful to you, or submit a PR!
10+
511
## Example
612

713
```rust,ignore
@@ -20,14 +26,13 @@ loop {
2026
## Features
2127

2228
- `defmt`: derives `defmt::Format` on public types (except `Button`).
29+
- `std`: uses `tokio` instead of `embassy-time`. Mainly useful for tests.
2330

2431
## License
2532

2633
Licensed under either of
2734

28-
- Apache License, Version 2.0
29-
([LICENSE-APACHE](LICENSE-APACHE))
30-
- MIT license
31-
([LICENSE-MIT](LICENSE-MIT))
32-
35+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
36+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
37+
3338
at your option.

src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::Duration;
22

3-
/// Various [`Button`](super::Button) parameters.
3+
/// [`Button`](super::Button) configuration.
44
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
55
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
66
pub struct ButtonConfig {
@@ -47,20 +47,20 @@ impl Default for ButtonConfig {
4747
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
4848
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
4949
pub enum Mode {
50-
/// Active 0.
50+
/// Button is connected to a pin with a pull-up resistor. Button pressed it logic 0.
5151
#[default]
5252
PullUp,
53-
/// Active 1.
53+
/// Button is connected to a pin with a pull-down resistor. Button pressed it logic 1.
5454
PullDown,
5555
}
5656

5757
impl Mode {
58-
/// Is button activated by logic zero?
58+
/// Is button connected to a pin with a pull-up resistor?
5959
pub const fn is_pullup(&self) -> bool {
6060
matches!(self, Mode::PullUp)
6161
}
6262

63-
/// Is button activated by logic one?
63+
/// Is button connected to a pin with a pull-down resistor?
6464
pub const fn is_pulldown(&self) -> bool {
6565
!self.is_pullup()
6666
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum State {
4343
}
4444

4545
/// Detected button events
46-
#[derive(Debug, Clone, Copy, PartialEq)]
46+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4747
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
4848
pub enum ButtonEvent {
4949
/// A sequence of 1 or more short presses.

0 commit comments

Comments
 (0)