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
SevenSegHT16K33 Class Reference

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

#include <SevenSegDispHw.h>

Inheritance diagram for SevenSegHT16K33:
Collaboration diagram for SevenSegHT16K33:

Public Member Functions

 SevenSegHT16K33 ()
 Default class constructor.
 SevenSegHT16K33 (uint8_t *ioPins, uint8_t dspDigits, uint8_t i2cAddress=0x70)
 Class constructor.
virtual ~SevenSegHT16K33 ()
 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 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 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 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.

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 a Seven Segment display hardware using a HT16K33 display controller component

The HT16K33 is a 16 segment 8 digits (maximum) display controller that communicates with the MCU through I2C protocol. The library implements the required methods to comply with all the features implemented in the SevenSegDisplays library, so the HT16K33 can be used as a Seven Segment display controller in the same way as the other display controllers implemented in this library.

Attention
As with the other dedicated display controllers modeled by this library, the use of prebuilt modules that include the HT16K33 chip and a Seven Segment display module, the wiring of the display module to the HT16K33 chip might not be standard, so documentation for the prebuilt module must be consulted to determine the correct digits/ports colons and special icons wiring, or tests must be conducted to determine the wiring of the display module and use the setDigitsOrder(uint8_t*) with the correct order of the digits/ports to be displayed.

Constructor & Destructor Documentation

◆ SevenSegHT16K33()

SevenSegHT16K33::SevenSegHT16K33 ( uint8_t * ioPins,
uint8_t dspDigits,
uint8_t i2cAddress = 0x70 )

Class constructor.

Parameters
ioPinsA pointer to an array holding the identifiers for the 2 GPIO pins required for the I2C communications with the display controller. The correlation between the array positions and the pin function is given as in-class defined constants: 0->scl, 1->sda. A nullptr parameter will make the constructor use the default pins asignement by the Arduino environment for the first I2C port.
dspDigitsQuantity of digits/ports of the display. This parameter for this subclass must be in the range 1 <= dspDigits <= 8.
i2cAddressI2C slave identification address. By hardware design the HT16K33 module has 0x70 as default address, and it might be modified if desired in the 0x70 <= i2cAddress <= 0x77 range. In case of doubt check the hardware or use a I2C bus standard scanner routine

Member Function Documentation

◆ begin()

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

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

For the SevenSegHT16K33 display controllers this setup includes:

  • Setting up the I2C communication
    • Create the comm object.
    • begin() the comm object operation
    • Set the comm speed with setclock()
  • Turning on the Display controller's oscilator (shutdown register setting).
  • Setting the display in "Display Row/Int output pin = Row mode"
  • Setting the display brightness level (in our case to maximum level).
Returns
true Always

Reimplemented from SevenSegDispHw.

Here is the call graph for this function:

◆ end()

bool SevenSegHT16K33::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 caller graph for this function:

◆ setBrghtnssLvl()

bool SevenSegHT16K33::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 SevenSegHT16K33::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.

◆ turnOn() [1/2]

void SevenSegHT16K33::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 SevenSegHT16K33::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
newBrghtnssLvlThe 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: