Struct i2cdev::linux::LinuxI2CDevice[][src]

pub struct LinuxI2CDevice { /* fields omitted */ }
Expand description

Concrete linux I2C device

Implementations

Create a new I2CDevice for the specified path

Set the slave address for this device

Typically the address is expected to be 7-bits but 10-bit addresses may be supported by the kernel driver in some cases. Little validation is done in Rust as the kernel is good at making sure things are valid.

Note that if you have created a device using I2Device::new(...) it is not necesasry to call this method (it is done internally). Calling this method is only necessary if you need to change the slave device and you do not want to create a new device.

Trait Implementations

Extracts the raw file descriptor. Read more

Read data from the device to fill the provided slice

Write the provided buffer to the device

This sends a single bit to the device, at the place of the Rd/Wr bit

Read a single byte from a device, without specifying a device register

Some devices are so simple that this interface is enough; for others, it is a shorthand if you want to read the same register as in the previous SMBus command.

Write a single byte to a sdevice, without specifying a device register

This is the opposite operation as smbus_read_byte. As with read_byte, no register is specified.

Read a single byte from a device, from a designated register

The register is specified through the Comm byte.

Write a single byte to a specific register on a device

The register is specified through the Comm byte.

Read 2 bytes form a given register on a device

Write 2 bytes to a given register on a device

Select a register, send 16 bits of data to it, and read 16 bits of data

Read a block of up to 32 bytes from a device

The actual number of bytes available to read is returned in the count byte. This code returns a correctly sized vector containing the count bytes read from the device.

Read a block of up to 32 bytes from a device via i2c_smbus_i2c_read_block_data

Write a block of up to 32 bytes to a device

The opposite of the Block Read command, this writes up to 32 bytes to a device, to a designated register that is specified through the Comm byte. The amount of data is specified in the Count byte.

Write a block of up to 32 bytes from a device via i2c_smbus_i2c_write_block_data

Select a register, send 1 to 31 bytes of data to it, and reads 1 to 31 bytes of data from it.

Error type

Issue the provided sequence of I2C transactions

I2C transfer error type

I2C transfer message type

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.