SpaIot Library
button.h
1/*
2 * SpaIot Library (c) by espilonrt - 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
20namespace SpaIot {
21
26 class Button {
27
28 public:
32 Button ();
36 Button (const ButtonSettings & settings);
37
42 int id() const;
47 const ButtonController & ctrl() const;
52 ButtonController & ctrl();
57 const ButtonSettings & settings() const;
58
62 void begin();
66 void press();
70 void release();
74 void push();
79 bool isOpened() const;
84 bool isNull() const;
89 bool isPressed() const;
94 bool operator== (const Button &other) const;
99 bool operator!= (const Button &other) const;
100
101 private:
102 ButtonController * m_ctrl;
103 const ButtonSettings * m_settings;
104 };
105}
SpaIot name space.
Definition: bussettings.h:21