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,
) -> Self
pub fn spi1( spi: SPI1, pins: PINS, mapr: &mut MAPR, mode: Mode, freq: Hertz, clocks: Clocks, ) -> 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 (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) -> Self
pub fn spi1_slave(spi: SPI1, pins: PINS, mapr: &mut MAPR, mode: Mode) -> 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<...>, 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,
) -> Self
pub fn spi2( spi: SPI2, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks, ) -> Self
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) -> Self
pub fn spi2_slave(spi: SPI2, pins: PINS, mode: Mode) -> Self
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,
) -> Self
pub fn spi3( spi: SPI3, pins: PINS, mode: Mode, freq: Hertz, clocks: Clocks, ) -> Self
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) -> Self
pub fn spi3_slave(spi: SPI3, pins: PINS, mode: Mode) -> Self
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>
impl<SPI, REMAP, PINS, FrameSize, OP> Spi<SPI, REMAP, PINS, FrameSize, OP>
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.