Seven Segments Displays Agnostic Library for ESP32 (Arduino) v3.3.0
A library that provides a class that models a Seven Segment Display and provides an unified API through it's members independently of the display technology.
|
Models a dynamic display with no screen, for tests or remote display of the data. More...
#include <SevenSegDispHw.h>
Public Member Functions | |
SevenSegDynDummy (uint8_t dspDigits=4, bool commAnode=true) | |
Class constructor, instantiates a SevenSegDynDummy object. | |
virtual | ~SevenSegDynDummy () |
Class destructor. | |
bool | begin (uint32_t updtLps=0) |
Sets up the required resources for the "dummy hardware display" to work. | |
bool | end () |
Stops the active display updating. | |
virtual void | turnOff () |
Turns the display module off. | |
virtual void | turnOn () |
Turns the display module on. | |
Public Member Functions inherited from SevenSegDispHw | |
SevenSegDispHw () | |
Default class constructor. | |
SevenSegDispHw (uint8_t *ioPins, uint8_t dspDigits=4, bool commAnode=true, uint8_t dspDigitsQtyMax=0) | |
Class constructor. | |
virtual | ~SevenSegDispHw () |
Class destructor. | |
virtual uint8_t | getBrghtnssLvl () |
Returns the current display brightness level setting for the display. | |
virtual uint8_t | getBrghtnssMaxLvl () |
Returns the maximum display brightness level setting allowed for the display. | |
virtual uint8_t | getBrghtnssMinLvl () |
Returns the minimum display brightness level setting for the display. | |
bool | getCommAnode () |
Returns a value indicating if the display module component of the display hardware uses a common anode or a common cathode led wiring. | |
uint8_t * | getDspBuffPtr () |
Returns a pointer to the display buffer. | |
uint8_t | getHwDspDigitsQty () |
Returns the quantity of digits of the display module. | |
virtual bool | getIsOn () |
Returns the state of the display. | |
uint8_t * | getxcdDspBuffPtr () |
Returns a pointer to an array holding the contents for the digits/ports available from the display controller but not used for plain digits display. | |
virtual void | ntfyUpdDsply () |
Notifies the SevenSegDispHw component object of a change of content available in the display buffer, so that the object proceeds to update the display. | |
virtual bool | setBrghtnssLvl (const uint8_t &newBrghtnssLvl) |
Sets the brightness level for the display. | |
virtual bool | setDigitsOrder (uint8_t *newOrderPtr) |
Sets a mapping to relate the display buffer positions to the display port assigned to exhibit it's contents. | |
void | setDspBuffPtr (uint8_t *newDspBuffPtr) |
Sets the pointer to the Display Buffer memory area. | |
virtual void | turnOn (const uint8_t &newBrghtnssLvl) |
Turns the display module on set at the provided brightness level. |
Additional Inherited Members | |
Protected Attributes inherited from SevenSegDispHw | |
uint8_t | _allLedsOff {} |
Value to set in the display port to set all leds off (a "space"), dependent of _commAnode. | |
uint8_t | _brghtnssLvl {0} |
Current display brightness level. | |
uint8_t | _brghtnssLvlMax {0} |
Maximum display brightness level. | |
uint8_t | _brghtnssLvlMin {0} |
Minimum display brightness level. | |
uint8_t * | _dspBlankBuffPtr {nullptr} |
Pointer to a display buffer filled with _allLedsOff ("spaces") to use as display buffer while in "Off State". | |
uint8_t * | _dspBuffPtr {nullptr} |
Pointer to the display buffer, will be provided by the SevenSegDisplays object when it's instantiated. | |
uint8_t * | _dspBuffPtrBkp {nullptr} |
Pointer to the display buffer, copy of the original _dspBuffPtr to be used as backup. | |
bool | _isOn {false} |
Current display status: On/Off. | |
uint8_t * | _xcdDspBuffPtr {nullptr} |
A pointer to a buffer the size of the exceeding digits used to control display specific amenities. | |
uint8_t | _xcdDspDigitsQty {} |
Number of unused available display ports, its the difference (_dspDigitsQtyMax - _dspDigitsQty), being the size of the array pointed by _xcdDspBuffPtr. |
Models a dynamic display with no screen, for tests or remote display of the data.
The objects instantiated are usefull for development of code expecting to use a dynamic display while the precise hardware to be used in production is not defined. This is done by sending the data through the MCU UART port, making possible the implementation without depending of a physical display. The refresh rate is a parameter of the begin(uint32_t) method, so that it can be adjusted to a reasonable speed, either to reading it in real-time, either to send it to storage.
For each periodic "display refresh" event a message will be transmitted through the UART, including:
SevenSegDynDummy::SevenSegDynDummy | ( | uint8_t | dspDigits = 4, |
bool | commAnode = true ) |
Class constructor, instantiates a SevenSegDynDummy object.
dspDigits | Quantity of digits/ports of the display. As this is a software only "display" the value is just limited by the parameter type to 256 digits. |
commAnode | Boolean indicating if the hardware display/s module/s being simulated are supposed to be wired as common anode (true) or common cathode (false). |
|
virtual |
Sets up the required resources for the "dummy hardware display" to work.
For the Seven Segments Dynamic Dummy displays to work several procedures must be completed by this method, specially to ensure a behaviour as close to a hardware dynamic display.
Attaches the display to the O.S. software timer service, which takes care of refreshing the display regularly. An unlimited amount of displays might be attached to the timer theoretically, as long as there's enough resources available for them, but in practice the refreshing work takes time, and the time taken is proportional to the quantity of displays attached. And as Timers consume time for other tasks done by the microcontroller, the time taken by the timers must be kept to minimal or the stability of the whole system will be compromised. As the time available to execute the refreshing time without risking the stability of the system depends on various factors, the number of supported displays has to be tested in each development environment at development time.
true | The display could be attached to the software timer service, or if the display was already attached to it. This not ensures system stability. |
false | the display couldn't be attached to the software timer service, due to O.S. failure. |
updtLps | (Optional) Time lapse given in milliseconds for the "display refresh" task to be executed. If no value is provided a time of 2000 milliseconds (2 seconds) will be used. |
Reimplemented from SevenSegDynamic.
|
virtual |
Stops the active display updating.
See SevenSegDynHC595::end() for details.
Reimplemented from SevenSegDynamic.
|
virtual |
Turns the display module off.
The display module will be cleared and will keep that status until a turnOn(), or turnOn(const uint8_t &) is invoked.
Reimplemented from SevenSegDispHw.
|
virtual |
Turns the display module on.
The display module will be turned on, making visible the contents of the display buffer. For more information see turnOff() method.
Reimplemented from SevenSegDispHw.