Skip to main content

SpiTransport

Struct SpiTransport 

Source
pub struct SpiTransport<'a, S: SpiMaster<'a>, P: Output> { /* private fields */ }
Expand description

4-wire SPI transport: the D/C̅ pin marks the transferred bytes as commands (low) or data (high).

The transport uses the SPI controller directly, so the controller cannot be shared with other devices. Its chip select, clock rate, and mode must be configured before use (SPI mode 0).

Implementations§

Source§

impl<'a, S: SpiMaster<'a>, P: Output> SpiTransport<'a, S, P>

Source

pub fn new(spi: &'a S, dc: &'a P) -> Self

Trait Implementations§

Source§

impl<'a, S: SpiMaster<'a>, P: Output> SpiMasterClient for SpiTransport<'a, S, P>

Source§

fn read_write_done( &self, write_buffer: SubSliceMut<'static, u8>, _read_buffer: Option<SubSliceMut<'static, u8>>, status: Result<usize, ErrorCode>, )

Callback issued when a read/write operation finishes. Read more
Source§

impl<'a, S: SpiMaster<'a>, P: Output> Transport<'a> for SpiTransport<'a, S, P>

Source§

fn set_client(&self, client: &'a dyn TransportClient)

Source§

fn send( &self, kind: DataKind, buffer: &'static mut [u8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Send buffer[1..len] to the controller as kind bytes. Read more

Auto Trait Implementations§

§

impl<'a, S, P> !Freeze for SpiTransport<'a, S, P>

§

impl<'a, S, P> !RefUnwindSafe for SpiTransport<'a, S, P>

§

impl<'a, S, P> !Send for SpiTransport<'a, S, P>

§

impl<'a, S, P> !Sync for SpiTransport<'a, S, P>

§

impl<'a, S, P> !UnwindSafe for SpiTransport<'a, S, P>

§

impl<'a, S, P> Unpin for SpiTransport<'a, S, P>

§

impl<'a, S, P> UnsafeUnpin for SpiTransport<'a, S, P>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.