Skip to content

Decompose I2C Char LCD class into i2c_expander Based Classess. #129

@codenio

Description

@codenio

Thanks for this excellent project. Exploring the internals of i2c LCD supported, I came across

class CharLCD(BaseCharLCD):
    def __init__(self, i2c_expander, address, expander_params=None, port=1,
                       cols=20, rows=4, dotsize=8,
                       charmap='A02',
                       auto_linebreaks=True,
                       backlight_enabled=True):

that takes i2c_expander as a parameter and does a comparision in all it's methods for executing corresponding actions.
I feel that decomposing this complex class into simpler i2c_expander Based Classes, like

class PCF8574CharLCD(BaseCharLCD):
    def __init__(self, address, port=1,
                       cols=20, rows=4, dotsize=8,
                       .... ):

class MCP23008CharLCD(BaseCharLCD):
    def __init__(self, address, expander_params=None, port=1,
                       cols=20, rows=4, dotsize=8,
                       .... ):

which enhances code readability, maintainability, development, and testing.

do let me know your thoughts..!
-codenio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions