sumotoy / gpio_expander

A library for drive a lot of GPIO chips with Arduino/Teensy3.x or LC
66 stars 29 forks source link

Does this library work on ESP8266? #5

Open cb88 opened 7 years ago

cb88 commented 7 years ago

I'm designing a board around the ESP-WROOM-02 and have and am planning on using the MPC23S18 as IO expansion due to it's small size 4x4mm and I only needing 3 outputs (1 IRDA shutdown and 2 outputs though an optoisolator). If I had needed more outputs I probably would not have used the open drain version despite it's small size.

I forgot the pullup resistors on my 2 optoisolator outputs but I'll just hack them on for testing once I have the boards in hand. I'll be sure you let you know how it goes.

cb88 commented 7 years ago

So I went through and deleted all but MCP23s18 MCP23s17 .cpp and .h and also commented out from those getInterruptNumber(byte pin) and #include <avr/interrupt.h> in gpio_expander.cpp this gets me to a building library but I haven't tested it yet.

tonton81 commented 7 years ago

I dont know if its compatible or not but if you know how spi works you can write your own code to set the pins on the mcp23s17/18's, i wrote one but its private for my own use, 4 functions are all you need, with the added bonus of not cycling devices when rebooting the mcu and hot-pluggable! I havnt seen libraries do this :)

Sent from my iPhone

On Jul 20, 2016, at 2:45 PM, "cb88" notifications@github.com<mailto:notifications@github.com> wrote:

So I went through and deleted all but MCP23s18 MCP23s17 .cpp and .h and also commented out from those getInterruptNumber(byte pin) and #include in gpio_expander.cpp this gets me to a building library but I haven't tested it yet.

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/sumotoy/gpio_expander/issues/5#issuecomment-234043443, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQHrjMCHnauB0xq6Zx6StdyR3ktOQAFbks5qXmzGgaJpZM4JQ3ly.

sumotoy commented 7 years ago

A new library for MCP23S17 is coming in a couple of days. I decided to keep the interrupts separate so you can esily handle yourself. As always I provide a lot of examples (included some advanced that uses in/out rotation never released in any library to handle large matrices). Apart the interrupt suff (that you can handle separately) the library should work as is but if you can wayt a couple of days you will see a better specialized library.

PS I suggest use the MCP23S17 instead MCP23S18, the only main difference is the open drain output, if you really need this it's very easy to adapt since it uses the same registers.

cb88 commented 7 years ago

Yes, I'm aware, the board's I've ordered already have MCP23S18 on them and it isn't a direct swap as the foot print is different and as I mentioned earlier it is larger. On the upside the open drain outputs can sink more current and I do understand how they work.

sumotoy commented 7 years ago

library moved here: https://github.com/sumotoy/gpio_MCP23SXX Beware, MCP23S18 doesn't have HAEN.