Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
IButton.h
Go to the documentation of this file.
1
3
#ifndef _ARDUINOUNIVERSALINPUTS_IBUTTON_H
4
#define _ARDUINOUNIVERSALINPUTS_IBUTTON_H
5
6
#include "
IInputDevice.h
"
7
8
#include "Arduino.h"
9
14
class
IButton
:
public
IInputDevice
15
{
16
public
:
17
IButton
(
inputid_t
id
,
inputtime_t
debounceDelay = 50);
18
virtual
~
IButton
();
19
23
inputtype_t
type
()
const
{
return
UIT_BUTTON
; }
24
25
bool
setDebounceDelay
(
inputtime_t
debounce);
26
31
inputtime_t
getDebounceDelay
()
const
{
return
m_debounceDelay; }
32
33
bool
poll
();
34
39
bool
isActive
()
const
{
return
m_active; }
40
45
inputtime_t
lastStateChange
()
const
{
return
m_lastStateChange; }
46
51
inputtime_t
lastActiveDuration
()
const
{
return
m_lastActiveDuration; }
52
53
protected
:
58
virtual
uint8_t
getPhysicalState
()
const
= 0;
59
60
private
:
61
bool
m_active;
62
63
inputtime_t
m_lastStateChange;
64
inputtime_t
m_lastActiveDuration;
65
66
inputtime_t
m_debounceDelay;
67
};
68
69
#endif
IButton::isActive
bool isActive() const
Determines if the button is currently active.
Definition:
IButton.h:39
IInputDevice
Represents an input device.
Definition:
IInputDevice.h:14
inputid_t
uint16_t inputid_t
Holds the value of a device ID.
Definition:
UniversalInputTypes.h:13
IButton::lastActiveDuration
inputtime_t lastActiveDuration() const
Returns the duration for which the button was last active.
Definition:
IButton.h:51
IButton::type
inputtype_t type() const
Retrieves the type of this device.
Definition:
IButton.h:23
IButton::getDebounceDelay
inputtime_t getDebounceDelay() const
Gets the current debounce delay time.
Definition:
IButton.h:31
IButton::getPhysicalState
virtual uint8_t getPhysicalState() const =0
Gets the current physical state of the button.
UIT_BUTTON
Buttons inheriting from IButton.
Definition:
UniversalInputTypes.h:39
IButton::poll
bool poll()
Polls this input device for change.
Definition:
IButton.cpp:38
IInputDevice.h
inputtype_t
inputtype_t
Enumeration of all input device types.
Definition:
UniversalInputTypes.h:37
IButton
Represents a two state button.
Definition:
IButton.h:14
IButton::IButton
IButton(inputid_t id, inputtime_t debounceDelay=50)
Creates a new button.
Definition:
IButton.cpp:10
inputtime_t
uint32_t inputtime_t
Holds the value of a timestap.
Definition:
UniversalInputTypes.h:25
IButton::setDebounceDelay
bool setDebounceDelay(inputtime_t debounce)
Sets the debounce delay time.
Definition:
IButton.cpp:26
IButton::lastStateChange
inputtime_t lastStateChange() const
Returns the time of the last state change.
Definition:
IButton.h:45
Generated on Fri Aug 3 2018 14:58:25 for Arduino Universal Inputs by
1.8.6