ButtonHandler

class ButtonHandler(doubleTapThreshold: Double = 300.0, debounceThreshold: Double = 50.0)

Handles button state updates and provides methods for detecting various button events.

Parameters

doubleTapThreshold

the maximum time (ms) between two presses to count as a double tap

debounceThreshold

the minimum time (ms) between state changes to prevent bouncing

Constructors

Link copied to clipboard
constructor(doubleTapThreshold: Double = 300.0, debounceThreshold: Double = 50.0)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun held(milliseconds: Double): Boolean

Checks if the button is currently held down for at least milliseconds.

Link copied to clipboard
fun reset()

Resets the internal state (tap count, etc.).

Link copied to clipboard
fun update(buttonPressed: Boolean)

Updates the button state. Should be called in every loop iteration.