1-phase PV router
Loading...
Searching...
No Matches
utils_display.h File Reference

7-segments display functions More...

#include "config_system.h"
#include "config.h"
#include "FastDivision.h"
Include dependency graph for utils_display.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  DigitEnableStates : uint8_t { DIGIT_ENABLED , DIGIT_DISABLED }
 

Functions

void configureValueForDisplay (const bool _EDD_isActive, const uint16_t _ValueToDisplay, const bool _diversionEnabled=false, const bool _loadForced=false)
 Configures the value for display on a 7-segment display.
 
void displayForced ()
 Displays "FORC" on the 7-segment display for forced load override.
 
void displayOff ()
 Displays "OFF" on the 7-segment display.
 
void initializeDisplay ()
 Initializes the display for hardware-driven 7-segment displays.
 
void initializeDisplayHW ()
 Initializes the display for hardware-driven 7-segment displays.
 
void initializeDisplaySW ()
 Initializes the display for software-driven 7-segment displays.
 
void refresh7SegDisplay ()
 Refreshes the display by updating the active digit and its segments.
 
void update7SegmentHWDisplay ()
 Updates the 7-segment display for the next digit (hardware-driven).
 
void update7SegmentSWDisplay ()
 Updates the 7-segment display for the next digit (software-driven).
 

Variables

uint8_t charsForDisplay [noOfDigitLocations] { 20, 20, 20, 20 }
 
constexpr uint8_t decimalPointLine { 14 }
 
constexpr uint8_t digitLocationLine [noOfDigitLocationLines] { 16, 15 }
 
constexpr uint8_t digitLocationMap [noOfDigitLocations][noOfDigitLocationLines]
 
constexpr uint8_t digitSelectionLine [noOfDigitSelectionLines] { 7, 9, 8, 6 }
 
constexpr uint8_t digitSelectorPin [noOfDigitLocations] { 16, 10, 13, 11 }
 
constexpr uint8_t digitValueMap [noOfPossibleCharacters][noOfDigitSelectionLines]
 
constexpr uint8_t DISPLAY_SHUTDOWN_IN_HOURS { 8 }
 
constexpr uint32_t displayShutdown_inMainsCycles { DISPLAY_SHUTDOWN_IN_HOURS * mainsCyclesPerHour }
 
constexpr uint8_t DPstatus_columnID { noOfDigitSelectionLines }
 
constexpr uint8_t DRIVER_CHIP_DISABLED { HIGH }
 
constexpr uint8_t DRIVER_CHIP_ENABLED { LOW }
 
constexpr uint8_t enableDisableLine { 5 }
 
constexpr uint8_t MAX_DISPLAY_TIME_COUNT { 10 }
 
constexpr uint8_t noOfDigitLocationLines { 2 }
 
constexpr uint8_t noOfDigitLocations { 4 }
 
constexpr uint8_t noOfDigitSelectionLines { 4 }
 
constexpr uint8_t noOfPossibleCharacters { 14 }
 
constexpr uint8_t noOfSegmentsPerDigit { 8 }
 
constexpr uint8_t OFF { LOW }
 
constexpr uint8_t ON { HIGH }
 
constexpr uint8_t segMap [noOfPossibleCharacters][noOfSegmentsPerDigit - 1]
 
constexpr uint8_t segmentDrivePin [noOfSegmentsPerDigit] { 2, 5, 12, 6, 7, 9, 8, 14 }
 
constexpr uint8_t UPDATE_PERIOD_FOR_DISPLAYED_DATA { 50 }
 

Detailed Description

7-segments display functions

Author
Frederic Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
Version
0.1
Date
2024-10-29

7

Definition in file utils_display.h.

Enumeration Type Documentation

◆ DigitEnableStates

enum class DigitEnableStates : uint8_t
strong
Enumerator
DIGIT_ENABLED 
DIGIT_DISABLED 

Definition at line 194 of file utils_display.h.

Variable Documentation

◆ charsForDisplay

uint8_t charsForDisplay[noOfDigitLocations] { 20, 20, 20, 20 }
inline

◆ decimalPointLine

uint8_t decimalPointLine { 14 }
inlineconstexpr

Definition at line 53 of file utils_display.h.

Referenced by initializeDisplayHW(), and update7SegmentHWDisplay().

◆ digitLocationLine

uint8_t digitLocationLine[noOfDigitLocationLines] { 16, 15 }
inlineconstexpr

Definition at line 55 of file utils_display.h.

Referenced by check_pins(), initializeDisplayHW(), and update7SegmentHWDisplay().

◆ digitLocationMap

uint8_t digitLocationMap[noOfDigitLocations][noOfDigitLocationLines]
inlineconstexpr
Initial value:
{
LOW, LOW,
LOW, HIGH,
HIGH, LOW,
HIGH, HIGH,
}

Definition at line 82 of file utils_display.h.

Referenced by update7SegmentHWDisplay().

◆ digitSelectionLine

uint8_t digitSelectionLine[noOfDigitSelectionLines] { 7, 9, 8, 6 }
inlineconstexpr

Definition at line 56 of file utils_display.h.

Referenced by check_pins(), initializeDisplayHW(), and update7SegmentHWDisplay().

◆ digitSelectorPin

uint8_t digitSelectorPin[noOfDigitLocations] { 16, 10, 13, 11 }
inlineconstexpr

Definition at line 200 of file utils_display.h.

Referenced by check_pins(), initializeDisplaySW(), and update7SegmentSWDisplay().

◆ digitValueMap

