trigger_hysteresis

Function trigger_hysteresis 

Source
pub fn trigger_hysteresis(
    last_pressed: bool,
    v: u8,
    press_thresh: u8,
    release_thresh: u8,
) -> bool
Expand description

Trigger with hysteresis: returns new state given last state and two thresholds.

  • When currently released: becomes pressed if v >= press_thresh.
  • When currently pressed: stays pressed until v < release_thresh.