[][src]Trait rust_i2c::Stream

pub trait Stream {
    fn write(&self, command: Command) -> Result<()>;
fn read(&self, command: Command, rx_len: usize) -> Result<Vec<u8>>;
fn transfer(
        &self,
        command: Command,
        rx_len: usize,
        delay: Duration
    ) -> Result<Vec<u8>>; }

High level read/write trait for I2C connections to implement

Required methods

fn write(&self, command: Command) -> Result<()>

Writes an I2C command

Arguments

command - Command to write

fn read(&self, command: Command, rx_len: usize) -> Result<Vec<u8>>

Reads command result

Arguments

command - Command to read result from rx_len - Amount of data to read

fn transfer(
    &self,
    command: Command,
    rx_len: usize,
    delay: Duration
) -> Result<Vec<u8>>

Writes I2C command and reads result

Arguments

command - Command to write and read from rx_len - Amount of data to read delay - Delay between writing and reading

Loading content...

Implementors

impl Stream for I2CStream[src]

fn write(&self, command: Command) -> Result<()>[src]

Writing

fn read(&self, command: Command, rx_len: usize) -> Result<Vec<u8>>[src]

Reading

fn transfer(
    &self,
    command: Command,
    rx_len: usize,
    delay: Duration
) -> Result<Vec<u8>>
[src]

Read/Write transaction

Loading content...