SpaIot Library
button.h
1/*
2 * SpaIot Library (c) by epsilonrt - epsilonrt@gmail.com
3 * This file is part of SpaIot library <https://github.com/epsilonrt/spaiot-lib>
4 *
5 * SpaIot library is licensed under a
6 * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
7 *
8 * You should have received a copy of the license along with this
9 * work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
10 *
11 * SpaIot library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY;
13 */
14#pragma once
15
16#include "buttonsettings.h"
17#include "buttoncontroller.h"
18#include "cd4051.h"
19#include "pcf8574mux.h"
20
21namespace SpaIot {
22
27 class Button {
28
29 public:
33 Button ();
37 Button (const ButtonSettings & settings);
38
43 int id() const;
48 const ButtonController & ctrl() const;
53 ButtonController & ctrl();
58 const ButtonSettings & settings() const;
59
63 void begin();
67 void press();
71 void release();
75 void push();
80 bool isOpened() const;
85 bool isNull() const;
90 bool isPressed() const;
95 bool operator== (const Button &other) const;
100 bool operator!= (const Button &other) const;
101
102 private:
103 ButtonController * m_ctrl;
104 const ButtonSettings * m_settings;
105 };
106}
SpaIot name space.
Definition: bussettings.h:21