[−][src]Module stm32f1xx_hal::spi
Serial Peripheral Interface
To construct the SPI instances, use the Spi::spiX
functions.
The pin parameter is a tuple containing (sck, miso, mosi)
which should be configured as (Alternate<PushPull>, Input<Floating>, Alternate<PushPull>)
.
You can also use NoSck
, NoMiso
or NoMosi
if you don't want to use the pins
SPI1
can use(PA5, PA6, PA7)
or(PB3, PB4, PB5)
.SPI2
can use(PB13, PB14, PB15)
SPI3
can use(PB3, PB4, PB5)
or(PC10, PC11, PC12)
Initialisation example
// Acquire the GPIOB peripheral let mut gpiob = dp.GPIOB.split(&mut rcc.apb2); let pins = ( gpiob.pb13.into_alternate_push_pull(&mut gpiob.crh), gpiob.pb14.into_floating_input(&mut gpiob.crh), gpiob.pb15.into_alternate_push_pull(&mut gpiob.crh), ); let spi_mode = Mode { polarity: Polarity::IdleLow, phase: Phase::CaptureOnFirstTransition, }; let spi = Spi::spi2(dp.SPI2, pins, spi_mode, 100.khz(), clocks, &mut rcc.apb1);
Structs
Mode | SPI mode |
NoMiso | A filler type for when the Miso pin is unnecessary |
NoMosi | A filler type for when the Mosi pin is unnecessary |
NoSck | A filler type for when the SCK pin is unnecessary |
Spi | |
Spi1NoRemap | |
Spi1Remap | |
Spi2NoRemap | |
SpiPayload |
Enums
Error | SPI error |
Phase | Clock phase |
Polarity | Clock polarity |
Traits
FullDuplex | Full duplex (master mode) |
Pins |
Type Definitions
SpiRegisterBlock | |
SpiTxDma |