[][src]Trait embedded_spi::Transactional

pub trait Transactional {
    type Error;
    fn spi_read(
        &mut self,
        prefix: &[u8],
        data: &mut [u8]
    ) -> Result<(), Self::Error>;
fn spi_write(
        &mut self,
        prefix: &[u8],
        data: &[u8]
    ) -> Result<(), Self::Error>;
fn spi_exec(
        &mut self,
        transactions: &mut [Transaction]
    ) -> Result<(), Self::Error>; }

Transaction trait provides higher level, transaction-based, SPI constructs These are executed in a single SPI transaction (without de-asserting CS).

Associated Types

type Error

Loading content...

Required methods

fn spi_read(
    &mut self,
    prefix: &[u8],
    data: &mut [u8]
) -> Result<(), Self::Error>

Read writes the prefix buffer then reads into the input buffer Note that the values of the input buffer will also be output, because, SPI...

fn spi_write(&mut self, prefix: &[u8], data: &[u8]) -> Result<(), Self::Error>

Write writes the prefix buffer then writes the output buffer

fn spi_exec(
    &mut self,
    transactions: &mut [Transaction]
) -> Result<(), Self::Error>

Transfer writes the outgoing buffer while reading into the incoming buffer note that outgoing and incoming must have the same length Exec allows 'Transaction' objects to be chained together into a single transaction

Loading content...

Implementors

impl Transactional for Spi[src]

type Error = Error<(), ()>

fn spi_read(
    &mut self,
    prefix: &[u8],
    data: &mut [u8]
) -> Result<(), Self::Error>
[src]

Read data from a specified address This consumes the provided input data array and returns a reference to this on success

fn spi_write(&mut self, prefix: &[u8], data: &[u8]) -> Result<(), Self::Error>[src]

Write data to a specified register address

fn spi_exec(
    &mut self,
    transactions: &mut [Transaction]
) -> Result<(), Self::Error>
[src]

Execute the provided transactions

impl<Spi, SpiError, Output, Input, PinError, Delay> Transactional for Wrapper<Spi, SpiError, Output, Input, PinError, Delay> where
    Spi: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
    Output: OutputPin<Error = PinError>,
    Input: InputPin<Error = PinError>,
    Delay: DelayMs<u32>, 
[src]

type Error = Error<SpiError, PinError>

fn spi_read<'a>(
    &mut self,
    prefix: &[u8],
    data: &'a mut [u8]
) -> Result<(), Self::Error>
[src]

Read data from a specified address This consumes the provided input data array and returns a reference to this on success

fn spi_write(&mut self, prefix: &[u8], data: &[u8]) -> Result<(), Self::Error>[src]

Write data to a specified register address

fn spi_exec(
    &mut self,
    transactions: &mut [Transaction]
) -> Result<(), Self::Error>
[src]

Execute the provided transactions

Loading content...