1-phase PV router
|
Functions for managing the 7-segment display. More...
Files | |
file | utils_display.h |
7-segments display functions | |
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). | |
Functions for managing the 7-segment display.
This group handles the initialization and updates of the 7-segment display. It is used to show numeric data such as power levels, energy consumption, or system status in a simple and clear format.
|
inline |
Configures the value for display on a 7-segment display.
This function controls what is shown on the 7-segment display based on the system state. It handles multiple display modes:
_EDD_isActive | A boolean indicating whether the energy display is active. |
_ValueToDisplay | The energy value to be displayed (16-bit unsigned integer). |
_diversionEnabled | A boolean indicating if diversion is enabled (default=true). |
_loadForced | A boolean indicating if a load is in forced override mode (default=false). |
Display precedence order:
For energy value display:
7
Definition at line 413 of file utils_display.h.
References charsForDisplay, displayForced(), displayOff(), divmod10(), divu10(), noOfDigitLocations, SEG, SEG_HW, and TYPE_OF_DISPLAY.
Referenced by loop().
|
inline |
Displays "FORC" on the 7-segment display for forced load override.
This function configures the display to show "FORC" when a load is overridden. Uses the existing '0' character definition for 'O' to save memory.
7
Definition at line 372 of file utils_display.h.
References charsForDisplay, SEG, SEG_HW, and TYPE_OF_DISPLAY.
Referenced by configureValueForDisplay().
|
inline |
Displays "OFF" on the 7-segment display.
This function configures the display to show "OFF" when diversion is disabled. It displays the text right-aligned on the 4-digit display. Uses the existing '0' character definition for 'O' to save memory.
7
Definition at line 350 of file utils_display.h.
References charsForDisplay, SEG, SEG_HW, and TYPE_OF_DISPLAY.
Referenced by configureValueForDisplay().
|
inline |
Initializes the display for hardware-driven 7-segment displays.
This function determines the type of display (hardware-driven or software-driven) and calls the appropriate initialization function.
7
Definition at line 329 of file utils_display.h.
References initializeDisplayHW(), initializeDisplaySW(), SEG, SEG_HW, and TYPE_OF_DISPLAY.
Referenced by setup().
|
inline |
Initializes the display for hardware-driven 7-segment displays.
This function configures the necessary pin modes and initial states for hardware-driven 7-segment displays. It sets up the decimal point line, control lines for the 74HC4543 7-segment display driver, the enable line, and the control lines for the 74HC138 2-to-4 demultiplexer.
Key operations include:
7
Definition at line 106 of file utils_display.h.
References decimalPointLine, digitLocationLine, digitSelectionLine, DRIVER_CHIP_DISABLED, enableDisableLine, i, noOfDigitLocationLines, noOfDigitSelectionLines, and setPinState().
Referenced by initializeDisplay().
|
inline |
Initializes the display for software-driven 7-segment displays.
Configures the necessary pin modes and initial states for software-driven 7-segment displays. This includes setting up the segment drive pins and digit selector pins, disabling all digit selector pins, and turning off all segment drive pins initially.
Key operations include:
7
Definition at line 240 of file utils_display.h.
References DIGIT_DISABLED, digitSelectorPin, i, noOfDigitLocations, noOfSegmentsPerDigit, OFF, segmentDrivePin, and setPinState().
Referenced by initializeDisplay().
|
inline |
Refreshes the display by updating the active digit and its segments.
This function manages the display of digits on a 7-segment display. It determines which digit is currently active and updates the display to show the next digit when the current digit's display time has expired. The logic differs based on the type of display hardware.
For DisplayType::SEG_HW:
For DisplayType::SEG:
7
Definition at line 493 of file utils_display.h.
References MAX_DISPLAY_TIME_COUNT, SEG, SEG_HW, TYPE_OF_DISPLAY, update7SegmentHWDisplay(), and update7SegmentSWDisplay().
Referenced by processRawSamples().
|
inline |
Updates the 7-segment display for the next digit (hardware-driven).
This function handles the process of updating the 7-segment display by:
7
Definition at line 141 of file utils_display.h.
References charsForDisplay, decimalPointLine, digitLocationLine, digitLocationMap, digitSelectionLine, digitValueMap, DRIVER_CHIP_DISABLED, DRIVER_CHIP_ENABLED, enableDisableLine, noOfDigitLocationLines, noOfDigitLocations, noOfDigitSelectionLines, and setPinState().
Referenced by refresh7SegDisplay().
|
inline |
Updates the 7-segment display for the next digit (software-driven).
This function handles the process of updating the 7-segment display for configurations without additional driver chips. It deactivates the current digit, determines the next digit to activate, sets up the segment drivers for the new digit, and activates the corresponding digit-enable line.
Key operations include:
7
Definition at line 285 of file utils_display.h.
References charsForDisplay, DIGIT_DISABLED, DIGIT_ENABLED, digitSelectorPin, noOfDigitLocations, noOfSegmentsPerDigit, segMap, segmentDrivePin, and setPinState().
Referenced by refresh7SegDisplay().