[][src]Crate usb2642_i2c

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

Usage example

use usb2642_i2c::{USB2642I2C, I2CAddress};

const I2C_ADDRESS: I2CAddress = 0x12;

if let Ok(mut usb2642) = USB2642I2C::open("/dev/sg0") {
  // Write-Only
  let mut write_data = [0x01, 0x02];
  usb2642.write(I2C_ADDRESS, &mut write_data).unwrap();

  // Write-Read
  let write_data = [0x02];
  let read_data = usb2642.write_read(I2C_ADDRESS, &write_data, 1).unwrap();
}

Structs

SgIoHdr
USB2642I2C
USB2642I2CWriteCommand
USB2642I2CWriteReadCommand

Enums

DataTransferDirection

Constants

SG_INTERFACE_ID_ORIG
SG_IO
USB2642_I2C_WRITE_READ_STREAM
USB2642_I2C_WRITE_STREAM
USB2642_SCSI_OPCODE

Traits

USB2642I2CCommand

Type Definitions

I2CAddress