Struct stm32f4xx_hal::spi::Spi
source · [−]pub struct Spi<SPI, PINS, const BIDI: bool = false, W = u8, OPERATION = Master> { /* private fields */ }
Implementations
sourceimpl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, BIDI, W, OPERATION>
impl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, BIDI, W, OPERATION>
sourceimpl<SPI: Instance, PINS, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, false, W, OPERATION>
impl<SPI: Instance, PINS, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, false, W, OPERATION>
pub fn to_bidi_transfer_mode(self) -> Spi<SPI, PINS, true, W, OPERATION>
sourceimpl<SPI: Instance, PINS, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, true, W, OPERATION>
impl<SPI: Instance, PINS, W: FrameSize, OPERATION: Ms> Spi<SPI, PINS, true, W, OPERATION>
pub fn to_normal_transfer_mode(self) -> Spi<SPI, PINS, false, W, OPERATION>
sourceimpl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize> Spi<SPI, PINS, BIDI, W, Master>
impl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize> Spi<SPI, PINS, BIDI, W, Master>
pub fn to_slave_operation(self) -> Spi<SPI, PINS, BIDI, W, Slave>
sourceimpl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize> Spi<SPI, PINS, BIDI, W, Slave>
impl<SPI: Instance, PINS, const BIDI: bool, W: FrameSize> Spi<SPI, PINS, BIDI, W, Slave>
pub fn to_master_operation(self) -> Spi<SPI, PINS, BIDI, W, Master>
sourceimpl<SPI, PINS, const BIDI: bool, OPERATION: Ms> Spi<SPI, PINS, BIDI, u8, OPERATION>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, OPERATION: Ms> Spi<SPI, PINS, BIDI, u8, OPERATION>where
SPI: Instance,
sourcepub fn frame_size_16bit(self) -> Spi<SPI, PINS, BIDI, u16, OPERATION>
pub fn frame_size_16bit(self) -> Spi<SPI, PINS, BIDI, u16, OPERATION>
Converts from 8bit dataframe to 16bit.
sourceimpl<SPI, PINS, const BIDI: bool, OPERATION: Ms> Spi<SPI, PINS, BIDI, u16, OPERATION>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, OPERATION: Ms> Spi<SPI, PINS, BIDI, u16, OPERATION>where
SPI: Instance,
sourcepub fn frame_size_8bit(self) -> Spi<SPI, PINS, BIDI, u8, OPERATION>
pub fn frame_size_8bit(self) -> Spi<SPI, PINS, BIDI, u8, OPERATION>
Converts from 16bit dataframe to 8bit.
sourceimpl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), false, u8, Master>
impl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), false, u8, Master>
pub fn new(
spi: SPI,
pins: (SCK, MISO, MOSI),
mode: impl Into<Mode>,
freq: Hertz,
clocks: &Clocks
) -> Selfwhere
(SCK, MISO, MOSI): Pins<SPI>,
sourceimpl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), true, u8, Master>
impl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), true, u8, Master>
pub fn new_bidi(
spi: SPI,
pins: (SCK, MISO, MOSI),
mode: impl Into<Mode>,
freq: Hertz,
clocks: &Clocks
) -> Selfwhere
(SCK, MISO, MOSI): Pins<SPI>,
sourceimpl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), false, u8, Slave>
impl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), false, u8, Slave>
pub fn new_slave(
spi: SPI,
pins: (SCK, MISO, MOSI),
mode: impl Into<Mode>,
freq: Hertz,
clocks: &Clocks
) -> Selfwhere
(SCK, MISO, MOSI): Pins<SPI>,
sourceimpl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), true, u8, Slave>
impl<SPI: Instance, SCK, MISO, MOSI> Spi<SPI, (SCK, MISO, MOSI), true, u8, Slave>
pub fn new_bidi_slave(
spi: SPI,
pins: (SCK, MISO, MOSI),
mode: impl Into<Mode>,
freq: Hertz,
clocks: &Clocks
) -> Selfwhere
(SCK, MISO, MOSI): Pins<SPI>,
sourceimpl<SPI, SCK, MISO, MOSI, const BIDI: bool, W, OPERATION> Spi<SPI, (SCK, MISO, MOSI), BIDI, W, OPERATION>where
SPI: Instance,
(SCK, MISO, MOSI): Pins<SPI>,
impl<SPI, SCK, MISO, MOSI, const BIDI: bool, W, OPERATION> Spi<SPI, (SCK, MISO, MOSI), BIDI, W, OPERATION>where
SPI: Instance,
(SCK, MISO, MOSI): Pins<SPI>,
pub fn release(self) -> (SPI, (SCK, MISO, MOSI))
sourceimpl<SPI: Instance, PINS, const BIDI: bool, W, OPERATION> Spi<SPI, PINS, BIDI, W, OPERATION>
impl<SPI: Instance, PINS, const BIDI: bool, W, OPERATION> Spi<SPI, PINS, BIDI, W, OPERATION>
sourcepub fn bit_format(&mut self, format: BitFormat)
pub fn bit_format(&mut self, format: BitFormat)
Select which frame format is used for data transfers
sourcepub fn listen(&mut self, event: Event)
pub fn listen(&mut self, event: Event)
Enable interrupts for the given event
:
- Received data ready to be read (RXNE)
- Transmit data register empty (TXE)
- Transfer error
sourcepub fn unlisten(&mut self, event: Event)
pub fn unlisten(&mut self, event: Event)
Disable interrupts for the given event
:
- Received data ready to be read (RXNE)
- Transmit data register empty (TXE)
- Transfer error
sourcepub fn is_tx_empty(&self) -> bool
pub fn is_tx_empty(&self) -> bool
Return true
if the TXE flag is set, i.e. new data to transmit
can be written to the SPI.
pub fn is_txe(&self) -> bool
👎Deprecated since 0.14.0: please use
is_tx_empty
insteadsourcepub fn is_rx_not_empty(&self) -> bool
pub fn is_rx_not_empty(&self) -> bool
Return true
if the RXNE flag is set, i.e. new data has been received
and can be read from the SPI.
pub fn is_rxne(&self) -> bool
👎Deprecated since 0.14.0: please use
is_rx_not_empty
insteadsourcepub fn is_modf(&self) -> bool
pub fn is_modf(&self) -> bool
Return true
if the MODF flag is set, i.e. the SPI has experienced a
Master Mode Fault. (see chapter 28.3.10 of the STM32F4 Reference Manual)
sourcepub fn is_overrun(&self) -> bool
pub fn is_overrun(&self) -> bool
Return true
if the OVR flag is set, i.e. new data has been received
while the receive data register was already filled.
Trait Implementations
sourceimpl<SPI: Debug, PINS: Debug, const BIDI: bool, W: Debug, OPERATION: Debug> Debug for Spi<SPI, PINS, BIDI, W, OPERATION>
impl<SPI: Debug, PINS: Debug, const BIDI: bool, W: Debug, OPERATION: Debug> Debug for Spi<SPI, PINS, BIDI, W, OPERATION>
sourceimpl<SPI, PINS, const BIDI: bool, W: FrameSize> FullDuplex<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: FrameSize> FullDuplex<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W: FrameSize> FullDuplex<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: FrameSize> FullDuplex<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBus<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBus<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W> SpiBusFlush for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W> SpiBusFlush for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBusRead<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBusRead<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBusWrite<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: FrameSize + 'static> SpiBusWrite<W> for Spi<SPI, PINS, BIDI, W>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool, W: Copy + 'static> Transactional<W> for Spi<SPI, PINS, BIDI, W>where
Self: Transfer<W, Error = Error> + Write<W, Error = Error>,
SPI: Instance,
impl<SPI, PINS, const BIDI: bool, W: Copy + 'static> Transactional<W> for Spi<SPI, PINS, BIDI, W>where
Self: Transfer<W, Error = Error> + Write<W, Error = Error>,
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool> Transfer<u16> for Spi<SPI, PINS, BIDI, u16>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool> Transfer<u16> for Spi<SPI, PINS, BIDI, u16>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool> Transfer<u8> for Spi<SPI, PINS, BIDI, u8>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool> Transfer<u8> for Spi<SPI, PINS, BIDI, u8>where
SPI: Instance,
sourceimpl<SPI, PINS, const BIDI: bool> Write<u16> for Spi<SPI, PINS, BIDI, u16>where
SPI: Instance,
impl<SPI, PINS, const BIDI: bool> Write<u16> for Spi<SPI, PINS, BIDI, u16>where
SPI: Instance,
Auto Trait Implementations
impl<SPI, PINS, const BIDI: bool, W, OPERATION> RefUnwindSafe for Spi<SPI, PINS, BIDI, W, OPERATION>where
OPERATION: RefUnwindSafe,
PINS: RefUnwindSafe,
SPI: RefUnwindSafe,
W: RefUnwindSafe,
impl<SPI, PINS, const BIDI: bool, W, OPERATION> Send for Spi<SPI, PINS, BIDI, W, OPERATION>where
OPERATION: Send,
PINS: Send,
SPI: Send,
W: Send,
impl<SPI, PINS, const BIDI: bool, W, OPERATION> Sync for Spi<SPI, PINS, BIDI, W, OPERATION>where
OPERATION: Sync,
PINS: Sync,
SPI: Sync,
W: Sync,
impl<SPI, PINS, const BIDI: bool, W, OPERATION> Unpin for Spi<SPI, PINS, BIDI, W, OPERATION>where
OPERATION: Unpin,
PINS: Unpin,
SPI: Unpin,
W: Unpin,
impl<SPI, PINS, const BIDI: bool, W, OPERATION> UnwindSafe for Spi<SPI, PINS, BIDI, W, OPERATION>where
OPERATION: UnwindSafe,
PINS: UnwindSafe,
SPI: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more