Seven Segments Displays Agnostic Library for ESP32 (Arduino) v3.1.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.

Loading...
Searching...
No Matches
Public Member Functions | List of all members
SevenSegDynDummy Class Reference

Models a dynamic display with no screen, for tests or remote display of the data.
More...

`#include <sevenSegDispHw.h>`

Inheritance diagram for SevenSegDynDummy:
[legend]
Collaboration diagram for SevenSegDynDummy:
[legend]

## 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 SevenSegDynamic
Public Member Functions inherited from SevenSegDispHw
| SevenSegDispHw ()
| Default class constructor.
| SevenSegDispHw (uint8_t *ioPins, uint8_t dspDigits=4, bool commAnode=true)
| 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.
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.
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 Member Functions inherited from SevenSegDynamic
Protected Member Functions inherited from SevenSegDispHw
Protected Attributes inherited from SevenSegDynamic
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.

## Detailed Description

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:

- A time stamp
- The content of each port indicating:
  - The port position as a decimal
  - The content for that position as a hexadecimal value.

## Constructor & Destructor Documentation

## ◆ SevenSegDynDummy()

SevenSegDynDummy::SevenSegDynDummy | ( | uint8_t | dspDigits = 4,
|  | bool | commAnode = true )

Class constructor, instantiates a SevenSegDynDummy object.

Parameters

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

## Member Function Documentation

## ◆ begin()

bool SevenSegDynDummy::begin | ( | uint32_t | updtLps = 0 | ) |
| 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.

Return values

  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.

Parameters

  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.

Returns
  true
  false

Reimplemented from SevenSegDynamic.

Here is the call graph for this function:

## ◆ end()

bool SevenSegDynDummy::end | ( |  | ) |
| virtual

Stops the active display updating.

See SevenSegDynHC595::end() for details.

Reimplemented from SevenSegDynamic.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ turnOff()

void SevenSegDynDummy::turnOff | ( |  | ) |
| 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.

Note
  Turning the display Off is not the same as clearing the display -see clear() method- as clearing the display implies changing the display data buffer content to fill it with spaces, while turning it off implies keeping the display data buffer updated, while showing the display leds turned off. Some of the display modules managed by display controllers have the hability to turn off the leds display while keeping it's buffer contents unmodified. So turning On/Off those displays will have the effect of holding the data displayed and even receiving and filling their buffer with updated data while keeping their display with no leds turned on.

Todo
  For the seven segment displays without controller components to implement On and Off commands, the class will provide a propietary solution to achieve similar features. While there are not implemented the turnOff(), turnOn() and turnOn(const uint8_t &) will be ignored and will produce no effect in the object behavior.

Reimplemented from SevenSegDispHw.

Here is the call graph for this function:

## ◆ turnOn()

void SevenSegDynDummy::turnOn | ( |  | ) |
| 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.

Here is the call graph for this function:
Here is the caller graph for this function: