This MicroPython library provides a framework for interacting with HD44780-based LCD displays through a PCF8574 I/O expander. It offers a high-level API for LCD control, including text display, cursor manipulation, and backlight settings, while also providing lower-level access to the GPIO operations on the PCF8574.
This commit introduces significant changes to the codebase, aimed at
improving code modularity, readability, and maintainability. Here's a
detailed summary of the changes:
Introduction of BacklightDriver and HD447804BitDriver classes: These
new classes serve as interfaces for controlling the backlight of an LCD
display and for controlling the HD44780 LCD controller through a 4-bit
data bus respectively. The addition of these interfaces will allow for
better code modularity and will simplify the process of adding support
for new hardware in the future.
Refactoring of HD44780 class: This class, which previously interacted
with the PCF8574 I/O expander directly, now interacts with an object
that implements the HD447804BitDriver interface. This change decouples
the HD44780 class from the PCF8574, making it easier to use this class
with other kinds of hardware.
Refactoring of PCF8574 class: This class now implements both
HD447804BitDriver and BacklightDriver interfaces, enabling it to
serve as a driver for the HD44780 LCD controller and to control the LCD
backlight. Code that was previously located in the HD44780 class has
been moved to this class.
Changes to LCD class: An instance of a class that implements
BacklightDriver is now passed to the LCD class upon initialization.
The LCD class uses this object to control the LCD backlight. This
change allows the LCD class to be used with different types of
backlight hardware.
Changes to hd44780_4bit_payload.py: A new HD447804BitPayload class
is introduced, which is used to hold a 4-bit payload for the HD44780 LCD
controller.
Changes to test_main.py: The test code has been updated to reflect the
changes to the codebase. Specifically, PCF8574 is now initialized with
HD44780 and LCD classes.
This commit does not introduce any new features or fix any bugs. It is
purely a code refactoring commit aimed at improving the structure of the
codebase and making it easier to maintain and extend in the future.
This commit introduces significant changes to the codebase, aimed at improving code modularity, readability, and maintainability. Here's a detailed summary of the changes:
Introduction of
BacklightDriver
andHD447804BitDriver
classes: These new classes serve as interfaces for controlling the backlight of an LCD display and for controlling the HD44780 LCD controller through a 4-bit data bus respectively. The addition of these interfaces will allow for better code modularity and will simplify the process of adding support for new hardware in the future.Refactoring of
HD44780
class: This class, which previously interacted with the PCF8574 I/O expander directly, now interacts with an object that implements theHD447804BitDriver
interface. This change decouples theHD44780
class from the PCF8574, making it easier to use this class with other kinds of hardware.Refactoring of
PCF8574
class: This class now implements bothHD447804BitDriver
andBacklightDriver
interfaces, enabling it to serve as a driver for the HD44780 LCD controller and to control the LCD backlight. Code that was previously located in theHD44780
class has been moved to this class.Changes to
LCD
class: An instance of a class that implementsBacklightDriver
is now passed to theLCD
class upon initialization. TheLCD
class uses this object to control the LCD backlight. This change allows theLCD
class to be used with different types of backlight hardware.Changes to
hd44780_4bit_payload.py
: A newHD447804BitPayload
class is introduced, which is used to hold a 4-bit payload for the HD44780 LCD controller.Changes to
test_main.py
: The test code has been updated to reflect the changes to the codebase. Specifically,PCF8574
is now initialized withHD44780
andLCD
classes.This commit does not introduce any new features or fix any bugs. It is purely a code refactoring commit aimed at improving the structure of the codebase and making it easier to maintain and extend in the future.