This post continues after Interrupts Squared.

This is just a quick update to show off the changes done to add a secondary mcp23017. The hardware change is pretty simple, just add it to the existing lines.

Pictures

Most important is probably that the A0 address pin is set to high instead of low. Schematic:

Updated Circuit Diagram

And new pictures (notice some re-wiring):

Long side view

Short side view

Code Changes

On the code side this commit contains the interesting changes. The following are mostly cleanup and re-enabling interrupt style setup.

The uint16_t state became a uint32_t state to fit all bits. Doesn’t really change anything about execution, since it still fits into a register.

And as fair warning, you need to update code with the new hardware and setup both mcp23017, otherwise the interrupt pin might not behave properly.