Expand description

MCP23017 RPI Library

This library provides an interface for the MCP23017 gpio expander chip. It is based on a python library of the same name, found here.

You can view the docs here.

let mut mcp = MCP23017::new(0x20, 1).unwrap();
let led = Pin::new(0).unwrap();
mcp.pin_mode(&led, Mode::Output).unwrap();

loop {
    mcp.output(&led, State::High).unwrap();
    sleep(Duration::from_millis(200));
    mcp.output(&led, State::Low).unwrap();
    sleep(Duration::from_millis(200));
}  

Pin Conversion

PINMCP PINName
021GPA0
122GPA1
223GPA2
324GPA3
425GPA4
526GPA5
627GPA6
728GPA7
81GPB0
92GPB1
103GPB2
114GPB3
125GPB4
136GPB5
147GPB6
158GPB7

License

This software is provided under the MIT license. Click here to view. The original python library is also licensed under MIT. It can be found here.

Structs

MCP23017 i2c Interface
GPIO Pin

Enums

GPIO bank
Interrupt compare mode
MCP23017 Error
Interrupt feature state
INT pin start position
Pin mode
Pin state