Closed nelsonroliveira closed 3 years ago
Olá and thanks for the feedback Nelson!
Would you like to try raising your first PR to fix this? There's some info here, which should guide you through it if you feel comfortable. You can't get it wrong as I'll get a chance to review the change before it is merged into the repository. If you don't feel comfortable I'll look at making the change myself.
I've never used it for both input and output in any real project. I was mainly using it for coin-detection using TCRT5000 Photo-interrupters as inputs https://forum.micropython.org/viewtopic.php?t=4347 and the outputs came for free with the library. I've been thinking of bringing this library back to life to build demo projects with ESP01 boards manipulating arrays of GPIOs, but it's just as likely I'll opt for using Arduino Pro Mini clones as IO boards through Firmata, especially since I want to replicate the @ShrimpingIt Simon project and it needs PWM for the beeps.
Intrigued to know what you are using the library for if you have the time to comment.
Please also note there is a new way to get the latest Adafruit-maintained MCP230xx support from Adafruit's @tdicola.
The Adafruit-Blinka repository has a set of modules which you should be able to drop into a Micropython board (tested on ESP8266) to provide a compatibility layer between Micropython and Circuitpython.
Once that is installed, it should be possible to use the mainstream CircuitPython library maintained by @tdicola directly at... https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx ...to get you the latest and greatest support from Adafruit.
In fact, you should be able to use any I2C or UART circuitpython library with Adafruit_Blinka, although YMMV since it's fairly new and minimally tested code. SPI support isn't tested yet.
Alternatively if you are running a suitable platform, then you should be able to flash the latest stable version of Circuitpython directly to your board (eliminating the need for the Micropython->Circuitpython compatibility layer).
PR is live.
Currently studying the ESP32, so as a pet project, I am currently trying to build a TCP ModBus IO expansion module. It's my first wired ethernet project and the ESP32 is so far making it easy on that end while allowing the use of wifi for easy user configuration (user presses button and a wifi ap is temporarily enabled to allow for a simple web page config).
Test bed is a Olimex ESP32-EVB so it does not have an MCP23017, discovered the bug while testing the breadboard connections, if I already had the final boards it would have gone undetected as it will be using separate ICs for inputs and outputs.
So far it's been great, all it's missing now is a modbus slave library and some time with kicad
Unfortunately CircuitPython seems to not be support the ESP32.
Upon reading a pin it becomes impossible to write to another one
Minimal implementation:
Returns
Fix appears to be simple, just changing line 71 to return a bytearray to keep
self.gpio
in the original type set on the__init__()