I think you will need to write your own library. This isn't as bad as it seems. If the library uses analog write then it won't work, because I don't think you can do PWM with that expander.
The library writes directly to pins. You need to intercept this behaviour and tell the library to tell the MCP230008 to write to the pin. I haven't seen the library I question, but this should be straight forward.
If you take the existing Adafruit library and find where it writes to a pin. Rather than calling digitalWrite
it needs to call expanderWrite(pin, state)
. Every instance of pinMode()
needs replacing with explanderPinMode(pin, mode)
Then write yourself those two functions that use I2C/SPI to set the IOX's registers to implement what you need.
The IO Expander is not going to be a good idea if the library requires critical accurate timing, because of the lag of telling the IOX to do things. An alternative is to use another D1 as the IO expander.