MCP23S17 driver
A driver for the MCP23S17 I/O expander which is accessed over an SPI bus.
Example usage
// spi implements the SPI traits from embedded_hal
// cs_pin implements the OutputPin embedded_hal
// The hardware address corresponds to the way the pins A0, A1, A2 are physically connected
let mut mcp23s17 = new.ok.unwrap;
// Configure pin GPA0 as an output
mcp23s17.pin_mode.ok.unwrap;
// Set pin GPA0 high
mcp23s17.set_high;
// Configure pin GPA1 as an pullup input
mcp23s17.pin_mode.ok.unwrap;
// Read GPA1's level
let is_high = mcp23s17.read;
Acknowledgements
Many of the documentation comments in this library are taken direct from the MCP23S17 datasheet and are © 2005-2022 Microchip Technology Inc. and its subsidiaries.
Inspired by this Arduino MCP23S17 Library and the RPPAL MCP23S17 Library