[][src]Struct i2c_linux::I2c

pub struct I2c<I> { /* fields omitted */ }

A safe wrapper around an I2C device.

Methods

impl I2c<File>
[src]

Open an I2C device

impl<I> I2c<I>
[src]

Creates a new I2C handle with the given file descriptor

Consumes the I2C handle to return the inner file descriptor.

Important traits for &'a mut R

Borrows the inner file descriptor.

Important traits for &'a mut R

Mutably borrows the inner file descriptor.

impl<I: AsRawFd> I2c<I>
[src]

Sets the number of times to retry communication before failing.

Sets a timeout for I2C operations

Set the slave address to communicate with.

Enable or disable SMBus Packet Error Checking.

Retrieve the capabilities of the I2C device. These should be checked before attempting to use certain SMBus commands or I2C flags.

i2c_transfer capabilities of the I2C device. These should be checked before attempting to use any of the protocol mangling flags.

Executes a queue of I2C transfers, separated by repeat START conditions. Data buffers are truncated to the actual read length on completion.

See the I2C_RDWR ioctl for more information.

Sends a single bit to the device, in the place of the Rd/Wr address bit.

Reads a single byte from a device without specifying a 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.

Sends a single byte to a device.

Reads a single byte from a device from the designated register.

Writes a single byte to a device to the designated register.

Reads a 16-bit word from the device register.

Writes a 16-bit word to the device register.

Selects a device register, sends a 16-bit word to it, and read 16-bits of data in return.

Read up to 32 bytes from the designated device register.

Returns the amount of data read.

Write up to 32 bytes to the designated device register.

Sends up to 31 bytes of data to the designated device register, and reads up to 31 bytes in return.

This was introduced in SMBus 2.0

Reads a block of bytes from the designated device register.

Unlike smbus_read_block_data this does not receive a data length. This is limited to 32 bytes due to the use of the Linux SMBus interface. Use i2c_transfer() if more data is needed. write()+read() may also be an option, though will produce an I2C STOP condition between the transfers, which may be undesirable.

Writes a block of bytes from the designated device register.

Unlike smbus_write_block_data this does not transfer the data length. This is limited to 32 bytes due to the use of the Linux SMBus interface. Use i2c_transfer() or write() instead if more data is needed.

Trait Implementations

impl<I: AsRawFd> Master for I2c<I>
[src]

The error type returned by I2C operations.

impl<I: AsRawFd> Address for I2c<I>
[src]

Sets the current slave to address. Read more

impl<I: AsRawFd> Smbus for I2c<I>
[src]

Sends a single bit to the device, in the place of the rd/wr address bit.

Reads a single byte from a device without specifying a register.

Sends a single byte to the device

Reads a byte from the designated register.

Writes a byte to the designated register.

Reads a 16-bit word from the designated register.

Writes a 16-bit word to the designated register.

Writes a 16-bit word to the specified register, then reads a 16-bit word in response. Read more

Reads up to 32 bytes from the designated device register. Read more

Writes up to 32 bytes to the designated device register.

impl<I: AsRawFd> Smbus20 for I2c<I>
[src]

Sends up to 31 bytes of data to the designated register, and reads up to 31 bytes in return. Read more

impl<I: AsRawFd> SmbusPec for I2c<I>
[src]

Enables or disables SMBus Packet Error Checking

impl<I: AsRawFd> BlockTransfer for I2c<I>
[src]

Reads a block of bytes from the designated device register. Read more

Writes a block of bytes to the designated device register. Read more

impl<I: AsRawFd> BulkTransfer for I2c<I>
[src]

Specifies the flags that this implementation supports.

Executes a queue of I2C transfers, separated by repeated START conditions. Data buffers are truncated to the actual read length on completion. Read more

impl<I: AsRawFd> AsRawFd for I2c<I>
[src]

Extracts the raw file descriptor. Read more

impl<I: IntoRawFd> IntoRawFd for I2c<I>
[src]

Consumes this object, returning the raw underlying file descriptor. Read more

impl FromRawFd for I2c<File>
[src]

Constructs a new instance of Self from the given raw file descriptor. Read more

impl<I: Read> Read for I2c<I>
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

🔬 This is a nightly-only experimental API. (read_initializer)

Determines if this Reader can work with buffers of uninitialized memory. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

Important traits for &'a mut R

Creates a "by reference" adaptor for this instance of Read. Read more

Important traits for Bytes<R>

Transforms this Read instance to an [Iterator] over its bytes. Read more

Important traits for Chain<T, U>

Creates an adaptor which will chain this stream with another. Read more

Important traits for Take<T>

Creates an adaptor which will read at most limit bytes from it. Read more

impl<I: Write> Write for I2c<I>
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Important traits for &'a mut R

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

impl<I> Send for I2c<I> where
    I: Send

impl<I> Sync for I2c<I> where
    I: Sync

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Important traits for &'a mut R

Immutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Important traits for &'a mut R

Mutably borrows from an owned value. Read more

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<R> ReadBytesExt for R where
    R: Read + ?Sized

Reads an unsigned 8 bit integer from the underlying reader. Read more

Reads a signed 8 bit integer from the underlying reader. Read more

Reads an unsigned 16 bit integer from the underlying reader. Read more

Reads a signed 16 bit integer from the underlying reader. Read more

Reads an unsigned 24 bit integer from the underlying reader. Read more

Reads a signed 24 bit integer from the underlying reader. Read more

Reads an unsigned 32 bit integer from the underlying reader. Read more

Reads a signed 32 bit integer from the underlying reader. Read more

Reads an unsigned 48 bit integer from the underlying reader. Read more

Reads a signed 48 bit integer from the underlying reader. Read more

Reads an unsigned 64 bit integer from the underlying reader. Read more

Reads a signed 64 bit integer from the underlying reader. Read more

Reads an unsigned n-bytes integer from the underlying reader. Read more

Reads a signed n-bytes integer from the underlying reader. Read more

Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more

Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more

Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more

Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more

Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more

Reads a sequence of signed 16 bit integers from the underlying reader. Read more

Reads a sequence of signed 32 bit integers from the underlying reader. Read more

Reads a sequence of signed 64 bit integers from the underlying reader. Read more

Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more

Deprecated since 1.2.0

: please use read_f32_into instead

DEPRECATED. Read more

Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more

Deprecated since 1.2.0

: please use read_f64_into instead

DEPRECATED. Read more

impl<W> WriteBytesExt for W where
    W: Write + ?Sized

Writes an unsigned 8 bit integer to the underlying writer. Read more

Writes a signed 8 bit integer to the underlying writer. Read more

Writes an unsigned 16 bit integer to the underlying writer. Read more

Writes a signed 16 bit integer to the underlying writer. Read more

Writes an unsigned 24 bit integer to the underlying writer. Read more

Writes a signed 24 bit integer to the underlying writer. Read more

Writes an unsigned 32 bit integer to the underlying writer. Read more

Writes a signed 32 bit integer to the underlying writer. Read more

Writes an unsigned 48 bit integer to the underlying writer. Read more

Writes a signed 48 bit integer to the underlying writer. Read more

Writes an unsigned 64 bit integer to the underlying writer. Read more

Writes a signed 64 bit integer to the underlying writer. Read more

Writes an unsigned n-bytes integer to the underlying writer. Read more

Writes a signed n-bytes integer to the underlying writer. Read more

Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more

Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer. Read more

impl<T> ReadWrite for T where
    T: Master + Read + Write,
    <T as Master>::Error: From<Error>, 
[src]

Initiate an isolated read transfer on the I2C bus, followed by a STOP.

Initiate an isolated write transfer on the I2C bus, followed by a STOP.