Crates.io | mcp2221 |
lib.rs | mcp2221 |
version | 0.1.1 |
source | src |
created_at | 2022-08-26 00:11:30.776718 |
updated_at | 2022-09-21 01:50:22.760161 |
description | MCP2221 I2C/GPIO driver |
homepage | |
repository | https://github.com/google/mcp2221-rs |
max_upload_size | |
id | 652468 |
size | 50,013 |
This library allows your code to control an MCP2221 or MCP2221A over USB for the purposes of talking I2C or using the GPIO pins. It doesn't support the UART feature of the MCP2221 although PRs are welcome.
I2C traits from the embedded-hal are used, allowing relatively easy switching between this I2C interface and something like linux-embedded-hal for devices that are supported directly by the kernel.
This library has only been tested on Linux, but it uses rusb to access the USB bus and that supports other platforms, so there's a moderate chance it will work on more than just Linux.
See examples/scan_bus.rs.
In order to allow access to the USB device, it's recommended to create a udev
rule. e.g. create /etc/udev/rules.d/71-mcp.rules
with the following content:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", GROUP="plugdev", TAG+="uaccess"
This rule allows access to the device by the user physically logged into the computer (uaccess) and to anyone in the plugdev group.
See docs/contributing.md.
This is not an officially supported Google product.
This project is licensed under either of
at your option.