SpaIot Library
SpaIot::Pcf8574Mux

Multiplexer controlled by a PCF8574. More...

#include <pcf8574mux.h>

Inherits SpaIot::ButtonController.

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)
 
virtual void begin ()
 
virtual void end ()
 It close the PCF8574 chip.
 
virtual int select (int button)
 
virtual void deselect ()
 
virtual bool isNull () const
 
virtual bool operator== (const ButtonController &other) const
 
virtual int selected () const
 
virtual bool isOpened () const
 
virtual bool isSelected () const
 
virtual const String & name () const
 
virtual bool operator!= (const ButtonController &other) const
 

Static Public Member Functions

static bool addToRegister (const String &name, ButtonController &controller)
 
static ButtonController & getFromRegister (const String &name)
 
static bool registerContains (const String &name)
 

Detailed Description

Multiplexer controlled by a PCF8574.

Inheriting from the ButtonController class.

Constructor & Destructor Documentation

◆ Pcf8574Mux() [1/2]

SpaIot::Pcf8574Mux::Pcf8574Mux ( uint8_t  slaveAddress = 0x20,
TwoWire &  bus = Wire,
uint8_t  idleValue = 0xFF 
)

It creates a new Pcf8574Mux object.

Parameters
slaveAddressThe address of the PCF8574 chip.
busThe TwoWire object that is used to communicate with the PCF8574.
idleValueThe value that the pins will be set to when the device is not in use.

◆ Pcf8574Mux() [2/2]

SpaIot::Pcf8574Mux::Pcf8574Mux ( const String &  name,
uint8_t  slaveAddress = 0x20,
TwoWire &  bus = Wire,
uint8_t  idleValue = 0xFF 
)

It creates a new Pcf8574Mux object.

Parameters
namecontroller name
slaveAddressThe address of the PCF8574 chip.
busThe TwoWire object that is used to communicate with the PCF8574.
idleValueThe value that the pins will be set to when the device is not in use.

Member Function Documentation

◆ addToRegister()

static bool SpaIot::ButtonController::addToRegister ( const String &  name,
ButtonController &  controller 
)
staticinherited
Parameters
name
controller
Returns

◆ begin()

virtual void SpaIot::Pcf8574Mux::begin ( )
virtual

It opens the PCF8574 chip.

◆ deselect()

virtual void SpaIot::Pcf8574Mux::deselect ( )
virtual

It deselects the mux.

◆ getFromRegister()

static ButtonController & SpaIot::ButtonController::getFromRegister ( const String &  name)
staticinherited
Parameters
name
Returns

◆ isNull()

virtual bool SpaIot::Pcf8574Mux::isNull ( ) const
virtual

This function returns true if the object is a null pointer

Returns
The return value is a boolean value. The return value is true if the device is null, and false if the device is not null.

◆ isOpened()

virtual bool SpaIot::ButtonController::isOpened ( ) const
virtualinherited
Returns

◆ isSelected()

virtual bool SpaIot::ButtonController::isSelected ( ) const
virtualinherited
Returns

◆ name()

virtual const String & SpaIot::ButtonController::name ( ) const
virtualinherited
Returns

◆ operator!=()

virtual bool SpaIot::ButtonController::operator!= ( const ButtonController &  other) const
virtualinherited
Parameters
other

◆ operator==()

virtual bool SpaIot::Pcf8574Mux::operator== ( const ButtonController &  other) const
virtual

This function is called when the ButtonController is compared to another ButtonController

Parameters
otherThe ButtonController to compare against.
Returns
true if equal

◆ registerContains()

static bool SpaIot::ButtonController::registerContains ( const String &  name)
staticinherited
Parameters
name
Returns

◆ select()

virtual int SpaIot::Pcf8574Mux::select ( int  button)
virtual

It writes the value of the button to the PCF8574 chip.

Parameters
buttonthe button to be selected.
Returns
the value return by selected()

◆ selected()

virtual int SpaIot::ButtonController::selected ( ) const
virtualinherited
Returns