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>
impl<SPI: Instance, Otype, PULL: UpMode> SpiSlave<SPI, u8, Otype, PULL>
Sourcepub 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
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>
impl<SPI: Instance, Otype, PULL> SpiSlave<SPI, u8, Otype, PULL>
Sourcepub fn frame_size_16bit(self) -> SpiSlave<SPI, u16, Otype, PULL>
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>
impl<SPI: Instance, Otype, PULL> SpiSlave<SPI, u16, Otype, PULL>
Sourcepub fn frame_size_8bit(self) -> SpiSlave<SPI, u8, Otype, PULL>
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>
impl<Otype, PULL> SpiSlave<SPI1, u8, Otype, PULL>
pub fn with_tx_dma(self, channel: C3) -> SpiSlaveTxDma<SPI1, C3, Otype, PULL>
pub fn with_rx_dma(self, channel: C2) -> SpiSlaveRxDma<SPI1, C2, Otype, PULL>
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>
impl<Otype, PULL> SpiSlave<SPI2, u8, Otype, PULL>
pub fn with_tx_dma(self, channel: C5) -> SpiSlaveTxDma<SPI2, C5, Otype, PULL>
pub fn with_rx_dma(self, channel: C4) -> SpiSlaveRxDma<SPI2, C4, Otype, PULL>
pub fn with_rx_tx_dma( self, rxchannel: C4, txchannel: C5, ) -> SpiSlaveRxTxDma<SPI2, C4, C5, Otype, PULL>
Methods from Deref<Target = SpiInner<SPI, W>>§
Sourcepub fn bit_format(&mut self, format: SpiBitFormat)
pub fn bit_format(&mut self, format: SpiBitFormat)
Select which frame format is used for data transfers
Sourcepub fn listen(&mut self, event: Event)
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
Sourcepub fn unlisten(&mut self, event: Event)
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
Sourcepub fn is_tx_empty(&self) -> bool
pub fn is_tx_empty(&self) -> bool
Returns true if the tx register is empty (and can accept data)
Sourcepub fn is_rx_not_empty(&self) -> bool
pub fn is_rx_not_empty(&self) -> bool
Returns true if the rx register is not empty (and can be read)
Sourcepub fn is_overrun(&self) -> bool
pub fn is_overrun(&self) -> bool
Returns true if data are received and the previous data have not yet been read from SPI_DR.