Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
codenio opened this issue Sep 29, 2021 · 0 comments
Open

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

codenio opened this issue Sep 29, 2021 · 0 comments

Comments

@codenio
Copy link

codenio commented Sep 29, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant