SpaIot Library
|
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. | |
BusSettings & | operator= (const BusSettings &other) |
Sets the BusSettings object to be equal to other. | |
BusSettings & | operator= (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) |
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.
SpaIot::BusSettings::BusSettings | ( | ) |
The default constructor creates a BusSettings object and initializes the pin vector to {-1, -1, -1}
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
dataPin | The pin number of the data pin of the MCP23017 chip. |
clkPin | The pin number of the clock pin. |
holdPin | The pin that is used to hold the data line high. |
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.
pins | A list of 3 pins to use for the bus. |
int SpaIot::BusSettings::clkPin | ( | ) | const |
This function returns the clock pin number
int SpaIot::BusSettings::dataPin | ( | ) | const |
This function returns the data pin number
int SpaIot::BusSettings::holdPin | ( | ) | const |
This function returns the pin number of the hold pin
bool SpaIot::BusSettings::operator!= | ( | const BusSettings & | other | ) | const |
The function returns true if the two objects are not equal
other | the other BusSettings object to compare to |
bool SpaIot::BusSettings::operator== | ( | const BusSettings & | other | ) | const |
The function returns true if the two objects are equal
other | the other BusSettings object to compare to |
void SpaIot::BusSettings::setClkPin | ( | int | pin | ) |
Set the clock pin to the given value.
pin | The pin number of the GPIO pin that the bus is connected to. |
void SpaIot::BusSettings::setDataPin | ( | int | pin | ) |
Set the data pin to the given value.
pin | The pin number of the GPIO pin that the bus is connected to. |
void SpaIot::BusSettings::setHoldPin | ( | int | pin | ) |
Set the pin number for the hold pin.
pin | The pin number of the GPIO pin that the bus is connected to. |