SpaIot Library
|
Multiplexer controlled by a PCF8574. More...
Public Member Functions | |
Pcf8574Mux (uint8_t slaveAddress=0x20, TwoWire &bus=Wire, uint8_t idleValue=0xFF) | |
Pcf8574Mux (const String &name, uint8_t slaveAddress=0x20, TwoWire &bus=Wire, uint8_t idleValue=0xFF) | |
Pcf8574Mux (const Pcf8574Mux &other) | |
Copy Constructor. (const ButtonController &other) More... | |
Pcf8574Mux & | operator= (const Pcf8574Mux &other) |
Assignment operator. (const ButtonController &other) More... | |
Pcf8574Mux (Pcf8574Mux &&other) | |
Copy Constructor. (ButtonController &&other) More... | |
Pcf8574Mux & | operator= (Pcf8574Mux &&other) |
Assignment operator. (const ButtonController &&other) More... | |
uint8_t | address () const |
Reading of the slave m_address of the integrated circuit. More... | |
virtual void | clear () |
Sets all attributes to their default values (same as the default constructor) | |
virtual bool | isEmpty () const |
Checks if all attributes are set to their default values (same as the default constructor) | |
virtual bool | operator== (const ButtonController &other) const |
Returns true if the two objects are equal. | |
virtual void | begin () |
Configures all ressources needed to use the object. | |
virtual void | end () |
Releases all ressources used by the object. | |
virtual int | select (int button) |
Selects a button. More... | |
virtual void | deselect () |
Deselects the button After the call to this function, isSelected() must return false, and selected() must return -1. | |
bool | isNull () const |
Returns true if the object is null (i.e. it has not been initialized, d_ptr is null) | |
virtual bool | operator!= (const ButtonController &other) const |
Returns true if the two objects are not equal. | |
virtual int | selected () const |
Returns the button number that is selected, or -1 if no button is selected. | |
virtual bool | isOpen () const |
Returns true if begin() has been successfully called. | |
virtual bool | isSelected () const |
Returns true if a button is selected. | |
virtual const String & | name () const |
Returns the name of the ButtonController object if it has been set, otherwise it returns an empty string. | |
Static Public Member Functions | |
static bool | addToRegister (const String &name, ButtonController &controller) |
Adds a ButtonController object to the register. More... | |
static ButtonController & | getFromRegister (const String &name) |
Returns a ButtonController object from the register. More... | |
static bool | registerContains (const String &name) |
Returns true if the register contains a ButtonController object with the given name. More... | |
Multiplexer controlled by a PCF8574.
This class implements a multiplexer for buttons that is controlled by a PCF8574. It is a concrete class, and can be instantiated. This class is copyable and movable.
SpaIot::Pcf8574Mux::Pcf8574Mux | ( | uint8_t | slaveAddress = 0x20 , |
TwoWire & | bus = Wire , |
||
uint8_t | idleValue = 0xFF |
||
) |
It creates a new Pcf8574Mux object.
slaveAddress | The address of the PCF8574 chip. |
bus | The TwoWire object that is used to communicate with the PCF8574. |
idleValue | The value that the pins will be set to when the device is not in use. |
SpaIot::Pcf8574Mux::Pcf8574Mux | ( | const String & | name, |
uint8_t | slaveAddress = 0x20 , |
||
TwoWire & | bus = Wire , |
||
uint8_t | idleValue = 0xFF |
||
) |
It creates a new Pcf8574Mux object.
name | controller name |
slaveAddress | The address of the PCF8574 chip. |
bus | The TwoWire object that is used to communicate with the PCF8574. |
idleValue | The value that the pins will be set to when the device is not in use. |
SpaIot::Pcf8574Mux::Pcf8574Mux | ( | const Pcf8574Mux & | other | ) |
Copy Constructor. (const ButtonController &other)
(const ButtonController &other)
SpaIot::Pcf8574Mux::Pcf8574Mux | ( | Pcf8574Mux && | other | ) |
Copy Constructor. (ButtonController &&other)
(ButtonController &&other)
uint8_t SpaIot::Pcf8574Mux::address | ( | ) | const |
Reading of the slave m_address of the integrated circuit.
|
staticinherited |
Adds a ButtonController object to the register.
name | The name of the ButtonController object that will be used to retrieve it from the register |
controller | The ButtonController object |
|
staticinherited |
Returns a ButtonController object from the register.
The user must call registerContains() before calling this function to check if the register contains a ButtonController object with the given name, otherwise an exception will be thrown std::out_of_range (and if exceptions are not enabled, the program will terminate)
name | The name of the ButtonController object that will be used to retrieve it from the register |
Pcf8574Mux& SpaIot::Pcf8574Mux::operator= | ( | const Pcf8574Mux & | other | ) |
Assignment operator. (const ButtonController &other)
(const ButtonController &other)
Pcf8574Mux& SpaIot::Pcf8574Mux::operator= | ( | Pcf8574Mux && | other | ) |
Assignment operator. (const ButtonController &&other)
(const ButtonController &&other)
|
staticinherited |
Returns true if the register contains a ButtonController object with the given name.
name | The name of the ButtonController object that will be used to retrieve it from the register |
|
virtual |
Selects a button.
button | the button to be selected |
Implements SpaIot::ButtonController.