usb2642-i2c

Crates.iousb2642-i2c
lib.rsusb2642-i2c
version0.1.1
sourcesrc
created_at2020-12-22 15:11:31.937716
updated_at2020-12-22 23:25:20.742546
descriptionA Rust library for interfacing with the USB2642 I2C bus using the linux sg3 SCSI interface.
homepage
repositoryhttps://github.com/hhornbacher/usb2642_i2c
max_upload_size
id326035
size17,444
Harry Hornbacher (hhornbacher)

documentation

https://docs.rs/usb2642_i2c

README

usb2642-i2c

API Crate

A Rust library for interfacing with the USB2642 I2C bus using the linux sg3 SCSI interface.

Usage

const I2C_ADDRESS: I2CAddress = 0x12;

let mut usb2642 = USB2642I2C::open("/dev/sg0").unwrap();

// Write-Only
let mut write_data = [0x01u8, 0x02u8];
usb2642.write(I2C_ADDRESS, &mut data).unwrap();

// Write-Read
let write_data = [register.to_u8().unwrap()];
let read_data = usb2642.write_read(I2C_ADDRESS, &data, 1).unwrap();
Commit count: 28

cargo fmt