Struct Master

Source
pub struct Master<F>
where F: AsRawFd + Send + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<F> Master<F>
where F: AsRawFd + Send + 'static,

Source

pub fn into_inner(self) -> F

Source

pub const fn inner_ref(&self) -> &F

Source

pub const fn inner_mut(&mut self) -> &mut F

Source§

impl Master<File>

Source

pub fn from_path<P>( path: P, ) -> impl Future<Item = Self, Error = Error> + Send + 'static
where P: AsRef<Path> + Send + 'static,

Source§

impl<F> Master<F>
where F: AsRawFd + Send + 'static,

Source

pub fn set_retries( self, retries: usize, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Source

pub fn set_timeout( self, duration: Duration, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Source

pub fn set_slave_address( self, address: u16, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Source

pub const fn functionality(&self) -> Functionality

Source

pub fn transfer_flags(&self) -> MessageFlags

Source

pub fn transfer<A, M>( self, messages: SmallVec<M>, ) -> impl Future<Item = (SmallVec<M>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static, M: Array<Item = Message<A>> + Send + 'static,

§Panics

Panics for more messages than I2C_RDWR_IOCTL_MAX_MSGS.

Source

pub fn transfers<A, M, T>( self, transfers: SmallVec<T>, ) -> impl Future<Item = (SmallVec<T>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static, M: Array<Item = Message<A>> + Send + 'static, T: Array<Item = SmallVec<M>> + Send + 'static,

§Panics

Panics for more total messages than I2C_RDWR_IOCTL_MAX_MSGS.

Source

pub fn read_block_data<A>( self, command: u8, data: SmallVec<A>, exact: bool, ) -> impl Future<Item = (SmallVec<A>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Source

pub fn write_block_data<A>( self, command: u8, data: SmallVec<A>, ) -> impl Future<Item = Self, Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Source§

impl<F> Master<F>
where F: AsRawFd + Read + Send + 'static,

Source

pub fn read<A>( self, data: SmallVec<A>, exact: bool, ) -> impl Future<Item = (SmallVec<A>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Source§

impl<F> Master<F>
where F: AsRawFd + Write + Send + 'static,

Source

pub fn write<A>( self, data: SmallVec<A>, exact: bool, ) -> impl Future<Item = (SmallVec<A>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Source§

impl<F> Master<F>
where F: AsRawFd + Send + 'static,

Source

pub fn smbus_set_pec( self, pec: bool, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Enables/Disables Packet Error Checking (PEC).

A Packet Error Code (PEC) is appended at the end of each message transfer by the device that supplied the last data byte, that excludes smbus_write_bit(). An invalid PEC byte will not be acknowledged and result in an io::Error.

Available since version 1.1 of the SMBus specification.

Source

pub fn smbus_write_bit( self, bit: bool, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Writes a command/data bit at the place of the direction bit.

No PEC byte will be appended, see smbus_set_pec().

S address bit [A] P
Source

pub fn smbus_read_byte( self, ) -> impl Future<Item = (u8, Self), Error = Error> + Send + 'static

Reads a command/data byte.

S address R [A] [byte] N P
Source

pub fn smbus_write_byte( self, byte: u8, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Writes a command/data byte.

S address W [A] byte [A] P
Source

pub fn smbus_read_byte_data<A>( self, command: u8, ) -> impl Future<Item = (u8, Self), Error = Error> + Send + 'static

Writes the command byte and reads a data byte.

S address W [A] command  [A]
S address R [A]   [data]  N  P
Source

pub fn smbus_write_byte_data( self, command: u8, data: u8, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Writes the command byte and the data byte.

S address W [A] command [A] [data] [A] P
Source

pub fn smbus_read_word_data( self, command: u8, ) -> impl Future<Item = (u16, Self), Error = Error> + Send + 'static

Writes the command byte and reads a data word.

A data word comprises a low and a high data byte in the order mentioned.

S address W [A]   command  [A]
S address R [A] [data_low]  A  [data_high] N P
Source

pub fn smbus_write_word_data( self, command: u8, data: u16, ) -> impl Future<Item = Self, Error = Error> + Send + 'static

Writes the command byte and the data word.

A data word comprises a low and a high data byte in the order mentioned.

S address W [A] command [A] data_low [A] data_high [A] P
Source

pub fn smbus_process_call( self, command: u8, data: u16, ) -> impl Future<Item = (u16, Self), Error = Error> + Send + 'static

Writes the command byte and the data word and then reads a data word in return.

A data word comprises a low and a high data byte in the order mentioned.

S address W [A] command [A]  data_low  [A]  data_high  [A]
S address R [A]             [data_low]  A  [data_high]  N  P
Source

pub fn smbus_read_block_data<A>( self, command: u8, data: SmallVec<A>, exact: bool, ) -> impl Future<Item = (SmallVec<A>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Writes the command byte and reads a length byte followed by a data block of that length.

The data block length ranges from 1 to 32 bytes.

S address W [A] command  [A]
S address R [A] [length]  A  [data#1] A ... [data#length] N P
Source

pub fn smbus_write_block_data<A>( self, command: u8, data: SmallVec<A>, ) -> impl Future<Item = Self, Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static,

Writes the command byte and a length byte followed by the data block of that length.

The data block length ranges from 1 to 32 bytes.

S address W [A] command [A]
                 length [A] data#1 [A] ... data#length [A] P
Source

pub fn smbus_block_process_call<A, B>( self, command: u8, write_data: SmallVec<A>, read_data: SmallVec<B>, exact: bool, ) -> impl Future<Item = (SmallVec<B>, Self), Error = Error> + Send + 'static
where A: Array<Item = u8> + Send + 'static, B: Array<Item = u8> + Send + 'static,

Writes the command byte and a length byte followed by the write_data block of that length and then reads a length byte followed by a read_data block of that length in return.

The data block length ranges from 1 to 32 bytes.

Available since version 2.0 of the SMBus specification.

S address W [A] command  [A]
                 length  [A]  data#1  [A] ...  data#length  [A]
S address R [A] [length]  A  [data#1]  A  ... [data#length]  N  P

Trait Implementations§

Source§

impl<F> AsRawFd for Master<F>
where F: AsRawFd + Send + 'static,

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl<F> IntoRawFd for Master<F>
where F: AsRawFd + IntoRawFd + Send + 'static,

Source§

fn into_raw_fd(self) -> RawFd

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

Auto Trait Implementations§

§

impl<F> Freeze for Master<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for Master<F>
where F: RefUnwindSafe,

§

impl<F> Send for Master<F>

§

impl<F> Sync for Master<F>
where F: Sync,

§

impl<F> Unpin for Master<F>
where F: Unpin,

§

impl<F> UnwindSafe for Master<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.