capsules_core::virtualizers::virtual_spi

Struct VirtualSpiMasterDevice

Source
pub struct VirtualSpiMasterDevice<'a, Spi: SpiMaster<'a>> { /* private fields */ }

Implementations§

Source§

impl<'a, Spi: SpiMaster<'a>> VirtualSpiMasterDevice<'a, Spi>

Source

pub fn new( mux: &'a MuxSpiMaster<'a, Spi>, chip_select: Spi::ChipSelect, ) -> VirtualSpiMasterDevice<'a, Spi>

Source

pub fn setup(&'a self)

Must be called right after static_init!().

Trait Implementations§

Source§

impl<'a, Spi: SpiMaster<'a>> ListNode<'a, VirtualSpiMasterDevice<'a, Spi>> for VirtualSpiMasterDevice<'a, Spi>

Source§

fn next(&'a self) -> &'a ListLink<'a, VirtualSpiMasterDevice<'a, Spi>>

Source§

impl<'a, Spi: SpiMaster<'a>> SpiMasterClient for VirtualSpiMasterDevice<'a, Spi>

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, Spi: SpiMaster<'a>> SpiMasterDevice<'a> for VirtualSpiMasterDevice<'a, Spi>

Source§

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

Set the callback for read_write operations.
Source§

fn configure( &self, cpol: ClockPolarity, cpal: ClockPhase, rate: u32, ) -> Result<(), ErrorCode>

Configure the bus for this chip select.
Source§

fn read_write_bytes( &self, write_buffer: SubSliceMut<'static, u8>, read_buffer: Option<SubSliceMut<'static, u8>>, ) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>, Option<SubSliceMut<'static, u8>>)>

Source§

fn set_polarity(&self, cpol: ClockPolarity) -> Result<(), ErrorCode>

Source§

fn set_phase(&self, cpal: ClockPhase) -> Result<(), ErrorCode>

Source§

fn set_rate(&self, rate: u32) -> Result<(), ErrorCode>

Source§

fn get_polarity(&self) -> ClockPolarity

Return the current bus polarity.
Source§

fn get_phase(&self) -> ClockPhase

Get the current bus phase for the current chip select.
Source§

fn get_rate(&self) -> u32

Return the current chip select’s clock rate.

Auto Trait Implementations§

§

impl<'a, Spi> !Freeze for VirtualSpiMasterDevice<'a, Spi>

§

impl<'a, Spi> !RefUnwindSafe for VirtualSpiMasterDevice<'a, Spi>

§

impl<'a, Spi> !Send for VirtualSpiMasterDevice<'a, Spi>

§

impl<'a, Spi> !Sync for VirtualSpiMasterDevice<'a, Spi>

§

impl<'a, Spi> Unpin for VirtualSpiMasterDevice<'a, Spi>
where <Spi as SpiMaster<'a>>::ChipSelect: Unpin,

§

impl<'a, Spi> !UnwindSafe for VirtualSpiMasterDevice<'a, Spi>

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.