-
Notifications
You must be signed in to change notification settings - Fork 36
Don't invert the polarity of the GPIO pins by default #21
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
Conversation
i think biggest risk is whether this messes with |
@ladyada I don't have a PID1115. But I do have a bare MCP23008 that I'm wiring up to test this. Stay tuned... |
I don't have one of those either. |
@makermelissa good thing to order, get one of the RGB ones :) |
@ladyada @caternuson would it apply similarly to the RGB versions (PIDs 1110 and 1109)? I have one of those, I'm not whether it's negative or positive. I can test it out later tonight if that is helpful. |
@FoamyGuy yah its the same code - either would be good for testing - either itll work or it wont :) |
Ok, will add to my next order @ladyada. |
The real issue here is the use of a string literal in the ctor's I2C write. This expands out to having bits which get written into both the IODIR and IPOL registers: device.write(b'\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00') I recreated issue #22 with an MCP23008 and also confirmed above change fixes it. @foozmeat Can you update your PR to be like that? Basically identical to original code but with the additional EDIT: The LCD keypads all use an MCP23017, which has a different register layout and init code and do not have this issue. |
@caternuson May I suggest changing the init to writing values to named registers more like how the MCP28017 init code works? I think it reads more clearly to a less experienced person (me). I'm happy to do the work. |
Sure, that approach would work too. Go for it! |
Confirmed that this change has no issues for the PID 1110 LCD. The example code from the learn guide works the same with current adafruit:master and foozmeat:master. I can check again after the discussed changes. |
I set up the init method to match the MCP28017 more closely. There appears to be a typo in
iocon when the property is really io_control . I can sneak that fix into this PR or do another.
|
I tested the updated version with PID 1110 LCD and it is still working as expected. I would lean toward making a new PR for it so it's documented separately for anyone potentially looking for it in the future. |
Cool. Thanks. Looks good. Test it on MCP23008 and works as expected. |
@foozmeat Thanks for finding this and making the PR to fix it. Please open a new issue for the MCP23017 typo. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15 to 2.1.3 from 2.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_ADS1x15#52 from ares-est/master Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 2.0.3 from 2.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#17 from kattni/slideshow-fix > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#14 from dherrada/master > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#16 from kattni/slideshow-example > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#15 from kattni/add-display-object > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#12 from kattni/add-space > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#11 from kattni/variable-change > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#10 from kattni/level-bubble-fix > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#9 from kattni/color-fix > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#8 from kattni/example-update Updating https://github.com/adafruit/Adafruit_CircuitPython_Fingerprint to 1.1.6 from 1.1.5: > Merge pull request adafruit/Adafruit_CircuitPython_Fingerprint#11 from stitchesnburns/stitchesnburns-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS2MDL to 2.0.2 from 2.0.1: > Update README.rst Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM303_Accel to 1.0.3 from 1.0.2: > Merge pull request adafruit/Adafruit_CircuitPython_LSM303_Accel#5 from BiffoBear/rename-example-file > Merge pull request adafruit/Adafruit_CircuitPython_LSM303_Accel#4 from FoamyGuy/master Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM303DLH_Mag to 1.0.4 from 1.0.3: > Merge pull request adafruit/Adafruit_CircuitPython_LSM303DLH_Mag#5 from FoamyGuy/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx to 2.2.3 from 2.2.2: > Merge pull request adafruit/Adafruit_CircuitPython_MCP230xx#21 from foozmeat/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MPU6050 to 1.0.4 from 1.0.3: > Merge pull request adafruit/Adafruit_CircuitPython_MPU6050#5 from FoamyGuy/master Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.1.10 from 3.1.9: > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#65 from cogliano/master Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.8.9 from 3.8.8: > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#70 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect to 1.0.11 from 1.0.10: > Merge pull request adafruit/Adafruit_CircuitPython_BluefruitConnect#17 from caternuson/controller_example Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 4.2.0 from 4.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#43 from dhalbert/avoid-alloc Updating https://github.com/adafruit/Adafruit_CircuitPython_Gizmo to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_Gizmo#10 from FoamyGuy/master Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_LPS2X
This PR changes the init behavior of the MCP23008 so only the
IODIR
register is set for input and leaves the other registers alone. By writing\xFF
to the second,IPOL
, register it was inverting the polarity of the GPIO ports.