3 releases (stable)

1.0.1 May 5, 2024
1.0.0 Mar 23, 2023
0.1.0 Aug 5, 2022

#212 in Hardware support

Download history 65/week @ 2024-06-08 136/week @ 2024-06-15 89/week @ 2024-06-22 92/week @ 2024-06-29 340/week @ 2024-07-06 100/week @ 2024-07-13 55/week @ 2024-07-20 97/week @ 2024-07-27 127/week @ 2024-08-03 114/week @ 2024-08-10 114/week @ 2024-08-17 192/week @ 2024-08-24 100/week @ 2024-08-31 121/week @ 2024-09-07 72/week @ 2024-09-14 116/week @ 2024-09-21

433 downloads per month
Used in 2 crates

MIT license

12KB
217 lines

mcp230xx

This crate is a no_std driver for the MCP23017 and MCP23008 16-Bit/8-Bit I2C I/O Expanders.

Build Status crates.io Docs

Basic usage

Include this library as a dependency in your Cargo.toml:

[dependencies]
mcp230xx = "0.1"

Use embedded-hal implementation to get I2C handle and then create mcp23017 handle:

use mcp230xx::*;

let pin = Mcp23017::A0;
let mut u = Mcp230xx<I2C, Mcp23017>::default(i2c).unwrap();
u.set_direction(pin, Direction::Output).unwrap();
u.set_gpio(pin, Level::High).unwrap();
assert!(u.gpio(pin).unwrap());

Hardware address pins

Address table

Documentation

API Docs available on docs.rs

Thise crate has evolved from mcp23017.

Minimum supported Rust version (MSRV) is 1.62.0.

License

MIT license

Dependencies

~0.4–0.8MB
~18K SLoC