Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
#include <DualInputButton.h>
Public Types | |
enum | MixMode { Or, Xor, And } |
Public Member Functions | |
DualInputButton (AbstractButton &button1, AbstractButton &button2, const MixMode mix=Or) | |
void | begin (bool callBeginInChildren=true) |
bool | on () |
Public Member Functions inherited from AbstractButton | |
AbstractButton () | |
virtual void | begin () |
Protected Attributes | |
AbstractButton & | _button1 |
AbstractButton & | _button2 |
const MixMode | _mix |
Basic instantaneous button from two separate inputs.
DualInputButton models a digital push button or switch made from two separate "child" buttons. The DualInputButton is considered to be on if either of the two input buttons are on.
Previous released of Mutila only allowed for DualButton to be made from two RawInput (digital pin) buttons. With this new approach, a DualButton may be created by combining DigitalInputButton and AnalogInputButton objects.
Definition at line 18 of file DualInputButton.h.
DualInputButton::DualInputButton | ( | AbstractButton & | button1, |
AbstractButton & | button2, | ||
const MixMode | mix = Or |
||
) |
Constructor.
button1 | a reference to the first button object. |
button2 | a reference to the second button object. |
mix | how to combine the two inputs. |
Definition at line 4 of file DualInputButton.cpp.
void DualInputButton::begin | ( | bool | callBeginInChildren = true | ) |
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). |
Definition at line 11 of file DualInputButton.cpp.
|
virtual |
Test instantaneous input state.
Implements AbstractButton.
Definition at line 19 of file DualInputButton.cpp.