ShiftRegGPIOXpander Library for ESP32 (Arduino) v2.0.0
A library that provides an easy mechanism to add GPIO digital output pins by using Shift Registers
Loading...
Searching...
No Matches
ShiftRegGPIOXpander_ESP32.h
Go to the documentation of this file.
1
42#ifndef _ShiftRegGPIOXpander_ESP32_H_
43#define _ShiftRegGPIOXpander_ESP32_H_
44
45#include <Arduino.h>
46#include <stdint.h>
47
56private:
57 uint8_t _ds{};
58 uint8_t _sh_cp{};
59 uint8_t _st_cp{};
60 uint8_t _srQty{};
61
62 uint8_t* _srArryBuffPtr{};
63 uint8_t* _auxArryBuffPtr{nullptr};
64 uint8_t _maxSrPin{0};
65
66 bool _sendSnglSRCntnt(uint8_t data); // Sends the content of a single byte to a Shift Register filling it's internal buffer, but it does not latch it (it does not set the output pins of the shfit register to the buffered value). The latching must be done by the calling party.
67public:
88 ShiftRegGPIOXpander(uint8_t ds, uint8_t sh_cp, uint8_t st_cp, uint8_t srQty = 1);
102 void begin(uint8_t* initCntnt = nullptr);
117 bool copyMainToAux(bool overWriteIfExists = true);
131 uint8_t digitalReadSr(const uint8_t &srPin);
138 void digitalWriteSr(const uint8_t srPin, const uint8_t value);
160 void digitalWriteSrMaskReset(uint8_t* newResetMask);
174 void digitalWriteSrMaskSet(uint8_t* newSetMask);
185 void digitalWriteSrToAux(const uint8_t srPin, const uint8_t value);
191 void discardAux();
199 uint8_t* getMainBuffPtr();
205 void end();
213 uint8_t getMaxPin();
221 uint8_t getSrQty();
234 bool moveAuxToMain(bool flushASAP = true);
248 bool sendAllSRCntnt();
263 bool stampOverMain(uint8_t* newCntntPtr);
264};
265
266#endif //ShiftRegGPIOXpander_ESP32_H_
bool stampOverMain(uint8_t *newCntntPtr)
Sets all of the output pins of the shift register to new provided values at once.
Definition ShiftRegGPIOXpander_ESP32.cpp:287
uint8_t getSrQty()
Return the quantity of shift registers composing the GPIOXtender object.
Definition ShiftRegGPIOXpander_ESP32.cpp:229
void digitalWriteSrMaskReset(uint8_t *newResetMask)
Modifies the Main buffer contents by resetting simultaneously certain pins.
Definition ShiftRegGPIOXpander_ESP32.cpp:159
bool moveAuxToMain(bool flushASAP=true)
Moves the data in the Auxiliary to the Main.
Definition ShiftRegGPIOXpander_ESP32.cpp:234
uint8_t getMaxPin()
Return the greatest valid pin number.
Definition ShiftRegGPIOXpander_ESP32.cpp:224
ShiftRegGPIOXpander()
Class default constructor.
Definition ShiftRegGPIOXpander_ESP32.cpp:43
void digitalWriteSrAllSet()
Sets all the pins to HIGH (0x01).
Definition ShiftRegGPIOXpander_ESP32.cpp:146
~ShiftRegGPIOXpander()
Class destructor.
Definition ShiftRegGPIOXpander_ESP32.cpp:53
void digitalWriteSrToAux(const uint8_t srPin, const uint8_t value)
Set a specific pin to either HIGH (0x01) or LOW (0x00) in the Auxiliary Buffer.
Definition ShiftRegGPIOXpander_ESP32.cpp:184
void begin(uint8_t *initCntnt=nullptr)
GPIOXpander object setup and activation.
Definition ShiftRegGPIOXpander_ESP32.cpp:65
uint8_t * getMainBuffPtr()
Retrieves the pointer to the Main Buffer.
Definition ShiftRegGPIOXpander_ESP32.cpp:219
void digitalWriteSrAllReset()
Sets all the pins to LOW (0x00).
Definition ShiftRegGPIOXpander_ESP32.cpp:133
void digitalWriteSrMaskSet(uint8_t *newSetMask)
Modifies the Main buffer contents by setting simultaneously certain pins.
Definition ShiftRegGPIOXpander_ESP32.cpp:171
void digitalWriteSr(const uint8_t srPin, const uint8_t value)
Set a specific pin to either HIGH (0x01) or LOW (0x00).
Definition ShiftRegGPIOXpander_ESP32.cpp:115
void discardAux()
Deletes the Auxiliary Buffer.
Definition ShiftRegGPIOXpander_ESP32.cpp:201
bool sendAllSRCntnt()
Flushes the contents of the Buffer to the GPIO Expander pins.
Definition ShiftRegGPIOXpander_ESP32.cpp:250
bool copyMainToAux(bool overWriteIfExists=true)
Copies the Buffer content to the Auxiliary Buffer.
Definition ShiftRegGPIOXpander_ESP32.cpp:84
uint8_t digitalReadSr(const uint8_t &srPin)
Returns the state of the requested pin.
Definition ShiftRegGPIOXpander_ESP32.cpp:100
void end()
Method provided for ending any relevant activation procedures made by the begin(uint8_t*) method.
Definition ShiftRegGPIOXpander_ESP32.cpp:214