uint8_t digitValueMap[noOfPossibleCharacters][noOfDigitSelectionLines]
inlineconstexpr
Initial value:
{
LOW, LOW, LOW, LOW,
LOW, LOW, LOW, HIGH,
LOW, LOW, HIGH, LOW,
LOW, LOW, HIGH, HIGH,
LOW, HIGH, LOW, LOW,
LOW, HIGH, LOW, HIGH,
LOW, HIGH, HIGH, LOW,
LOW, HIGH, HIGH, HIGH,
HIGH, LOW, LOW, LOW,
HIGH, LOW, LOW, HIGH,
HIGH, HIGH, HIGH, HIGH,
LOW, HIGH, HIGH, HIGH,
HIGH, LOW, HIGH, LOW,
LOW, LOW, HIGH, LOW,
}

Definition at line 62 of file utils_display.h.

Referenced by update7SegmentHWDisplay().

◆ DISPLAY_SHUTDOWN_IN_HOURS

uint8_t DISPLAY_SHUTDOWN_IN_HOURS { 8 }
inlineconstexpr

Definition at line 27 of file utils_display.h.

◆ displayShutdown_inMainsCycles

uint32_t displayShutdown_inMainsCycles { DISPLAY_SHUTDOWN_IN_HOURS * mainsCyclesPerHour }
inlineconstexpr

Definition at line 29 of file utils_display.h.

Referenced by processLatestContribution().

◆ DPstatus_columnID

uint8_t DPstatus_columnID { noOfDigitSelectionLines }
inlineconstexpr

Definition at line 80 of file utils_display.h.

◆ DRIVER_CHIP_DISABLED

uint8_t DRIVER_CHIP_DISABLED { HIGH }
inlineconstexpr

Definition at line 45 of file utils_display.h.

Referenced by initializeDisplayHW(), and update7SegmentHWDisplay().

◆ DRIVER_CHIP_ENABLED

uint8_t DRIVER_CHIP_ENABLED { LOW }
inlineconstexpr

Definition at line 46 of file utils_display.h.

Referenced by update7SegmentHWDisplay().

◆ enableDisableLine

uint8_t enableDisableLine { 5 }
inlineconstexpr

Definition at line 52 of file utils_display.h.

Referenced by initializeDisplayHW(), and update7SegmentHWDisplay().

◆ MAX_DISPLAY_TIME_COUNT

uint8_t MAX_DISPLAY_TIME_COUNT { 10 }
inlineconstexpr

Definition at line 30 of file utils_display.h.

Referenced by refresh7SegDisplay().

◆ noOfDigitLocationLines

uint8_t noOfDigitLocationLines { 2 }
inlineconstexpr

Definition at line 50 of file utils_display.h.

Referenced by initializeDisplayHW(), and update7SegmentHWDisplay().

◆ noOfDigitLocations

uint8_t noOfDigitLocations { 4 }
inlineconstexpr

◆ noOfDigitSelectionLines

uint8_t noOfDigitSelectionLines { 4 }
inlineconstexpr

Definition at line 49 of file utils_display.h.

Referenced by initializeDisplayHW(), and update7SegmentHWDisplay().

◆ noOfPossibleCharacters

uint8_t noOfPossibleCharacters { 14 }
inlineconstexpr

Definition at line 25 of file utils_display.h.

◆ noOfSegmentsPerDigit

uint8_t noOfSegmentsPerDigit { 8 }
inlineconstexpr

Definition at line 192 of file utils_display.h.

Referenced by initializeDisplaySW(), and update7SegmentSWDisplay().

◆ OFF

uint8_t OFF { LOW }
inlineconstexpr

Definition at line 190 of file utils_display.h.

Referenced by initializeDisplaySW().

◆ ON

uint8_t ON { HIGH }
inlineconstexpr

Definition at line 189 of file utils_display.h.

◆ segMap

uint8_t segMap[noOfPossibleCharacters][noOfSegmentsPerDigit - 1]
inlineconstexpr
Initial value:
{
ON, ON, ON, ON, ON, ON, OFF,
OFF, ON, ON, OFF, OFF, OFF, OFF,
ON, ON, OFF, ON, ON, OFF, ON,
ON, ON, ON, ON, OFF, OFF, ON,
OFF, ON, ON, OFF, OFF, ON, ON,
ON, OFF, ON, ON, OFF, ON, ON,
ON, OFF, ON, ON, ON, ON, ON,
ON, ON, ON, OFF, OFF, OFF, OFF,
ON, ON, ON, ON, ON, ON, ON,
ON, ON, ON, ON, OFF, ON, ON,
OFF, OFF, OFF, OFF, OFF, OFF, OFF,
ON, OFF, OFF, OFF, ON, ON, ON,
OFF, OFF, OFF, OFF, ON, OFF, ON,
ON, OFF, OFF, ON, ON, ON, OFF,
}
constexpr uint8_t ON
constexpr uint8_t OFF

Definition at line 207 of file utils_display.h.

Referenced by update7SegmentSWDisplay().

◆ segmentDrivePin

uint8_t segmentDrivePin[noOfSegmentsPerDigit] { 2, 5, 12, 6, 7, 9, 8, 14 }
inlineconstexpr

Definition at line 201 of file utils_display.h.

Referenced by check_pins(), initializeDisplaySW(), and update7SegmentSWDisplay().

◆ UPDATE_PERIOD_FOR_DISPLAYED_DATA

uint8_t UPDATE_PERIOD_FOR_DISPLAYED_DATA { 50 }
inlineconstexpr

Definition at line 26 of file utils_display.h.

Referenced by loop().