| Crates.io | i2cdriver |
| lib.rs | i2cdriver |
| version | 0.2.1 |
| created_at | 2023-11-05 07:15:19.797189+00 |
| updated_at | 2024-01-16 20:01:54.941628+00 |
| description | Use Excamera I2CDriver and I2CMini devices from Rust, optionally via embeddded-hal traits. |
| homepage | |
| repository | https://gitlab.com/tschundler/i2cdriver |
| max_upload_size | |
| id | 1025792 |
| size | 34,657 |
This is a support library / driver for using the Excamera I2CDriver or I2CMini devices within Rust/Crablang. It is intended to facilitate the development of embedded-hal-compatible drivers for I2C devices.
This project is not associated with Excamera / James Bowman.
See CONTRIBUTING if you are interested in submitting patches.
The I2CDriver can be initialized with the name of a serial port.
let mut i2c = I2CDriver::open("/dev/ttyUSB0").unwrap();
let mut d = my_i2c_driver::Driver::new(i2c).unwrap();
d.do_the_thing()
Depending on your OS, the port name may appear differently.
/dev/ttyUSB0 or /dev/ttyS0; see the output of sudo dmesg for the
exact device name./dev/ttyACM0; see the output of sudo dmesg for the exact device
name.COM5; see Device Manager for the exact name.This implements both 0.2.x and 1.x embedded-hal traits. They are both enabled by
default, but may be controlled by feature flags, eh0 and eh1.
There is embedded-hal-async support using the async feature. It is not enabled
by default as it requires nightly compiler to build.
One convenient way to manually test changes against real hardware is using
cargo watch combined with example
files.
$ git clone git@gitlab.com:tschundler/i2cdriver.git
cd i2cdriver
cargo watch -- cargo run --example scanbus -- -d /dev/ttyUSB0