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

Base class for 3-wire serial LCD segment display drivers. More...

#include <SegDriver_3Wire.h>

Inheritance diagram for SegDriver_3Wire:
SegLCDLib SegDriver_HT1621 SegDriver_HT1622 SegDriver_VK0192 SegLCD_HT1621_4SegDegree SegLCD_HT1621_6SegBat SegLCD_HT1621_LCM0844 SegLCD_HT1621_LCM59011 SegLCD_HT1621_LCM88128 SegLCD_HT1621_Raw SegLCD_HT1622_10Dig16Seg SegLCD_HT1622_Raw SegLCD_VK0192_5DigSigBattProgress SegLCD_VK0192_Raw

Public Member Functions

 SegDriver_3Wire (SegTransport3Wire &transport, uint8_t chipselect)
 Constructor for 3-wire serial LCD driver.
 
void init () override
 Initialize GPIO pins for communication.
 
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.
 
virtual void clear ()
 Clear all visible segments on the display.
 
void home ()
 Set cursor to 0, 0 without clear display.
 
virtual void setCursor (uint8_t row, uint8_t col)
 Set cursor on exact digit.
 
virtual size_t write (uint8_t)
 
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.
 
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.
 
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.
 

Protected Member Functions

virtual void _writeRam (uint8_t *data, size_t length, uint8_t address)
 Low-level method to write a data buffer to display RAM.
 
void _writeRam (uint8_t data, uint8_t address=0)
 Write multiple bytes to RAM starting at specified address.
 
virtual void _writeRam (uint8_t *data, size_t length, uint8_t address)=0
 Write multiple bytes to RAM starting at specified address.
 
- 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 _setDecimal (uint8_t, uint8_t, bool)
 Virtual method for setting decimal point.
 
virtual void _setColon (uint8_t, uint8_t, bool)
 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.
 
void _writeRam (uint8_t data, uint8_t address=0)
 Low-level method to write a single byte to display RAM.
 
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

SegTransport3Wire_transport
 
uint8_t _cs
 Chip select pin for the display.
 
- 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.
 

Additional Inherited Members

- Public Types inherited from SegLCDLib
enum  BacklightMode { BACKLIGHT_DIGITAL , BACKLIGHT_PWM }
 Backlight mode for GPIO control. More...
 
- 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

Base class for 3-wire serial LCD segment display drivers.

This class implements the common 3-wire serial communication protocol used by controllers like HT1621, VK0192, and HT1622.

Constructor & Destructor Documentation

◆ SegDriver_3Wire()

SegDriver_3Wire::SegDriver_3Wire ( SegTransport3Wire transport,
uint8_t  chipselect 
)

Constructor for 3-wire serial LCD driver.

Parameters
chipselectChip select pin
dataData pin
writeWrite clock pin
readRead clock pin (optional, default -1)

Member Function Documentation

◆ _writeRam() [1/3]

void SegDriver_3Wire::_writeRam ( uint8_t *  data,
size_t  length,
uint8_t  address 
)
protectedvirtual

Low-level method to write a data buffer to display RAM.

Parameters
dataPointer to data buffer
lengthLength of data buffer
addressStart RAM address

Implements SegLCDLib.

◆ _writeRam() [2/3]

virtual void SegLCDLib::_writeRam ( uint8_t *  data,
size_t  length,
uint8_t  address 
)
protectedvirtual

Write multiple bytes to RAM starting at specified address.

Parameters
dataPointer to data array
lengthNumber of bytes to write
addressStarting RAM address (0-based)

Implements SegLCDLib.

◆ _writeRam() [3/3]

void SegLCDLib::_writeRam ( uint8_t  data,
uint8_t  address = 0 
)
protected

Write multiple bytes to RAM starting at specified address.

Parameters
dataPointer to data array
lengthNumber of bytes to write
addressStarting RAM address (0-based)

◆ command()

void SegDriver_3Wire::command ( uint8_t  command)
overridevirtual

Send command to the controller.

Parameters
commandCommand byte to send

Implements SegLCDLib.

◆ init()

void SegDriver_3Wire::init ( )
overridevirtual

◆ off()

void SegDriver_3Wire::off ( )
overridevirtual

Turn the display off.

Implements SegLCDLib.

◆ on()

void SegDriver_3Wire::on ( )
overridevirtual

Turn the display on.

Implements SegLCDLib.

Field Documentation

◆ _cs

uint8_t SegDriver_3Wire::_cs
protected

Chip select pin for the display.

◆ _transport

SegTransport3Wire& SegDriver_3Wire::_transport
protected

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