SegLCDLib
Loading...
Searching...
No Matches
SegLCD_VK0192_5DigSigBattProgress Class Reference

5-digit 7-segment LCD with signal/battery/progress (VK0192). More...

#include <SegLCD_VK0192_5DigSigBattProgress.h>

Inheritance diagram for SegLCD_VK0192_5DigSigBattProgress:
SegDriver_VK0192 SegDriver_3Wire SegLCDLib

Public Types

enum  LabelFlags {
  LABEL_P = 0x0001 , LABEL_T = 0x0002 , LABEL_PROC = 0x0004 , LABEL_DEGREE_C = 0x0008 ,
  LABEL_KPA = 0x0010 , LABEL_MPA = 0x0020 , LABEL_M = 0x0040 , LABEL_A = 0x0080 ,
  LABEL_V = 0x0100
}
 
- Public Types inherited from SegLCDLib
enum  BacklightMode { BACKLIGHT_DIGITAL , BACKLIGHT_PWM }
 Backlight mode for GPIO control. More...
 

Public Member Functions

 SegLCD_VK0192_5DigSigBattProgress (uint8_t chipselect, uint8_t data, uint8_t write, uint8_t read=-1)
 
void init () override
 Initialize GPIO pins for communication.
 
void setBatteryLevel (uint8_t value)
 
void setSignalLevel (uint8_t value)
 
void setProgress (uint8_t value)
 
void setDegreeSymbol (bool state, uint8_t index=0)
 
void setLabels (uint16_t labels)
 
void clearLabels (uint16_t labels)
 
void setCursor (uint8_t row, uint8_t col) override
 Set cursor on exact digit.
 
size_t write (uint8_t ch) override
 
- Public Member Functions inherited from SegDriver_VK0192
 SegDriver_VK0192 (uint8_t chipselect, uint8_t data, uint8_t write, uint8_t read=-1)
 Constructor for VK0192 segment driver.
 
void clear () override
 Clear all visible segments on the display.
 
void flush (uint8_t startAddr, uint8_t length) override
 Flush specific range of buffered changes to the display.
 
virtual void flush ()
 Flush all buffered changes to the display.
 
virtual void flush (uint8_t startAddr, uint8_t length)
 Flush specific range of buffered changes to the display.
 
- Public Member Functions inherited from SegDriver_3Wire
 SegDriver_3Wire (uint8_t chipselect, uint8_t data, uint8_t write, uint8_t read=-1)
 Constructor for 3-wire serial LCD driver.
 
void on () override
 Turn the display on.
 
void off () override
 Turn the display off.
 
void command (uint8_t command) override
 Send command to the controller.
 
- Public Member Functions inherited from SegLCDLib
virtual ~SegLCDLib ()
 Virtual destructor to ensure proper cleanup in derived classes.
 
void home ()
 Set cursor to 0, 0 without clear display.
 
void initBacklight (int8_t backlightPin, BacklightMode backlightMode=BACKLIGHT_DIGITAL, bool backlightActiveHigh=true)
 Initialize GPIO backlight control.
 
virtual void setBacklight (bool state)
 Set backlight state (on/off).
 
virtual void setBacklight (int brightness)
 Set backlight brightness (0-255).
 
void setAutoFlush (bool enable)
 Enable or disable autoflush mode.
 
bool getAutoFlush () const
 Get current autoflush state.
 
const uint8_t * getRamBuffer () const
 Get pointer to internal RAM buffer (read-only).
 
size_t getRamBufferSize () const
 Get size of internal RAM buffer in bytes.
 

Private Member Functions

void _writeDigit7seg (uint8_t row, uint8_t col, char c)
 
void _writeDigit16seg (uint8_t row, uint8_t col, char c)
 
void _setDecimal (uint8_t row, uint8_t col, bool state) override
 Virtual method for setting decimal point.
 
uint8_t _mapSegments (uint8_t val)
 
uint16_t _map16Segments (uint16_t val)
 
