embassy-net-esp-hosted

Crates

git

Versions

default

Flavors

SpiInterface

Struct SpiInterface 

Source
pub struct SpiInterface<SPI, IN> { /* private fields */ }
Expand description

Standard SPI interface.

This interface is what’s implemented in the upstream esp-hosted-fg firmware. It uses:

  • An SpiDevice for SPI communication (CS is handled by the device)
  • A handshake pin that signals when the ESP is ready for a new transaction
  • A ready pin that indicates when the ESP has data to send

Implementations§

Source§

impl<SPI, IN> SpiInterface<SPI, IN>
where SPI: SpiDevice, IN: InputPin + Wait,

Source

pub fn new(spi: SPI, handshake: IN, ready: IN) -> Self

Create a new SpiInterface.

Trait Implementations§

Source§

impl<SPI, IN> Interface for SpiInterface<SPI, IN>
where SPI: SpiDevice, IN: InputPin + Wait,

Source§

async fn wait_for_handshake(&mut self)

Wait for the HANDSHAKE signal indicating the ESP is ready for a new transaction.
Source§

async fn wait_for_ready(&mut self)

Wait for the READY signal indicating the ESP has data to send.
Source§

async fn transfer(&mut self, rx: &mut [u8], tx: &[u8])

Perform a SPI transfer, exchanging data with the ESP chip.

Auto Trait Implementations§

§

impl<SPI, IN> Freeze for SpiInterface<SPI, IN>
where SPI: Freeze, IN: Freeze,

§

impl<SPI, IN> RefUnwindSafe for SpiInterface<SPI, IN>
where SPI: RefUnwindSafe, IN: RefUnwindSafe,

§

impl<SPI, IN> Send for SpiInterface<SPI, IN>
where SPI: Send, IN: Send,

§

impl<SPI, IN> Sync for SpiInterface<SPI, IN>
where SPI: Sync, IN: Sync,

§

impl<SPI, IN> Unpin for SpiInterface<SPI, IN>
where SPI: Unpin, IN: Unpin,

§

impl<SPI, IN> UnwindSafe for SpiInterface<SPI, IN>
where SPI: UnwindSafe, IN: UnwindSafe,

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.