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 | Protected Attributes | List of all members
SevenSegMax7219 Class Reference

Models a Seven Segment display hardware using a Max7219 display controller component More...

`#include <sevenSegDispHw.h>`

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

## Public Member Functions
| SevenSegMax7219 ()
| Default class constructor.
| SevenSegMax7219 (uint8_t *ioPins, uint8_t dspDigits)
| Class constructor.
| ~SevenSegMax7219 ()
| Class destructor.
bool | begin (uint32_t updtLps=0)
| Sets up the hardware display to work, and starts the display activities.
bool | end ()
| Ends the active mode of the display by shutting it off.
virtual bool | getIsOn ()
| Returns a value indicating if the display controller is in working/On or shutdown/Off mode.
virtual void | ntfyUpdDsply ()
| See SevenSegDispHw::ntfyUpdDsply() for description.
virtual bool | setBrghtnssLvl (const uint8_t &newBrghtnssLvl)
| Sets the brightness level for the display module.
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.
Public Member Functions inherited from SevenSegStatic
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.
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.

## Protected Attributes
uint8_t * | _lclDspBuffPtr {nullptr}
| Pointer to an array of size equal to _dspDigitsQty, the local buffer differs from the shared _dspBuffPtr because it holds the data of the _dspBuffPtr formatted and ready to be sent to the display controller
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 Seven Segment display hardware using a Max7219 display controller component

The Max7219 is a seven segment 8 digits (maximum) display controller that shares most of it's characteristics with the Max7221. The main difference is that the Max7219 is not completely compliant with the SPI communications protocol standard as the Max7221 is, so a software line handling solution must be provided.

The Max72xx defines it's messages as 16-bit units. Each 16-bit message includes data and address sections. The address space is separated into two sections:

- Display ports content addresses
- Control registers addresses

## 16-bit Message format:

|F|E|D|C|B|A|9|8||7|6|5|4|3|2|1|0|

| | MSb | LSb | | Data | Address N/C

## Address Space map:

## Address|Purpose |Selected value/Accepted range

0xX0 | NOP | N/A 0xX1~X8| Digit 0~7 content| 0x00~0xFF with DpABCDEFG bit order 0xX9 | Decode Mode | 0x00 NO decode of any kind (0x01, 0x0F, 0xFF valid options) 0xXA | Brightness level | 0xX0~0xXF (min to max, turns on at minimum) 0xXB | Used digits Qty. | 0xX0~0xX7 (1 to 7 digits, turns on at 1) 0xXC | Shutdown Register| 0x00: Shutdown, 0x01: normal operation 0xXD | N/C | 0x0E | N/C | 0x0F | Display test | 0xX0: Normal operation, 0xX1: Test all leds ON

## Constructor & Destructor Documentation

## ◆ SevenSegMax7219()

SevenSegMax7219::SevenSegMax7219 | ( | uint8_t * | ioPins,
|  | uint8_t | dspDigits )

Class constructor.

Parameters

  ioPins | A pointer to an array holding the identifiers for the 3 GPIO pins required to send the data to the Seven Segment display hardware to be displayed. The correlation between the array positions and the pin function is given as in-class defined constants: 0->clk, 1->din, 2->cs.
  dspDigits | Quantity of digits/ports of the display. This parameter for this subclass must be in the range 1 <= dspDigits <= 8.

Note
  The Max72XX display controller family is designed to control common cathode display modules, so there is no parameter provided to instantiate a common anode SevenSegMax7219 class object.

## Member Function Documentation

## ◆ begin()

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

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

For the Max72XX display controllers this setup includes:

- Setting the display in "Normal operation mode"
- Setting the quantity of display ports of the "Display module" connected to the controller.
- BCD decoding use.
- Turning on the Display controller (shutdown register setting).

Returns
  true Always

Reimplemented from SevenSegDispHw.

Here is the call graph for this function:

## ◆ end()

bool SevenSegMax7219::end | ( |  | ) |
| virtual

Ends the active mode of the display by shutting it off.

While the control module will keep receiving and updating it's registers, while the display controller is in shutdown mode the display module will be turned off and no activity will be executed in the corresponding led powering lines.

Returns
  true Always

Reimplemented from SevenSegDispHw.

Here is the call graph for this function:

## ◆ getIsOn()

bool SevenSegMax7219::getIsOn | ( |  | ) |
| virtual

Returns a value indicating if the display controller is in working/On or shutdown/Off mode.

Return values

  true | The display controller is in working/On mode.
  false | The display controller is in shutdown/Off mode.

Reimplemented from SevenSegDispHw.

## ◆ setBrghtnssLvl()

bool SevenSegMax7219::setBrghtnssLvl | ( | const uint8_t & | newBrghtnssLvl | ) |
| virtual

Sets the brightness level for the display module.

See SevenSegTM163X::setBrghtnssLvl(const uint8_t &) for details.

Reimplemented from SevenSegDispHw.

Here is the caller graph for this function:

## ◆ turnOff()

void SevenSegMax7219::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
  While the display is Off, it will keep receiving display data and commands, but will keep the leds turned off. When it receives a turnOn command the display will show the data it received while turned off, or the same it was showing at turnOff if no change to the contents was done.

Reimplemented from SevenSegDispHw.

Here is the caller graph for this function:

## ◆ turnOn() [1/2]

void SevenSegMax7219::turnOn | ( |  | ) |
| virtual

Turns the display module on.

The display module will be turned on and it's content displayed, and will keep that status until a turnOff() is invoked.

Reimplemented from SevenSegDispHw.

Here is the caller graph for this function:

## ◆ turnOn() [2/2]

void SevenSegMax7219::turnOn | ( | const uint8_t & | newBrghtnssLvl | ) |
| virtual

Turns the display module on.

The display module will be turned on, it's brightness level set to the requested level, it's content displayed, and will keep that status until a turnOff() is invoked.

Parameters

  newBrghtnssLvl | The new brightness level for the display. The value must be in the range getBrghtnssMinLvl() <= newBrghtnssLvl <= getBrghtnssMaxLvl()

Reimplemented from SevenSegDispHw.

Here is the call graph for this function: