16-bit I/O expander library for I2C bus
Posted: Sat Sep 24, 2016 10:11 pm
Attached is my Arduino library for the Microchip MCP23017 and MCP23018 I/O expander chip. It uses the Arduino Wire library and was developed on a WeMOS D1 mini.
NOT FULLY TESTED.
The input and interrupt facilities have not been tested but the output has been tested and works.
This chip has three addressing pins, so up to eight chips can be chained on an I2C bus for 128 bits of programmable I/O.
By means of uncommenting and/or changing #defined values, the library can be compiled to be as small as possible with support for output on one chip only and no interrupt support, or can be compiled to support all 8 chips with full interrupt support and a callback function for interrupt support on each individual pin.
NOT FULLY TESTED.
The input and interrupt facilities have not been tested but the output has been tested and works.
This chip has three addressing pins, so up to eight chips can be chained on an I2C bus for 128 bits of programmable I/O.
By means of uncommenting and/or changing #defined values, the library can be compiled to be as small as possible with support for output on one chip only and no interrupt support, or can be compiled to support all 8 chips with full interrupt support and a callback function for interrupt support on each individual pin.