Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | List of all members
IButton Class Referenceabstract

Represents a two state button. More...

#include <IButton.h>

Inheritance diagram for IButton:
Inheritance graph
[legend]
Collaboration diagram for IButton:
Collaboration graph
[legend]

Public Member Functions

 IButton (inputid_t id, inputtime_t debounceDelay=50)
 Creates a new button. More...
 
inputtype_t type () const
 Retrieves the type of this device. More...
 
bool setDebounceDelay (inputtime_t debounce)
 Sets the debounce delay time. More...
 
inputtime_t getDebounceDelay () const
 Gets the current debounce delay time. More...
 
bool poll ()
 Polls this input device for change. More...
 
bool isActive () const
 Determines if the button is currently active. More...
 
inputtime_t lastStateChange () const
 Returns the time of the last state change. More...
 
inputtime_t lastActiveDuration () const
 Returns the duration for which the button was last active. More...
 
- Public Member Functions inherited from IInputDevice
 IInputDevice (inputid_t id)
 Creates a new input device. More...
 
inputid_t getID () const
 Retrieves the ID of this device. More...
 

Protected Member Functions

virtual uint8_t getPhysicalState () const =0
 Gets the current physical state of the button. More...
 

Detailed Description

Represents a two state button.

Constructor & Destructor Documentation

IButton::IButton ( inputid_t  id,
inputtime_t  debounceDelay = 50 
)

Creates a new button.

Parameters
idID of the button
debounceDelayDebounce delay time in ms

Member Function Documentation

inputtime_t IButton::getDebounceDelay ( ) const
inline

Gets the current debounce delay time.

Returns
Debounce delay in ms
virtual uint8_t IButton::getPhysicalState ( ) const
protectedpure virtual

Gets the current physical state of the button.

Returns
True if button state is high

Implemented in ArduinoButton, and ArduinoMatrixButton.

bool IButton::isActive ( ) const
inline

Determines if the button is currently active.

Returns
True of button is active
inputtime_t IButton::lastActiveDuration ( ) const
inline

Returns the duration for which the button was last active.

Returns
Duration in ms
inputtime_t IButton::lastStateChange ( ) const
inline

Returns the time of the last state change.

Returns
Time in ms
bool IButton::poll ( )
virtual

Polls this input device for change.

Returns
True if any state change occurred.

Implements IInputDevice.

bool IButton::setDebounceDelay ( inputtime_t  debounce)

Sets the debounce delay time.

Parameters
debounceDebounce delay time in ms
Returns
True if new value was set
inputtype_t IButton::type ( ) const
inlinevirtual

Retrieves the type of this device.

Returns
Device type

Implements IInputDevice.


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