Overview

Driver for a Microchip MCP23017 (I2C) or MCP23S17 (SPI) bus expander..

The MCP23017 is a 16-bit I2C port expander and the MCP23S17 is an 16-bit SPI port expander where each of the bits can function as either an input or an output.

Resources

All correct at time of writing, but as always, manufacturers love to move things around on their website.

Web page

MCP23017

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en023499

MCP23S17

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en023500

Datasheet

http://www.microchip.com/downloads/en/DeviceDoc/21952b.pdf

Test hardware

This code has been tested using a SolderCore controlling a SenseCore.

http://www.soldercore.com/

API Summary

Constants
MCP23017_I2C_ADDR 8-bit I2C address for MCP23017
Functions
mcp23x17_initialize_i2c Initialize bus expander on I2C bus
mcp23x17_initialize_spi Initialize bus expander on SPI bus