Skip to main content

i2c

Function i2c 

Source
pub fn i2c(path: impl AsRef<Path>) -> Result<I2cdev, OpenError>
Expand description

Opens an I2C adapter, such as /dev/i2c-1.

§Arguments

  • path - the adapter’s device file.

§Returns

The adapter, implementing the 7-bit and 10-bit I2c traits.

§Errors

Returns OpenError::I2c if the file cannot be opened, which usually means the kernel driver is not enabled or the process lacks permission.