Registry / other / linux-embedded-hal

linux-embedded-hal

JSON →
library0.4.1rscratesunverified

Implementation of the `embedded-hal` traits for Linux devices

# Cargo.toml [dependencies] linux-embedded-hal = "0.4.1"
INSTALL
IMPORT
SIG · LINUX-EMBEDDED-HAL
L
linux-embedded-hal
otherrustv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

I2cdev
use linux_embedded_hal::I2cdev;

Read from an I2C device on Linux

use linux_embedded_hal::I2cdev; use embedded_hal::blocking::i2c::WriteRead; fn main() -> Result<(), Box<dyn std::error::Error>> { let mut i2c = I2cdev::new("/dev/i2c-1")?; let mut buf = [0u8; 2]; i2c.write_read(0x76, &[0x00], &mut buf)?; println!("Read: {:?}", buf); Ok(()) }
Debug
Known issues
gotchaRequires root or appropriate permissions to access /dev/i2c-* devices.
fix
Run as root or add user to the i2c group.
affects: >=0.0.0
Upgrade
Version history
0.4.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
linux-embedded-hal — cargo add linux-embedded-hal · libregistry