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.
Loading...
Searching...
No Matches
SevenSegStatHC595 Class Reference

Models displays driven by 74HC595 or similar shift registers, one shift register per display port, wired so that the eight output pins of each shift register is connected to the 8 segment pins of the corresponding display module. More...

#include <SevenSegDispHw.h>

Inheritance diagram for SevenSegStatHC595:
Collaboration diagram for SevenSegStatHC595:

Public Member Functions

 SevenSegStatHC595 ()
 Class default constructor.
 SevenSegStatHC595 (uint8_t *ioPins, uint8_t dspDigits=4, bool commAnode=true)
 Class constructor.
virtual ~SevenSegStatHC595 ()
 Class destructor.
virtual bool begin (uint32_t updtLps=0)
 Sets up the hardware display to work, and starts the display activities.
virtual void ntfyUpdDsply ()
 See SevenSegDispHw::ntfyUpdDsply() for description.
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 bool end ()
 Reverts the begin(uint32_t) actions, stopping the display activities, turning the display off and freeing the resources used by the Seven Segment display hardware object.
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 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 displays driven by 74HC595 or similar shift registers, one shift register per display port, wired so that the eight output pins of each shift register is connected to the 8 segment pins of the corresponding display module.

For more than one digit displays, the shift registers driving each port is connected to the next in the traditional daisy-chain fashion, using the cascading pins to connect the shift register to the next in the chain.

Note
This class uses ShiftRegGPIOXpander objects defined in the ShiftRegGPIOXpander_ESP32 library available from the Arduino Library Manager. You can find the last version and extensive documentation at it's Github repository https://github.com/GabyGold67/ShiftRegGPIOXpander_ESP32 .

Constructor & Destructor Documentation

◆ SevenSegStatHC595()

SevenSegStatHC595::SevenSegStatHC595 ( uint8_t * ioPins,
uint8_t dspDigits = 4,
bool commAnode = true )

Class constructor.

Parameters
ioPinsA pointer to an array holding the identifiers for the 3 GPIO pins required to send the data to be displayed to the display controller component. The correlation between the array positions and the pin function is given as in-class defined constants: 0->sclk, 1->rclk, 2->dio
dspDigitsQuantity of digits/ports of the display. This class supports the wiring scheme allowing a maximum of 8 digits per shift register composing the display controller component, up to the 256 limit imposed by the parameter data type uint8_t.
commAnodeBoolean indicating if the hardware uses a display module component wired as common anode (true) or common cathode (false).

Member Function Documentation

◆ begin()

bool SevenSegStatHC595::begin ( uint32_t updtLps = 0)
virtual

Sets up the hardware display to work, and starts the display activities.

Depending on the display technology and the resources it needs to work with, this method takes care of those preparations. That means that each specific subclass of display will provide it's own version of begin() that will take care of:

  • Configuring timers or interrupts required.
  • Setup tasks and unblocking procedures to get new contents from the SevenSegDisplays object.
  • Setup communications parameters and establish communications with the display hardware.
  • Other specific services configuration and setups.
  • Turn On the display.
Parameters
updtLpsTime lapse between updating activities required, specially by dynamic subclasses. The parameter will be used according to each subclass needs, which will be described in each class begin() method.
Return values
trueThe specific configurations and startups could be successfully completed.
Returns
false One or more of the specific configurations or startups failed.

Reimplemented from SevenSegDispHw.