Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
ArduinoButton.h
Go to the documentation of this file.
1 
3 #ifndef _ARDUINOUNIVERSALINPUTS_ARDUINOBUTTON_H
4 #define _ARDUINOUNIVERSALINPUTS_ARDUINOBUTTON_H
5 
6 #include "IButton.h"
7 
12 class ArduinoButton : public IButton
13 {
14 public:
15  ArduinoButton(inputid_t id, inputpin_t pin, bool activeLow = true,
16  bool pullUp = true);
17 
18  virtual ~ArduinoButton() {}
19 
24  inputpin_t getPin() const { return m_pin; }
25 
30  bool isActiveLow() const { return m_activeLow; }
31 
36  bool isPullUp() const { return m_pullUp; }
37 
38 protected:
39  uint8_t getPhysicalState() const;
40 
41 private:
42  inputpin_t m_pin;
43  bool m_activeLow;
44  bool m_pullUp;
45 };
46 
47 #endif
uint16_t inputid_t
Holds the value of a device ID.
Definition: UniversalInputTypes.h:13
bool isPullUp() const
Determines if the pin is pulled high.
Definition: ArduinoButton.h:36
uint8_t inputpin_t
Holds the value of a pin number.
Definition: UniversalInputTypes.h:19
uint8_t getPhysicalState() const
Gets the current physical state of the button.
Definition: ArduinoButton.cpp:28
Represents a two state button.
Definition: IButton.h:14
Represents a button on an Arduino pin.
Definition: ArduinoButton.h:12
ArduinoButton(inputid_t id, inputpin_t pin, bool activeLow=true, bool pullUp=true)
Creates a new button on an Arduino pin.
Definition: ArduinoButton.cpp:12
bool isActiveLow() const
Determines if the pin logic is active low.
Definition: ArduinoButton.h:30
inputpin_t getPin() const
Gets the pin the button is attached to.
Definition: ArduinoButton.h:24