Struct stm32f1xx_hal::spi::Spi
source · pub struct Spi<SPI, REMAP, PINS, FRAMESIZE, OPERATION = Master> { /* private fields */ }
Implementations§
source§impl<REMAP, PINS> Spi<SPI1, REMAP, PINS, u8, Master>
impl<REMAP, PINS> Spi<SPI1, REMAP, PINS, u8, Master>
sourcepub fn spi1(
spi: SPI1,
pins: PINS,
mapr: &mut MAPR,
mode: Mode,
freq: Hertz,
clocks: Clocks
) -> Selfwhere
REMAP: Remap<Periph = SPI1>,
PINS: Pins<REMAP>,
pub fn spi1(
spi: SPI1,
pins: PINS,
mapr: &mut MAPR,
mode: Mode,
freq: Hertz,
clocks: Clocks
) -> Selfwhere
REMAP: Remap<Periph = SPI1>,
PINS: Pins<REMAP>,
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 (Alternate<...>, Input<...>, Alternate<...>)
.
You can also use NoSck
, NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<REMAP, PINS> Spi<SPI1, REMAP, PINS, u8, Slave>
impl<REMAP, PINS> Spi<SPI1, REMAP, PINS, u8, Slave>
sourcepub fn spi1_slave(spi: SPI1, pins: PINS, mapr: &mut MAPR, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI1>,
PINS: Pins<REMAP, Slave>,
pub fn spi1_slave(spi: SPI1, pins: PINS, mapr: &mut MAPR, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI1>,
PINS: Pins<REMAP, Slave>,
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<...>, Alternate<...>, Input<...>)
.
You can also use NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<REMAP, PINS> Spi<SPI2, REMAP, PINS, u8, Master>
impl<REMAP, PINS> Spi<SPI2, REMAP, PINS, u8, Master>
sourcepub fn spi2(spi: SPI2, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks) -> Selfwhere
REMAP: Remap<Periph = SPI2>,
PINS: Pins<REMAP>,
pub fn spi2(spi: SPI2, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks) -> Selfwhere
REMAP: Remap<Periph = SPI2>,
PINS: Pins<REMAP>,
Constructs an SPI instance using SPI2 in 8bit dataframe mode.
The pin parameter tuple (sck, miso, mosi) should be (PB13, PB14, PB15)
configured as (Alternate<...>, Input<...>, Alternate<...>)
.
You can also use NoSck
, NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<REMAP, PINS> Spi<SPI2, REMAP, PINS, u8, Slave>
impl<REMAP, PINS> Spi<SPI2, REMAP, PINS, u8, Slave>
sourcepub fn spi2_slave(spi: SPI2, pins: PINS, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI2>,
PINS: Pins<REMAP, Slave>,
pub fn spi2_slave(spi: SPI2, pins: PINS, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI2>,
PINS: Pins<REMAP, Slave>,
Constructs an SPI instance using SPI2 in 8bit dataframe mode.
The pin parameter tuple (sck, miso, mosi) should be (PB13, PB14, PB15)
configured as (Input<...>, Alternate<...>, Input<...>)
.
You can also use NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<REMAP, PINS> Spi<SPI3, REMAP, PINS, u8, Master>
impl<REMAP, PINS> Spi<SPI3, REMAP, PINS, u8, Master>
sourcepub fn spi3(spi: SPI3, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks) -> Selfwhere
REMAP: Remap<Periph = SPI3>,
PINS: Pins<REMAP>,
pub fn spi3(spi: SPI3, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks) -> Selfwhere
REMAP: Remap<Periph = SPI3>,
PINS: Pins<REMAP>,
Constructs an SPI instance using SPI3 in 8bit dataframe mode.
The pin parameter tuple (sck, miso, mosi) should be (PB3, PB4, PB5)
configured as (Alternate<...>, Input<...>, Alternate<...>)
.
You can also use NoSck
, NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<REMAP, PINS> Spi<SPI3, REMAP, PINS, u8, Slave>
impl<REMAP, PINS> Spi<SPI3, REMAP, PINS, u8, Slave>
sourcepub fn spi3_slave(spi: SPI3, pins: PINS, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI3>,
PINS: Pins<REMAP>,
pub fn spi3_slave(spi: SPI3, pins: PINS, mode: Mode) -> Selfwhere
REMAP: Remap<Periph = SPI3>,
PINS: Pins<REMAP>,
Constructs an SPI instance using SPI3 in 8bit dataframe mode.
The pin parameter tuple (sck, miso, mosi) should be (PB3, PB4, PB5)
configured as (Input<...>, Alternate<...>, Input<...>)
.
You can also use NoMiso
or NoMosi
if you don’t want to use the pins
source§impl<SPI, REMAP, PINS, FrameSize, OP> Spi<SPI, REMAP, PINS, FrameSize, OP>where
SPI: Instance,
FrameSize: Copy,
impl<SPI, REMAP, PINS, FrameSize, OP> Spi<SPI, REMAP, PINS, FrameSize, OP>where
SPI: Instance,
FrameSize: Copy,
pub fn free(self) -> (SPI, PINS)
pub fn release(self) -> (SPI, PINS)
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.
pub fn is_busy(&self) -> bool
source§impl<SPI, REMAP, PINS, OP> Spi<SPI, REMAP, PINS, u8, OP>where
SPI: Instance,
impl<SPI, REMAP, PINS, OP> Spi<SPI, REMAP, PINS, u8, OP>where
SPI: Instance,
sourcepub fn frame_size_16bit(self) -> Spi<SPI, REMAP, PINS, u16>
pub fn frame_size_16bit(self) -> Spi<SPI, REMAP, PINS, u16>
Converts from 8bit dataframe to 16bit.
source§impl<SPI, REMAP, PINS, OP> Spi<SPI, REMAP, PINS, u16, OP>where
SPI: Instance,
impl<SPI, REMAP, PINS, OP> Spi<SPI, REMAP, PINS, u16, OP>where
SPI: Instance,
sourcepub fn frame_size_8bit(self) -> Spi<SPI, REMAP, PINS, u8>
pub fn frame_size_8bit(self) -> Spi<SPI, REMAP, PINS, u8>
Converts from 16bit dataframe to 8bit.