Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
Public Types | Public Member Functions | Protected Attributes | List of all members
DualInputButton Class Reference

#include <DualInputButton.h>

Inheritance diagram for DualInputButton:
Inheritance graph

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DualInputButton()

DualInputButton::DualInputButton ( AbstractButton button1,
AbstractButton button2,
const MixMode  mix = Or 
)

Constructor.

Parameters
button1a reference to the first button object.
button2a reference to the second button object.
mixhow to combine the two inputs.

Definition at line 4 of file DualInputButton.cpp.

Member Function Documentation

◆ begin()

void DualInputButton::begin ( bool  callBeginInChildren = true)

Initialization.

Parameters
callBeginInChildrenif 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.

Here is the call graph for this function:

◆ on()

bool DualInputButton::on ( )
virtual

Test instantaneous input state.

Returns
true if either child button is pressed, else false.

Implements AbstractButton.

Definition at line 19 of file DualInputButton.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: