|
Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
#include <DebouncedDualButton.h>

Public Member Functions | |
| DebouncedDualButton (AbstractButton &button1, AbstractButton &button2) | |
| void | begin (bool callBeginInChildren=true, uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay) |
| void | update () |
| bool | on () |
Public Member Functions inherited from AbstractDebouncedButton | |
| AbstractDebouncedButton () | |
| void | begin (uint8_t threshold=DefaultThreshold, uint8_t delay=DefaultButtonDelay) |
| bool | pushed (bool peek=false) |
| uint32_t | tapped (bool peek=false) |
| bool | held (uint16_t ms=DefaultHeldMs) |
| bool | repeat (uint16_t initialMs=DefaultButtonRepeatInitialMs, uint16_t repeatMs=DefaultButtonRepeatMs) |
| void | setState (bool newState) |
Public Member Functions inherited from AbstractButton | |
| AbstractButton () | |
| virtual void | begin () |
Public Member Functions inherited from DualInputButton | |
| DualInputButton (AbstractButton &button1, AbstractButton &button2, const MixMode mix=Or) | |
| void | begin (bool callBeginInChildren=true) |
| bool | on () |
Additional Inherited Members | |
Public Types inherited from DualInputButton | |
| enum | MixMode { Or, Xor, And } |
Static Public Attributes inherited from AbstractDebouncedButton | |
| static const uint8_t | DefaultThreshold = 5 |
| static const uint8_t | DefaultButtonDelay = 5 |
| static const uint16_t | DefaultHeldMs = 800 |
| static const uint16_t | DefaultButtonRepeatInitialMs = 700 |
| static const uint16_t | DefaultButtonRepeatMs = 350 |
Protected Attributes inherited from AbstractDebouncedButton | |
| uint8_t | _threshold |
| uint8_t | _delay |
| uint32_t | _lastUpdate |
| uint8_t | _counter |
| bool | _state |
| uint32_t | _lastStateChange |
| bool | _pushed |
| uint16_t | _repeatCount |
| uint32_t | _lastRepeat |
| uint32_t | _lastOnDuration |
Protected Attributes inherited from DualInputButton | |
| AbstractButton & | _button1 |
| AbstractButton & | _button2 |
| const MixMode | _mix |
Timeslice-based dual input button with debouncing
This class adds debouncing to a DualInputButton.
Definition at line 12 of file DebouncedDualButton.h.
| DebouncedDualButton::DebouncedDualButton | ( | AbstractButton & | button1, |
| AbstractButton & | button2 | ||
| ) |
Constructor.
| button1 | a reference to the first button input. |
| button2 | a reference to the second button input. |
Definition at line 6 of file DebouncedDualButton.cpp.
| void DebouncedDualButton::begin | ( | bool | callBeginInChildren = true, |
| uint8_t | threshold = AbstractDebouncedButton::DefaultThreshold, |
||
| uint8_t | delay = AbstractDebouncedButton::DefaultButtonDelay |
||
| ) |
Initialization.
| callBeginInChildren | if true, begin() will be called in the two button objects referenced in the constructor. If false, that will be left to the user (in case they want to call begin with non-defalt parameters). |
| threshold | how many tests of the pin must match for a state change. |
| delay | number of ms between tests of pin state. |
Should be called from setup(), or at any rate, before other members are called. This will set the pinMode. The minimum time it takes for button presses / released to register is threshold * delay.
Definition at line 11 of file DebouncedDualButton.cpp.

|
virtual |
Test instantaneous input state (with debouncing).
Implements AbstractButton.
Definition at line 31 of file DebouncedDualButton.cpp.
|
virtual |
Allocate timeslice.
This method must be called frequently - usually from loop().
Implements AbstractDebouncedButton.
Definition at line 17 of file DebouncedDualButton.cpp.

1.8.15