sumotoy / gpio_expander

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

REQ: ESP32 compability for the MCP23S08 #12

Open rayholland opened 5 years ago

rayholland commented 5 years ago

I managed to get the MCP23S08 lib working for a ESP32 (WEMOS LOLIN with OLED) but i have a problem:

When setting ALL pins as OUTPUTS (mcp.gpioPinMode(OUTPUT)), and set a specific PIN HIGH (mcp.gpioDigitalWrite(3, HIGH)) it works (result GP3 = HIGH).

BUT

When setting a specific pin as OUPUT (mcp.gpioPinMode(3, OUTPUT)) and set this specific PIN HIGH (mcp.gpioDigitalWrite(3, HIGH)) it does NOT work (result GP3 = LOW).

I think it has to do with this line in the lib code. Maybe something specific (BitWise) for AVR?: mode == INPUT ? _gpioDirection |= (1 << pin) :_gpioDirection &= ~(1 << pin);

Any idea what would be wrong?