ISF15ACP4 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces
isf15acp4_button.hpp File Reference

The switch debouncer: a time-injected state machine with press, release, long-press and repeat events. More...

#include <cstdint>
#include "isf15acp4_types.hpp"

Go to the source code of this file.

Classes

struct  isf15acp4::ButtonUpdate
 One result of ButtonDebouncer::Update(). More...
 
class  isf15acp4::ButtonDebouncer
 Debounces a switch sampled at any rate and classifies the press. More...
 

Namespaces

namespace  isf15acp4
 The ISF15ACP4 driver: everything it declares lives here; internals in detail.
 

Detailed Description

The switch debouncer: a time-injected state machine with press, release, long-press and repeat events.

The switch is an SPST normally-open contact (NKK sheet E4: "Leave actuator: 1 - 2 OFF, push actuator: 1 - 2 ON"). The sheet gives no bounce time, so the debounce time is ButtonConfig's knob. ButtonDebouncer has no port, no clock and no I/O: the caller passes the sampled level and a millisecond timestamp. All time arithmetic is unsigned subtraction, so a wrapping 32-bit counter is handled.