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

Needs a refactor. #10

Closed
caternuson opened this issue May 3, 2019 · 7 comments
Closed

Needs a refactor. #10

caternuson opened this issue May 3, 2019 · 7 comments
Assignees

Comments

@caternuson
Copy link
Contributor

Everything is currently in a single file, which is causing some memory issues:
adafruit/Adafruit_CircuitPython_CharLCD#36

Suggest this gets broken out into several files in a subfolder:

  • adafruit_mcp230xx
    • mcp230xx.py - base class
    • mcp23008.py - MCP23008 class
    • mcp23017.py - MCP23017 class
    • digital_inout.py - the DigitalInOut shim class

NOTE: This will break existing code
. Usage will have to change from this:

import adafruit_mcp230xx
mcp = adafruit_mcp230xx.MCP23008(i2c)

to something like this:

from adafruit_mcp230xx.mcp23008 import MCP23008
mcp = MCP23008(i2c)
@ladyada
Copy link
Member

ladyada commented May 3, 2019

kk!

@caternuson
Copy link
Contributor Author

@dherrada oops, sry, i had already chipped away at this. just PR'd

@evaherrada
Copy link
Collaborator

@caternuson That’s fine. I’ll do some testing of it once it gets merged.

@caternuson
Copy link
Contributor Author

Do you have some bare MCP ICs? That'd be great. I'm only testing with an LCD backpack.

@evaherrada
Copy link
Collaborator

I don't have the bare ones, but I do have the GPIO expander and the LCD backpack.

@caternuson
Copy link
Contributor Author

OK. All green with Sir Travis. Test away #11

Note that the CharLCD library will not work with this refactor until it also gets updated. Very minor tweaks to the imports and MCP setup.

@evaherrada
Copy link
Collaborator

@caternuson Everything got kind of crazy the last week, but I've just been able to test it, and from what I can tell, it works.

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

3 participants