SMFSW / SeqButton

Handling filtered button pushes with callbacks for Arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SeqButton Build Status

Sequential Button Arduino Library

Handling filtered button press with callbacks for push (with or without repeat) and release, logic, filtering time and sequences.

Usage

  • Declare a SeqButton instance (called sb below)
  • Create callback function(s) of type void func()
  • Initialize instance with sb.init(uint8_t pin, void (*cbckON)(SeqButton*), void (*cbckOFF)(SeqButton*), bool repeat, bool logic=LOW, uint16_t filter=50)
    • pin: pin on which button is connected
    • cbckON: callback function on press (NULL when no callback needed)
    • cbckOFF: callback function on release (NULL when no callback needed)
    • repeat: callback called repeatedly when set to true
    • logic: Button logic: LOW for NO / HIGH for NC (internal pullup for input is enabled)
    • filter: filtering time (in ms)
  • Call the handler in a loop using sb.handler() -> handler returns the current button value (if needed)
  • sb.getState() or sb.getButton() can be used to get current button state at any time
  • sb.getPin() can be used to check pin assigned to instance
  • sb.getHoldTime() can be used on a release callback to get hold duration of button

Examples included

Documentation

Doxygen doc can be generated using "Doxyfile".

See generated documentation

Release Notes

See release notes

About

Handling filtered button pushes with callbacks for Arduino

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 100.0%