SpaIot Library
cd4051.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 <vector>
17#include <string>
18#include <initializer_list>
19#include "buttoncontroller.h"
20
21namespace SpaIot {
22
27 class Cd4051 : public ButtonController {
28 public:
29 enum { S0 = 0, S1, S2, En };
30
34 Cd4051 ();
35 Cd4051 (const std::initializer_list<int>& pins);
36 Cd4051 (int s0Pin, int s1Pin, int s2Pin, int enPin);
37
38 int pin (int key) const;
39 void setPin (int key, int pin);
40
41 void begin();
42 int select (int button);
43 void deselect ();
44 bool isNull() const;
45 virtual bool operator== (const ButtonController &other) const;
46
47 private:
48 std::vector<int> m_pin;
49 };
50
51 extern Cd4051 Scip1Ctrl;
52 extern Cd4051 Scip2CtrlA;
53 extern Cd4051 Scip2CtrlB;
54}
SpaIot name space.
Definition: bussettings.h:21