SpaIot Library
Loading...
Searching...
No Matches
multiplexer.h
1/*
2 SpaIot Library (c) by epsilonrt - epsilonrt@epsilonrt.fr
3 This file is part of SpaIot library <https://github.com/epsilonrt/spaiot-lib>
4
5 SPDX-License-Identifier: BSD-3-Clause
6
7 SpaIot library is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY;
9*/
10#pragma once
11
12#include <initializer_list>
13#include "buttoncontroller.h"
14
15namespace SpaIot {
16
32 public:
33
34 enum {
35 A = 0,
36 B,
37 C,
38 D,
39 E,
40 F,
41 G,
42 H
43 };
44
56 Multiplexer (const std::initializer_list<int> &spins, int inhPin);
57
70 Multiplexer (const String &name, const std::initializer_list<int> &spins, int inhPin);
71
78
82 Multiplexer (const Multiplexer &other);
83
88
93
98
105 int selectPin (int order) const;
106
113 void setSelectPin (int order, int pin);
114
118 int inhPin() const;
119
123 void setInhPin (int pin);
124
130 int size() const;
131
132 // re-implemented methods from ButtonController
133 virtual void clear();
134 virtual bool isEmpty() const;
135 virtual bool operator== (const ButtonController &other) const;
136 virtual void begin();
137 virtual void end();
138 virtual int select (int button);
139 virtual void deselect ();
140
141 protected:
142 class Private;
143 Multiplexer (Private &dd);
144 private:
145 PIMPL_DECLARE_PRIVATE (Multiplexer)
146 };
147
166 extern Multiplexer Scip2MuxA;
167
180 extern Multiplexer Scip2MuxB;
181
195
209
223
237
251
266
269}
This class is the base class of all button controllers.
Definition buttoncontroller.h:26
virtual const String & name() const
Returns the name of the ButtonController object if it has been set, otherwise it returns an empty str...
Analog multiplexer for buttons.
Definition multiplexer.h:31
Multiplexer()
Default constructor.
virtual bool operator==(const ButtonController &other) const
Returns true if the two objects are equal.
virtual void end()
Releases all ressources used by the object.
int size() const
Returns the number of multiplexer channels that are available.
virtual bool isEmpty() const
Checks if all attributes are set to their default values (same as the default constructor)
@ F
Definition multiplexer.h:40
@ D
Definition multiplexer.h:38
@ A
Definition multiplexer.h:35
@ C
Definition multiplexer.h:37
@ B
Definition multiplexer.h:36
@ E
Definition multiplexer.h:39
@ G
Definition multiplexer.h:41
@ H
Definition multiplexer.h:42
void setSelectPin(int order, int pin)
It sets the pin number for the select pin of the given order.
int selectPin(int order) const
Given a order, return the corresponding value.
Multiplexer(const Multiplexer &other)
Copy Constructor. (const ButtonController &other)
virtual void deselect()
Deselects the button After the call to this function, isSelected() must return false,...
virtual void begin()
Configures all ressources needed to use the object.
Multiplexer(const std::initializer_list< int > &spins, int inhPin)
Constructor.
Multiplexer(Multiplexer &&other)
Copy Constructor. (ButtonController &&other)
void setInhPin(int pin)
Set the pin number of the inhibit pin.
virtual int select(int button)
Selects a button.
int inhPin() const
Get the pin number of the inhibit pin.
Multiplexer & operator=(const Multiplexer &other)
Assignment operator. (const ButtonController &other)
Multiplexer(const String &name, const std::initializer_list< int > &spins, int inhPin)
Constructor with name.
virtual void clear()
Sets all attributes to their default values (same as the default constructor)
Multiplexer SpaIot8266MuxB
The second multiplexer for the SpaIot controller (ESP8266 version)
Multiplexer SpaIot32MuxB
The second multiplexer for the SpaIot controller (ESP32 version)
Multiplexer Scip2MuxA
The first multiplexer for the Scip2 controller.
Multiplexer SpaIotS3MuxB
The second multiplexer for the SpaIot controller (ESP32S3 version)
Multiplexer SpaIot8266MuxA
The first multiplexer for the SpaIot controller (ESP8266 version)
Multiplexer SpaIot32MuxA
The first multiplexer for the SpaIot controller (ESP32 version)
Multiplexer Scip2MuxB
The second multiplexer for the Scip2 controller.
Multiplexer SpaIotS3MuxA
The first multiplexer for the SpaIot controller (ESP32S3 version)
SpaIot name space.
Definition bussettings.h:15