int8_t _get7SegmentsAddress (uint8_t row, uint8_t col)
 
int8_t _get16SegmentsAddress (uint8_t row, uint8_t col)
 
void _updateLabels (uint16_t labels, bool set)
 

Static Private Attributes

static constexpr uint8_t RAM_SIZE = 24
 
static constexpr uint8_t DECIMAL_POINT_BIT = 0x10
 
static constexpr int8_t DECIMAL_COL_OFFSET = -1
 
static constexpr int8_t DECIMAL_ADDR_COL_OFFSET = 1
 
static constexpr uint8_t DECIMAL_TOP_MIN_COL = 0
 
static constexpr uint8_t DECIMAL_TOP_MAX_COL = 1
 
static constexpr uint8_t DECIMAL_BOTTOM_MIN_COL = 0
 
static constexpr uint8_t DECIMAL_BOTTOM_MAX_COL = 3
 
static constexpr uint8_t DECIMAL_16SEG_BIT = 0x80
 
static constexpr uint8_t DECIMAL_16SEG_MIN_COL = 0
 
static constexpr uint8_t DECIMAL_16SEG_MAX_COL = 3
 
static constexpr uint8_t DECIMAL_16SEG_ADDR_COL0 = 0x12
 
static constexpr uint8_t DECIMAL_16SEG_ADDR_COL1 = 0x08
 
static constexpr uint8_t DECIMAL_16SEG_ADDR_COL2 = 0x0F
 
static constexpr uint8_t DECIMAL_16SEG_ADDR_COL3 = 0x14
 
static constexpr uint8_t MAX_COL = 4
 
static constexpr uint8_t NUM_7SEG_DIGITS = 10
 
static constexpr uint8_t MAX_SIGNAL_LEVEL = 3
 
static constexpr uint8_t ADDR_SIGNAL_LOW = 0x10
 
static constexpr uint8_t SIGNAL_MASK_LOW = 0xC0
 
static constexpr uint8_t ADDR_SIGNAL_HIGH = 0x16
 
static constexpr uint8_t SIGNAL_MASK_HIGH = 0x80
 
static constexpr uint8_t SIGNAL_LEVEL_SEG [3] = {0x40, 0x80, 0x80}
 
static constexpr uint8_t MAX_BATTERY_LEVEL = 4
 
static constexpr uint8_t ADDR_BATT = 0x11
 
static constexpr uint8_t BATTERY_MASK = 0xF0
 
static constexpr uint8_t BATTERY_LEVEL_SEG [4] = {0x10, 0x80, 0x40, 0x20}
 
static constexpr uint8_t MAX_PROGRESS = 150
 
static constexpr uint8_t ADDR_PROGRESS_P1 = 0x10
 
static constexpr uint8_t ADDR_PROGRESS_P2 = 0x11
 
static constexpr uint8_t ADDR_PROGRESS_P3 = 0x12
 
static constexpr uint8_t ADDR_PROGRESS_P4 = 0x13
 
static constexpr uint8_t PROGRESS_MASK = 0x0F
 
static constexpr uint8_t PROGRESS_LEVEL_SEG [16]
 
static constexpr uint8_t ADDR_LABELS_1 = 0x0E
 
static constexpr uint8_t ADDR_LABELS_2 = 0x0F
 
static constexpr uint8_t ADDR_LABELS_3 = 0x10
 

Additional Inherited Members

- Protected Member Functions inherited from SegDriver_VK0192
void _writeRam (uint8_t data, uint8_t address=0)
 Override _writeRam to implement VK0192-specific timing requirements.
 
void _writeRam (uint8_t *data, size_t length, uint8_t address=0) override
 Write multiple bytes to RAM starting at specified address.
 
void _sendBits (uint16_t data, uint8_t bitCount=8) override
 Override _sendBits to implement VK0192-specific timing requirements.
 
- Protected Member Functions inherited from SegLCDLib
void _setFlag (uint8_t mask)
 Set a specific flag bit.
 
void _clearFlag (uint8_t mask)
 Clear a specific flag bit.
 
bool _isFlagSet (uint8_t mask) const
 Check if a specific flag bit is set.
 
void _clearAllFlags ()
 Clear all flags.
 
bool _dotWrite (uint8_t ch, int8_t minCol, int8_t maxCol, int8_t ramOffset)
 Write decimal point.
 
void _dotClearCur (int8_t minCol, int8_t maxCol)
 Clear current decimal (overwrite).
 
void _colonClearIfNotFlagged (uint8_t ch, uint8_t colonCol, uint8_t colonFlag)
 Clear colon if its flag is not set.
 
virtual void _setColon (uint8_t row, uint8_t col, bool state)
 Virtual method for setting colon.
 
void _allocateBuffer (size_t size)
 Allocate RAM buffer for display data.
 
void _writeRamMasked (uint8_t data, uint8_t address, uint8_t mask=0xFF)
 Write to display RAM with nibble-aware masking support.
 
uint8_t _get_char_value (char ch)
 Helper method to convert a character to its segment representation.
 
uint16_t _get_16char_value (char ch)
 Helper method to convert a character to its 16-segment representation.
 
- Protected Attributes inherited from SegDriver_3Wire
uint8_t _wr
 Write clock pin for the display.
 
uint8_t _rd
 Read clock pin for the display.
 
uint8_t _data
 Data pin for the display.
 
uint8_t _cs
 Chip select pin for the display.
 
uint8_t _maxAddress
 Maximum address for this controller.
 
- Protected Attributes inherited from SegLCDLib
bool _autoFlush = true
 Autoflush mode enabled flag (default: true for LCD API 1.0 compatibility).
 
int8_t _backlightPin = -1
 Backlight GPIO pin (-1 if disabled)
 
BacklightMode _backlightMode = BACKLIGHT_DIGITAL
 Backlight mode (DIGITAL or PWM)
 
bool _backlightActiveHigh = true
 Backlight active high flag.
 
uint8_t _backlightBrightness = 0
 Cached backlight brightness.
 
uint8_t _displayFlags = 0
 LEDC channel for old ESP32 Arduino Core (2.0.x)
 
uint8_t * _ramBuffer = nullptr
 Dynamic RAM buffer for display data (allocated by derived classes).
 
size_t _ramBufferSize = 0
 Size of allocated RAM buffer in bytes.
 
uint8_t _cursorRow = 0
 Current Row.
 
uint8_t _cursorCol = 0
 Current Column.
 
- Static Protected Attributes inherited from SegLCDLib
static constexpr uint8_t FLAG_PENDING_DOT = 0x80
 Common flag for decimal handling when RAM offset is 0.
 

Detailed Description

5-digit 7-segment LCD with signal/battery/progress (VK0192).

Features: signal bars, battery level, progress indicator, unit labels. Integrated VK0192 controller, 3-wire serial protocol. Irregular RAM addressing.

See also
examples/VK0192/5DigSigBattProgress/5DigSigBattProgress.ino

Member Enumeration Documentation

◆ LabelFlags

Enumerator
LABEL_P 
LABEL_T 
LABEL_PROC 
LABEL_DEGREE_C 
LABEL_KPA 
LABEL_MPA 
LABEL_M 
LABEL_A 
LABEL_V 

Constructor & Destructor Documentation

◆ SegLCD_VK0192_5DigSigBattProgress()

SegLCD_VK0192_5DigSigBattProgress::SegLCD_VK0192_5DigSigBattProgress ( uint8_t  chipselect,
uint8_t  data,
uint8_t  write,
uint8_t  read = -1 
)

Member Function Documentation

◆ _get16SegmentsAddress()

int8_t SegLCD_VK0192_5DigSigBattProgress::_get16SegmentsAddress ( uint8_t  row,
uint8_t  col 
)
private

◆ _get7SegmentsAddress()

int8_t SegLCD_VK0192_5DigSigBattProgress::_get7SegmentsAddress ( uint8_t  row,
uint8_t  col 
)
private

◆ _map16Segments()

uint16_t SegLCD_VK0192_5DigSigBattProgress::_map16Segments ( uint16_t  val)
private

◆ _mapSegments()

uint8_t SegLCD_VK0192_5DigSigBattProgress::_mapSegments ( uint8_t  val)
private

◆ _setDecimal()

void SegLCD_VK0192_5DigSigBattProgress::_setDecimal ( uint8_t  row,
uint8_t  col,
bool  state 
)
overrideprivatevirtual

Virtual method for setting decimal point.

Each LCD has its own implementation with HW specifics. Default implementation is empty (no-op).

Reimplemented from SegLCDLib.

◆ _updateLabels()

void SegLCD_VK0192_5DigSigBattProgress::_updateLabels ( uint16_t  labels,
bool  set 
)
private

◆ _writeDigit16seg()

void SegLCD_VK0192_5DigSigBattProgress::_writeDigit16seg ( uint8_t  row,
uint8_t  col,
char  c 
)
private

◆ _writeDigit7seg()

void SegLCD_VK0192_5DigSigBattProgress::_writeDigit7seg ( uint8_t  row,
uint8_t  col,
char  c 
)
private

◆ clearLabels()

void SegLCD_VK0192_5DigSigBattProgress::clearLabels ( uint16_t  labels)

◆ init()

void SegLCD_VK0192_5DigSigBattProgress::init ( )
overridevirtual

Initialize GPIO pins for communication.

Reimplemented from SegDriver_3Wire.

◆ setBatteryLevel()

void SegLCD_VK0192_5DigSigBattProgress::setBatteryLevel ( uint8_t  value)

◆ setCursor()

void SegLCD_VK0192_5DigSigBattProgress::setCursor ( uint8_t  row,
uint8_t  col 
)
overridevirtual

Set cursor on exact digit.

Because LCD API is mainly used for character displays in this segment displays this function will be littlebit confusing. Because most of Segment LCD has only one row, thus this will be like row 0 and column will represent actual digit.

But if there is LCD like T1T2 LCD. Row 0 will be clock part, Row 1 will be T1: part and Row 2 will be T2: part of LCD

Parameters
rowRow, where 0-MAXROWS
colColumn 0-MAXDIGITS in current row

Reimplemented from SegLCDLib.

◆ setDegreeSymbol()

void SegLCD_VK0192_5DigSigBattProgress::setDegreeSymbol ( bool  state,
uint8_t  index = 0 
)

◆ setLabels()

void SegLCD_VK0192_5DigSigBattProgress::setLabels ( uint16_t  labels)

◆ setProgress()

void SegLCD_VK0192_5DigSigBattProgress::setProgress ( uint8_t  value)

◆ setSignalLevel()

void SegLCD_VK0192_5DigSigBattProgress::setSignalLevel ( uint8_t  value)

◆ write()

size_t SegLCD_VK0192_5DigSigBattProgress::write ( uint8_t  ch)
overridevirtual

Reimplemented from SegLCDLib.

Field Documentation

◆ ADDR_BATT

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_BATT = 0x11
staticconstexprprivate

◆ ADDR_LABELS_1

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_LABELS_1 = 0x0E
staticconstexprprivate

◆ ADDR_LABELS_2

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_LABELS_2 = 0x0F
staticconstexprprivate

◆ ADDR_LABELS_3

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_LABELS_3 = 0x10
staticconstexprprivate

◆ ADDR_PROGRESS_P1

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_PROGRESS_P1 = 0x10
staticconstexprprivate

◆ ADDR_PROGRESS_P2

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_PROGRESS_P2 = 0x11
staticconstexprprivate

◆ ADDR_PROGRESS_P3

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_PROGRESS_P3 = 0x12
staticconstexprprivate

◆ ADDR_PROGRESS_P4

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_PROGRESS_P4 = 0x13
staticconstexprprivate

◆ ADDR_SIGNAL_HIGH

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_SIGNAL_HIGH = 0x16
staticconstexprprivate

◆ ADDR_SIGNAL_LOW

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::ADDR_SIGNAL_LOW = 0x10
staticconstexprprivate

◆ BATTERY_LEVEL_SEG

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::BATTERY_LEVEL_SEG[4] = {0x10, 0x80, 0x40, 0x20}
staticconstexprprivate

◆ BATTERY_MASK

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::BATTERY_MASK = 0xF0
staticconstexprprivate

◆ DECIMAL_16SEG_ADDR_COL0

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_ADDR_COL0 = 0x12
staticconstexprprivate

◆ DECIMAL_16SEG_ADDR_COL1

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_ADDR_COL1 = 0x08
staticconstexprprivate

◆ DECIMAL_16SEG_ADDR_COL2

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_ADDR_COL2 = 0x0F
staticconstexprprivate

◆ DECIMAL_16SEG_ADDR_COL3

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_ADDR_COL3 = 0x14
staticconstexprprivate

◆ DECIMAL_16SEG_BIT

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_BIT = 0x80
staticconstexprprivate

◆ DECIMAL_16SEG_MAX_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_MAX_COL = 3
staticconstexprprivate

◆ DECIMAL_16SEG_MIN_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_16SEG_MIN_COL = 0
staticconstexprprivate

◆ DECIMAL_ADDR_COL_OFFSET

constexpr int8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_ADDR_COL_OFFSET = 1
staticconstexprprivate

◆ DECIMAL_BOTTOM_MAX_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_BOTTOM_MAX_COL = 3
staticconstexprprivate

◆ DECIMAL_BOTTOM_MIN_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_BOTTOM_MIN_COL = 0
staticconstexprprivate

◆ DECIMAL_COL_OFFSET

constexpr int8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_COL_OFFSET = -1
staticconstexprprivate

◆ DECIMAL_POINT_BIT

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_POINT_BIT = 0x10
staticconstexprprivate

◆ DECIMAL_TOP_MAX_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_TOP_MAX_COL = 1
staticconstexprprivate

◆ DECIMAL_TOP_MIN_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::DECIMAL_TOP_MIN_COL = 0
staticconstexprprivate

◆ MAX_BATTERY_LEVEL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::MAX_BATTERY_LEVEL = 4
staticconstexprprivate

◆ MAX_COL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::MAX_COL = 4
staticconstexprprivate

◆ MAX_PROGRESS

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::MAX_PROGRESS = 150
staticconstexprprivate

◆ MAX_SIGNAL_LEVEL

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::MAX_SIGNAL_LEVEL = 3
staticconstexprprivate

◆ NUM_7SEG_DIGITS

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::NUM_7SEG_DIGITS = 10
staticconstexprprivate

◆ PROGRESS_LEVEL_SEG

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::PROGRESS_LEVEL_SEG[16]
staticconstexprprivate
Initial value:
=
{ 0x01,
0x08, 0x04, 0x02, 0x01,
0x01, 0x02, 0x04, 0x08,
0x08, 0x04, 0x02,
0x08, 0x04, 0x02, 0x01 }

◆ PROGRESS_MASK

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::PROGRESS_MASK = 0x0F
staticconstexprprivate

◆ RAM_SIZE

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::RAM_SIZE = 24
staticconstexprprivate

◆ SIGNAL_LEVEL_SEG

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::SIGNAL_LEVEL_SEG[3] = {0x40, 0x80, 0x80}
staticconstexprprivate

◆ SIGNAL_MASK_HIGH

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::SIGNAL_MASK_HIGH = 0x80
staticconstexprprivate

◆ SIGNAL_MASK_LOW

constexpr uint8_t SegLCD_VK0192_5DigSigBattProgress::SIGNAL_MASK_LOW = 0xC0
staticconstexprprivate

The documentation for this class was generated from the following files: