dbrgn/RPLCD

Decompose I2C Char LCD class into i2c_expander Based Classess.

codenio opened this issue · 0 comments

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