SpiSlave

Struct SpiSlave 

Source
pub struct SpiSlave<SPI: Instance, W, Otype = PushPull, PULL = Floating> { /* private fields */ }
Expand description

Spi in Slave mode

Implementations§

Source§

impl<SPI: Instance, Otype, PULL: UpMode> SpiSlave<SPI, u8, Otype, PULL>

Source

pub fn new<const R: u8>( spi: impl Into<Rmp<SPI, R>>, pins: (Option<impl RInto<SPI::SSck, R>>, Option<impl RInto<SPI::So<Otype>, R>>, Option<impl RInto<SPI::Si<PULL>, R>>), mode: Mode, rcc: &mut RCC, ) -> Self

Constructs an SPI instance using SPI1 in 8bit dataframe mode.

The pin parameter tuple (sck, miso, mosi) should be (PA5, PA6, PA7) or (PB3, PB4, PB5) configured as (Input<Floating>, Alternate<...>, Input<...>).

You can also use NoMiso or NoMosi if you don’t want to use the pins

Source§

impl<SPI: Instance, Otype, PULL> SpiSlave<SPI, u8, Otype, PULL>

Source

pub fn release( self, ) -> (SPI, (Option<SPI::SSck>, Option<SPI::So<Otype>>, Option<SPI::Si<PULL>>))

Source§

impl<SPI: Instance, Otype, PULL> SpiSlave<SPI, u8, Otype, PULL>

Source

pub fn frame_size_16bit(self) -> SpiSlave<SPI, u16, Otype, PULL>

Converts from 8bit dataframe to 16bit.

Source§

impl<SPI: Instance, Otype, PULL> SpiSlave<SPI, u16, Otype, PULL>

Source

pub fn frame_size_8bit(self) -> SpiSlave<SPI, u8, Otype, PULL>

Converts from 16bit dataframe to 8bit.

Source§

impl<Otype, PULL> SpiSlave<SPI1, u8, Otype, PULL>

Source

pub fn with_tx_dma(self, channel: C3) -> SpiSlaveTxDma<SPI1, C3, Otype, PULL>

Source

pub fn with_rx_dma(self, channel: C2) -> SpiSlaveRxDma<SPI1, C2, Otype, PULL>

Source

pub fn with_rx_tx_dma( self, rxchannel: C2, txchannel: C3, ) -> SpiSlaveRxTxDma<SPI1, C2, C3, Otype, PULL>

Source§

impl<Otype, PULL> SpiSlave<SPI2, u8, Otype, PULL>

Source

pub fn with_tx_dma(self, channel: C5) -> SpiSlaveTxDma<SPI2, C5, Otype, PULL>

Source

pub fn with_rx_dma(self, channel: C4) -> SpiSlaveRxDma<SPI2, C4, Otype, PULL>

Source

pub fn with_rx_tx_dma( self, rxchannel: C4, txchannel: C5, ) -> SpiSlaveRxTxDma<SPI2, C4, C5, Otype, PULL>

Methods from Deref<Target = SpiInner<SPI, W>>§

Source

pub fn bit_format(&mut self, format: SpiBitFormat)

Select which frame format is used for data transfers

Source

pub fn listen(&mut self, event: Event)

Starts listening to the SPI by enabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt

Source

pub fn unlisten(&mut self, event: Event)

Stops listening to the SPI by disabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt

Source

pub fn is_tx_empty(&self) -> bool

Returns true if the tx register is empty (and can accept data)

Source

pub fn is_rx_not_empty(&self) -> bool

Returns true if the rx register is not empty (and can be read)

Source

pub fn is_busy(&self) -> bool

Returns true if the transfer is in progress

Source

pub fn is_overrun(&self) -> bool

Returns true if data are received and the previous data have not yet been read from SPI_DR.

Source

pub fn read_nonblocking(&mut self) -> Result<W, Error>

Source

pub fn write_nonblocking(&mut self, data: W) -> Result<(), Error>

Source

pub fn write(&mut self, words: &[W]) -> Result<(), Error>

Source

pub fn transfer_in_place(&mut self, words: &mut [W]) -> Result<(), Error>

Source

pub fn transfer(&mut self, buff: &mut [W], data: &[W]) -> Result<(), Error>

Source

pub fn flush(&mut self) -> Result<(), Error>

Source

pub fn read(&mut self, words: &mut [W]) -> Result<(), Error>

Trait Implementations§

Source§

impl<SPI: Instance, W, Otype, PULL> Deref for SpiSlave<SPI, W, Otype, PULL>

Source§

type Target = SpiInner<SPI, W>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<SPI: Instance, W, Otype, PULL> DerefMut for SpiSlave<SPI, W, Otype, PULL>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<SPI, W, Otype, PULL> Freeze for SpiSlave<SPI, W, Otype, PULL>
where SPI: Freeze, <SPI as SpiCommon>::SSck: Freeze, <SPI as SpiCommon>::So<Otype>: Freeze, <SPI as SpiCommon>::Si<PULL>: Freeze,

§

impl<SPI, W, Otype, PULL> RefUnwindSafe for SpiSlave<SPI, W, Otype, PULL>
where SPI: RefUnwindSafe, W: RefUnwindSafe, <SPI as SpiCommon>::SSck: RefUnwindSafe, <SPI as SpiCommon>::So<Otype>: RefUnwindSafe, <SPI as SpiCommon>::Si<PULL>: RefUnwindSafe,

§

impl<SPI, W, Otype, PULL> Send for SpiSlave<SPI, W, Otype, PULL>
where SPI: Send, W: Send, <SPI as SpiCommon>::SSck: Send, <SPI as SpiCommon>::So<Otype>: Send, <SPI as SpiCommon>::Si<PULL>: Send,

§

impl<SPI, W, Otype, PULL> Sync for SpiSlave<SPI, W, Otype, PULL>
where SPI: Sync, W: Sync, <SPI as SpiCommon>::SSck: Sync, <SPI as SpiCommon>::So<Otype>: Sync, <SPI as SpiCommon>::Si<PULL>: Sync,

§

impl<SPI, W, Otype, PULL> Unpin for SpiSlave<SPI, W, Otype, PULL>
where SPI: Unpin, W: Unpin, <SPI as SpiCommon>::SSck: Unpin, <SPI as SpiCommon>::So<Otype>: Unpin, <SPI as SpiCommon>::Si<PULL>: Unpin,

§

impl<SPI, W, Otype, PULL> UnwindSafe for SpiSlave<SPI, W, Otype, PULL>
where SPI: UnwindSafe, W: UnwindSafe, <SPI as SpiCommon>::SSck: UnwindSafe, <SPI as SpiCommon>::So<Otype>: UnwindSafe, <SPI as SpiCommon>::Si<PULL>: 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, const R: u8> RFrom<T, R> for T

Source§

fn rfrom(value: T) -> T

Source§

impl<S, T, const R: u8> RInto<T, R> for S
where T: RFrom<S, R>,

Source§

fn rinto(self) -> T

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.