modm API documentation
|
Classes | |
class | modm::Button< PIN > |
Simple Button More... | |
class | modm::ButtonGroup< T > |
lbuild module: modm:ui:button
The modm::ButtonGroup
class is able to debounce eight buttons at the same time. The buttons have to be low-active. If this isn't the case invert their signal before passing it to the update()
method.
The update()
method needs to be called periodically for example every 10ms. Preferred in a timer interrupt function.
The detection for long or repeated presses works only correctly for one key at a time. This constraint only applies to buttons listed in the mask
variable.
## Mode 1
## Mode 2
To name buttons, declare an enum with a bitmask for each button:
Pass a ButtonIdentifier
to any of ButtonGroup::is**()
like so
This implementation is based on the C functions written by Peter Dannegger (see http://www.mikrocontroller.net/topic/48465).