Well, I did forget an ending bracket } at the end of a function. Fixed that and pushed to Github.
Setup a breadboard with 16 leds on the output. Using the following code to get a binary counting clock.
mcp23s17_REG_SET(IODIR_CTRL, PORT0, 0x0000);
uint16 portval = 0x0000;
os_delay_us(10000); //10ms delay so you can actually see it counting :D
Yes, there is an i2c version of this chip (8 and 16 pin GPIO versions). It would be a good alternative option if we had a hardware i2c controller on the ESP8266.
The downside to software (aka 'bit banging') i2c or SPI, is you have this 80MHz microprocessor core sitting there doing nothing while you have os_delay_us(10000) or something between you banging out the highs and lows of the i2c or SPI commands.
With this, you can write out the entire 16 GPIO pins in a matter of microseconds, letting the hardware SPI module in the ESP8266 do all the work, while the processor goes back to handling your other requirements (servicing Wifi/IP etc).