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

Models seven segment displays driven by two 74HC595 shift registers. More...

`#include <SevenSegDispHw.h>`

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

## Public Member Functions
| SevenSegDynHC595 (uint8_t *ioPins, uint8_t dspDigits, bool commAnode)
| Class constructor.
virtual | ~SevenSegDynHC595 ()
| Class destructor.
virtual bool | begin (uint32_t updtLps=0)
| Sets up the required resources for the hardware display to work.
bool | end ()
| Stops the active display updating.
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 | turnOff ()
| Turns the display module off.
virtual void | turnOn ()
| Turns the display module on.
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.

## Detailed Description

Models seven segment displays driven by two 74HC595 shift registers.

The display is wired so that one shift register holds the active segments of the display digit, so it is connected in parallel to every digit segment, to the activation pin of the same segment in each one, and the second shift register holds the active digit enabled, so it's pins are connected independently to each digit, selecting which will be active at any given moment. As detailed in the SevenSegDynamic abstract class, this wiring arrange requires the display to be refreshed periodically to generate a cinematic effect or animation showing the full contents of all the digits at the same time, while the hardware is capable of lightning on just one at a time. This cinematic effect is also managed by the library.

## Constructor & Destructor Documentation

## ◆ SevenSegDynHC595()

SevenSegDynHC595::SevenSegDynHC595 | ( | uint8_t * | ioPins,
|  | uint8_t | dspDigits,
|  | bool | commAnode )

Class constructor.

Parameters

  ioPins | A pointer to an array holding the identifiers for the 3 GPIO pins required to send the data to be displayed. The correlation between the array positions and the pin function is given as in-class defined constants: 0->sclk, 1->rclk, 2->dio
  dspDigits | Quantity of digits/ports of the display. This class supports the wiring scheme allowing a maximum of 8 digits.
  commAnode | Boolean indicating if the hardware uses display module component wired as common anode (true) or common cathode (false).

## Member Function Documentation

## ◆ begin()

bool SevenSegDynHC595::begin | ( | uint32_t | updtLps = 0 | ) |
| virtual

Sets up the required resources for the hardware display to work.

For the Seven Segments Dynamic 74HC595 displays to work several procedures must be completed by this method.

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.

Use example:

myLedDisp.begin();

Reimplemented from SevenSegDynamic.

Here is the call graph for this function:

## ◆ end()

bool SevenSegDynHC595::end | ( |  | ) |
| virtual

Stops the active display updating.

Stops the display Timer Service which takes care of refreshing the display regularly. The method will not destroy the timer nor the timerHandle to work faster if a begin(uint32_t) is invoked again.

Returns
  true The instance of the display was found and it's timer stopped.
  false The instance of the display wasn't found attached to a running software timer, no action was carried out as it wasn't needed.

Use example

myLedDisp.end();

Reimplemented from SevenSegDynamic.

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