[][src]Struct spidriver::SPIDriver

pub struct SPIDriver<TX: Write<u8>, RX: Read<u8>> { /* fields omitted */ }

SPIDriver represents a connected SPIDriver device.

Methods

impl<TX, RX, TXErr, RXErr> SPIDriver<TX, RX> where
    TX: Write<u8, Error = TXErr>,
    RX: Read<u8, Error = RXErr>, 
[src]

pub fn new(tx: TX, rx: RX) -> Self[src]

new consumes a serial Write and Read implementation to produce an SPIDriver object.

pub fn echo(&mut self, ch: u8) -> Result<u8, Error<TXErr, RXErr>>[src]

echo asks the SPIDriver to echo back the given character.

This method can be useful for detecting whether the remote device on the serial line is actually a SPIDriver: ask it to echo back a few bytes and verify that it does.

pub fn select(&mut self) -> Result<(), Error<TXErr, RXErr>>[src]

select asserts the chip select signal by driving it low.

pub fn unselect(&mut self) -> Result<(), Error<TXErr, RXErr>>[src]

unselect de-asserts the chip select signal by driving it high.

pub fn set_a(&mut self, high: bool) -> Result<(), Error<TXErr, RXErr>>[src]

set_a sets the active state of the auxillary "A" pin on the SPIDriver.

pub fn set_b(&mut self, high: bool) -> Result<(), Error<TXErr, RXErr>>[src]

set_b sets the active state of the auxillary "B" pin on the SPIDriver.

pub fn disconnect(&mut self) -> Result<(), Error<TXErr, RXErr>>[src]

disconnect requests that the SPIDriver disconnect from the SPI signals,

pub fn write(&mut self, data: &[u8]) -> Result<(), Error<TXErr, RXErr>>[src]

write sends up to 64 bytes out over the SPIDriver's MOSI line.

If the given slice is longer than 64 bytes then write will return the Request error.

pub fn transfer<'v>(
    &mut self,
    data: &'v mut [u8]
) -> Result<&'v [u8], Error<TXErr, RXErr>>
[src]

transfer sends up to 64 bytes out over the SPIDriver's MOSI line, and returns the data returned by the target device.

transfer modifies the given array in-place, replacing each byte with the corresponding byte returned from the device. It then returns a slice with the same backing array.

If the given slice is longer than 64 bytes then write will return the Request error.

pub fn write_byte(&mut self, b: u8) -> Result<(), Error<TXErr, RXErr>>[src]

Trait Implementations

impl<TX: Debug + Write<u8>, RX: Debug + Read<u8>> Debug for SPIDriver<TX, RX>[src]

Auto Trait Implementations

impl<TX, RX> Send for SPIDriver<TX, RX> where
    RX: Send,
    TX: Send

impl<TX, RX> Sync for SPIDriver<TX, RX> where
    RX: Sync,
    TX: Sync

impl<TX, RX> Unpin for SPIDriver<TX, RX> where
    RX: Unpin,
    TX: Unpin

Blanket Implementations

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> From<T> for T[src]

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

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

The type returned in the event of a conversion error.

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

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

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