SpaIot Library
SpaIot::BusSettings

SPI 2840X Bus settings. More...

Public Member Functions

 BusSettings ()
 
virtual ~BusSettings ()
 Destructor.
 
 BusSettings (const int dataPin, const int clkPin, const int holdPin)
 
 BusSettings (const std::initializer_list< int > &pins)
 
 BusSettings (const BusSettings &other)
 Copy Constructor.
 
 BusSettings (BusSettings &&other)
 Move Constructor after the move, other is null, other.clear() must be called if it is to be used again.
 
BusSettingsoperator= (const BusSettings &other)
 Sets the BusSettings object to be equal to other.
 
BusSettingsoperator= (BusSettings &&other)
 Move assignment after the move, other is null, other.clear() must be called if it is to be used again.
 
void clear ()
 Clears the BusSettings object After the call to this function, the BusSettings object is the same as one that has been default constructed.
 
bool isNull () const
 Returns true if the object is null (i.e. it has not been initialized, d_ptr is null)
 
bool isEmpty () const
 Checks if all attributes are set to their default values (same as the default constructor)
 
bool operator== (const BusSettings &other) const
 
bool operator!= (const BusSettings &other) const
 
int dataPin () const
 
int clkPin () const
 
int holdPin () const
 
void setDataPin (int pin)
 
void setClkPin (int pin)
 
void setHoldPin (int pin)
 

Detailed Description

SPI 2840X Bus settings.

This class represents the settings of a SPI 2840X Bus. It is a concrete class, and can be instantiated. This class is copyable and movable.

Constructor & Destructor Documentation

◆ BusSettings() [1/3]

SpaIot::BusSettings::BusSettings ( )

The default constructor creates a BusSettings object and initializes the pin vector to {-1, -1, -1}

◆ BusSettings() [2/3]

SpaIot::BusSettings::BusSettings ( const int  dataPin,
const int  clkPin,
const int  holdPin 
)

The constructor for the BusSettings class takes three parameters, and stores them in the private member variables

Parameters
dataPinThe pin number of the data pin of the MCP23017 chip.
clkPinThe pin number of the clock pin.
holdPinThe pin that is used to hold the data line high.

◆ BusSettings() [3/3]

SpaIot::BusSettings::BusSettings ( const std::initializer_list< int > &  pins)

The constructor takes a list of pins

The list of pins must be exactly 3 pins, and the pins must be in the order { dataPin, clkPin, holdPin } If the list is not exactly 3 pins, the comportment is undefined.

Parameters
pinsA list of 3 pins to use for the bus.

Member Function Documentation

◆ clkPin()

int SpaIot::BusSettings::clkPin ( ) const

This function returns the clock pin number

Returns
The pin number of the GPIO pin that the bus is connected to.

◆ dataPin()

int SpaIot::BusSettings::dataPin ( ) const

This function returns the data pin number

Returns
The pin number of the GPIO pin that the bus is connected to.

◆ holdPin()

int SpaIot::BusSettings::holdPin ( ) const

This function returns the pin number of the hold pin

Returns
The pin number of the GPIO pin that the bus is connected to.

◆ operator!=()

bool SpaIot::BusSettings::operator!= ( const BusSettings other) const

The function returns true if the two objects are not equal

Parameters
otherthe other BusSettings object to compare to
Returns
The return value is a boolean value. It is true if the two objects are not equal, and false if they are equal.

◆ operator==()

bool SpaIot::BusSettings::operator== ( const BusSettings other) const

The function returns true if the two objects are equal

Parameters
otherthe other BusSettings object to compare to
Returns
The return value is a boolean value. It is true if the two objects are equal, and false if they are not equal.

◆ setClkPin()

void SpaIot::BusSettings::setClkPin ( int  pin)

Set the clock pin to the given value.

Parameters
pinThe pin number of the GPIO pin that the bus is connected to.

◆ setDataPin()

void SpaIot::BusSettings::setDataPin ( int  pin)

Set the data pin to the given value.

Parameters
pinThe pin number of the GPIO pin that the bus is connected to.

◆ setHoldPin()

void SpaIot::BusSettings::setHoldPin ( int  pin)

Set the pin number for the hold pin.

Parameters
pinThe pin number of the GPIO pin that the bus is connected to.