butt_head/config.rs
1use crate::TimeDuration;
2
3/// Configuration for a `ButtHead` instance.
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5pub struct Config<D: TimeDuration> {
6 /// Input polarity (true = pin low means pressed).
7 pub active_low: bool,
8
9 /// Maximum gap between clicks to count as multi-click.
10 pub click_timeout: D,
11
12 /// Time before the first Hold event fires.
13 pub hold_delay: D,
14
15 /// Time between subsequent Hold events while held.
16 pub hold_interval: D,
17
18 /// Maximum number of clicks to accumulate before emitting a `Click` event
19 /// immediately (without waiting for `click_timeout` to expire).
20 ///
21 /// - `None` — unbounded; always wait for `click_timeout` (default behaviour).
22 /// - `Some(1)` — emit `Click` on every release with no timeout wait.
23 /// - `Some(n)` — emit immediately once the n-th click in a sequence lands.
24 pub max_click_count: Option<u8>,
25}