SegLCDLib
Loading...
Searching...
No Matches
Migration Guide

This guide documents user-visible changes required when upgrading between SegLCDLib versions.

v0.0.1 to v0.0.2

Migration checklist:

Transport layer

LCD constructors no longer take Arduino Wire or GPIO pins directly. Create a transport object and pass it to the LCD class.

Old:

#include <Wire.h>
PCF85176 driver for single-digit LCD display.
Single-digit LCD with flexible segment layout (PCF85176).
Definition SegLCD_PCF85176_OneDigit.h:20

New:

#include <Wire.h>
SegTransportI2CArduino transport(Wire);
SegLCD_PCF85176_OneDigit lcd(transport);
Arduino TwoWire implementation of the I2C transport.
Definition SegTransportArduino.h:38

For 3-wire controllers:

SegTransport3WireArduino transport(6, 5); // DATA, WR
SegLCD_HT1621_4SegDegree lcd(transport, 7); // CS
HT1621 driver for 4-digit LCD with degree symbol and colon.
4-digit 7-segment LCD with degree symbol and colon (HT1621).
Definition SegLCD_HT1621_4SegDegree.h:21
Arduino GPIO implementation of the 3-wire transport.
Definition SegTransportArduino.h:14

This affects all existing v0.0.1 LCD constructors:

PCx85 raw class split

The generic SegLCD_PCx85_Raw class was replaced by controller-specific raw classes.

Old:

#include "SegLCD_PCx85_Raw.h"
SegLCD_PCx85_Raw lcd(Wire);

New for PCF85176/PCF8576:

SegTransportI2CArduino transport(Wire);
SegLCD_PCF85176_Raw lcd(transport);
Raw PCF85176 LCD implementation for prototyping and testing.
Raw PCF85176 LCD class for direct RAM access.
Definition SegLCD_PCF85176_Raw.h:19

Use SegLCD_PCF85134_Raw for PCF85134 displays.

Labels renamed to units

Physical measurement indicators were renamed from labels to units.

v0.0.1 v0.0.2
LabelFlags UnitFlags
setLabels(...) setUnits(...)
clearLabels(...) clearUnits(...)
LABEL_* unit constants UNIT_* constants

Affected LCD classes:

Example:

// Old
lcd.setLabels(SegLCD_PCF85176_TempHumidity::LABEL_DEGREE_C |
SegLCD_PCF85176_TempHumidity::LABEL_PROC);
// New
@ UNIT_PERCENT
Definition SegLCD_PCF85176_TempHum.h:25
@ UNIT_DEGREE_C
Definition SegLCD_PCF85176_TempHum.h:24

Display text labels remain labels. For example, SegLCD_PCF85176_T1T2Lcd::setT1T2Labels(...) and HT1621 LCM label APIs are unchanged.

Direct driver includes

SegDriver_PCF85176 and SegDriver_PCF8576 moved out of SegDriver_PCx85.h into their own headers.

If user code includes controller drivers directly, update includes:

Regular LCD model headers already include the correct controller header.

Custom LCD implementations

Custom LCD classes derived from library drivers must be updated for the transport layer.

  • I2C custom drivers should inherit from the specific controller driver, such as SegDriver_PCF85176.
  • 3-wire custom drivers should inherit from the specific controller driver, such as SegDriver_HT1621, SegDriver_HT1622, or SegDriver_VK0192.
  • Old global controller macros such as MAX_ADDRESS / MAX_HW_ADDRESS were replaced by class-scoped constants.

Backlight initialization

initBacklight() no longer takes a raw GPIO pin number. Create a SegBacklight implementation and pass it in instead. The active-high flag moved to the backlight implementation's constructor.

Old:

lcd.initBacklight(7, SegLCDLib::BACKLIGHT_DIGITAL, true);
@ BACKLIGHT_DIGITAL
Digital on/off mode.
Definition SegLCDLib.h:52

New:

SegBacklightArduino backlight(7); // activeHigh defaults to true
lcd.initBacklight(&backlight, SegLCDLib::BACKLIGHT_DIGITAL);
Arduino GPIO/PWM implementation of backlight control.
Definition SegBacklightArduino.h:13

If initBacklight() was called conditionally based on a "no backlight" sentinel pin value, keep the SegBacklightArduino instance around only when a real pin is configured (see examples/HT1622/10Digit16SegmentLCD for a static-pin example, or examples/MenuControl/MenuControl.cpp for a dynamically-configured pin using new/delete).