SpaIot Library
SpaIot::BusSettings

SPI 2840X Bus settings. More...

#include <bussettings.h>

Public Member Functions

 BusSettings (const int dataPin, const int clkPin, const int holdPin)
 
 BusSettings (const std::initializer_list< int > &pins)
 
 BusSettings ()
 
int dataPin () const
 
int clkPin () const
 
int holdPin () const
 
bool isNull () const
 
bool operator== (const BusSettings &other) const
 
bool operator!= (const BusSettings &other) const
 
void setDataPin (int pin)
 
void setClkPin (int pin)
 
void setHoldPin (int pin)
 

Detailed Description

SPI 2840X Bus settings.

Constructor & Destructor Documentation

◆ BusSettings() [1/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() [2/3]

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

The constructor takes a list of pins and stores them in the member variable m_pin

Parameters
pinsA list of pins to use for the bus.

◆ BusSettings() [3/3]

SpaIot::BusSettings::BusSettings ( )

The default constructor creates a BusSettings object and initializes the m_pin member to (3, -1)

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.

◆ isNull()

bool SpaIot::BusSettings::isNull ( ) const

This function returns true if any of the pins are set to -1

Returns
The return value is a boolean.

◆ 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.