51#ifndef _SevenSegDisplays_ESP32_H_
52#define _SevenSegDisplays_ESP32_H_
58class SevenSegDisplays {
59 static uint8_t _displaysCount;
60 static uint16_t _dspLastSerialNum;
61 static SevenSegDisplays** _ssdInstancesLstPtr;
63 static TimerHandle_t _blinkTmrHndl;
64 static TimerHandle_t _waitTmrHndl;
66 static void tmrCbBlink(TimerHandle_t blinkTmrCbArg);
67 static void tmrCbWait(TimerHandle_t waitTmrCbArg);
69 static const uint32_t _minBlinkRate{100};
70 static const uint32_t _maxBlinkRate{2000};
74 bool _isWaiting {
false};
75 uint8_t _waitChar {0xBF};
76 uint8_t _waitCount {0};
77 uint32_t _waitRate {250};
78 uint32_t _waitTimer {0};
81 bool* _blinkMaskPtr{
nullptr};
82 uint8_t* _dspAuxBuffPtr{
nullptr};
83 uint8_t* _dspBuffPtr{
nullptr};
84 uint8_t _dspDigitsQty{};
86 SevenSegDisplays* _dspInstance{
nullptr};
87 uint16_t _dspSerialNbr{0};
90 bool _dspUndrlHwCommAnode{};
92 bool _isBlinking{
false};
93 bool _blinkShowOn{
false};
94 uint32_t _blinkTimer{0};
95 uint32_t _blinkOffRate{500};
96 uint32_t _blinkOnRate{500};
97 uint32_t _blinkRatesGCD{500};
98 String _charSet{
"0123456789AabCcdEeFGHhIiJLlnOoPqrStUuY-_=~* ."};
99 uint8_t _charLeds[45] = {
147 uint8_t _space {0xFF};
149 String _zeroPadding{
""};
150 String _spacePadding{
""};
152 uint32_t _blinkTmrGCD(uint32_t blnkOnTm, uint32_t blnkOffTm);
153 void _ntfyToHwBuffChng();
154 void _popSsd(SevenSegDisplays** &ssdInstncObjLst, SevenSegDisplays* ssdToPop);
155 void _pushSsd(SevenSegDisplays** &ssdInstncObjLst, SevenSegDisplays* ssdToPush);
156 void _restoreDspBuff();
158 void _setDspBuffChng();
160 void _updBlinkState();
161 void _updWaitState();
229 virtual bool begin(uint32_t updtLps = 0);
275 bool blink(
const uint32_t &onRate,
const uint32_t &offRate = 0);
325 bool doubleGauge(
const int &levelLeft,
const int &levelRight,
char labelLeft =
' ',
char labelRight =
' ');
367 bool gauge(
const int &level,
char label =
' ');
410 bool gauge(
const double &level,
char label =
' ');
664 bool print(String text);
686 bool print(
const int32_t &value,
bool rgtAlgn =
false,
bool zeroPad =
false);
712 bool print(
const double &value,
const unsigned int &decPlaces,
bool rgtAlgn =
false,
bool zeroPad =
false);
769 bool setBlinkRate(
const uint32_t &newOnRate,
const uint32_t &newOffRate = 0);
836 void turnOn(
const uint8_t &newBrghtnssLvl);
868 bool wait(
const uint32_t &newWaitRate);
885 bool write(
const uint8_t &segments,
const uint8_t &port);
902 bool write(
const String &character,
const uint8_t &port);
Header file for the SevenSegDisplays_ESP32 library, SevenSegDispHw class and subclasses.
Base abstract class models a generic Seven Segment display hardware.
Definition SevenSegDispHw.h:61
uint16_t getSerialNbr()
Returns a unique numeric identification of the object.
Definition SevenSegDisplays.cpp:395
uint8_t getDigitsQty()
Return the number of digits of the display hardware.
Definition SevenSegDisplays.cpp:350
int32_t getDspValMin()
Returns a value equivalent to the smallest displayable number for the display.
Definition SevenSegDisplays.cpp:380
uint8_t getMinBrghtnssLvl()
Returns the minimum brightness value setting for the display.
Definition SevenSegDisplays.cpp:390
uint32_t getMinBlinkRate()
Returns the minimum rate the display can be configured to blink at.
Definition SevenSegDisplays.cpp:405
void turnOff()
Turns the display module off.
Definition SevenSegDisplays.cpp:899
bool setBrghtnssLvl(const uint8_t &newBrghtnssLvl)
Set the brightness level for the display.
Definition SevenSegDisplays.cpp:827
bool noWait()
Stops the Waiting mode, if it was doing so, leaving the display turned on.
Definition SevenSegDisplays.cpp:458
bool setWaitRate(const uint32_t &newWaitRate)
Changes the timing parameter used to show the "progress ongoing bar advancement" speed.
Definition SevenSegDisplays.cpp:860
bool getDspIsDmmbl()
Returns the logic value indicating if the display is dimmable.
Definition SevenSegDisplays.cpp:360
bool blink()
Makes the display blink the contents it is showing.
Definition SevenSegDisplays.cpp:103
bool isBlinking()
Returns a boolean value indicating if the display is set to blink or not.
Definition SevenSegDisplays.cpp:423
void clear()
Clears the display, turning off all the segments and dots.
Definition SevenSegDisplays.cpp:201
bool getIsOn()
Returns a logic value indicating if the display is in On state.
Definition SevenSegDisplays.cpp:365
bool isWaiting()
Returns a boolean value indicating if the display is set to "waiting mode" or not.
Definition SevenSegDisplays.cpp:428
void resetBlinkMask()
Resets the blinking mask.
Definition SevenSegDisplays.cpp:710
uint8_t getDspCount()
Returns the quantity of instantiated SevenSegDisplays class objects at invocation moment.
Definition SevenSegDisplays.cpp:355
bool setWaitChar(const char &newChar)
Sets the "Waiting" character.
Definition SevenSegDisplays.cpp:842
bool isBlank()
Returns a value indicating if the display is blank.
Definition SevenSegDisplays.cpp:410
bool noBlink()
Stops the display blinking, if it was doing so, leaving the display turned on.
Definition SevenSegDisplays.cpp:433
bool gauge(const int &level, char label=' ')
Displays a basic graphical representation of the level of fulfillment or completeness of a segmented ...
Definition SevenSegDisplays.cpp:297
uint8_t getCurBrghtnssLvl()
Returns the current brightness level of the display.
Definition SevenSegDisplays.cpp:345
bool end()
Ends the activity of the display.
Definition SevenSegDisplays.cpp:283
bool doubleGauge(const int &levelLeft, const int &levelRight, char labelLeft=' ', char labelRight=' ')
Displays a basic graphical representation of the level of fulfillment or completeness of two segmente...
Definition SevenSegDisplays.cpp:226
void turnOn()
Turns the display module on.
Definition SevenSegDisplays.cpp:905
bool setBlinkRate(const uint32_t &newOnRate, const uint32_t &newOffRate=0)
Changes the time parameters to use for the display blinking of the contents it shows.
Definition SevenSegDisplays.cpp:786
~SevenSegDisplays()
Class destructor.
Definition SevenSegDisplays.cpp:54
bool write(const uint8_t &segments, const uint8_t &port)
Prints one character to the display, at a designated position (digit or port), without affecting the ...
Definition SevenSegDisplays.cpp:1062
uint8_t getMaxBrghtnssLvl()
Returns the maximum brightness value setting for the display.
Definition SevenSegDisplays.cpp:385
virtual bool begin(uint32_t updtLps=0)
Sets up the hardware display to work, and starts the display activities.
Definition SevenSegDisplays.cpp:89
uint32_t getMaxBlinkRate()
Returns the maximum rate the display can be configured to blink at.
Definition SevenSegDisplays.cpp:400
int32_t getDspValMax()
Returns a value equivalent to the greatest displayable number for the display.
Definition SevenSegDisplays.cpp:375
bool print(String text)
Displays a text string.
Definition SevenSegDisplays.cpp:566
void setBlinkMask(const bool *newBlnkMsk)
Sets a new blinking mask for the display.
Definition SevenSegDisplays.cpp:776
bool wait()
Makes the display enter the "Waiting mode".
Definition SevenSegDisplays.cpp:984
SevenSegDispHw * getDspUndrlHwPtr()
Returns a pointer to the underlying hardware display object.
Definition SevenSegDisplays.cpp:370