Module esp_idf_hal::spi

source ·
Expand description

SPI peripheral control

SPI0 is reserved for accessing flash and sram and therefore not usable for other purposes. SPI1 shares its external pins with SPI0 and therefore has severe restrictions in use.

SPI2 & 3 can be used freely.

The CS pin can be controlled by hardware on esp32 variants (contrary to the description of embedded_hal).

Look at the following table to determine which driver best suits your requirements:

SpiDeviceDriver::newSpiDeviceDriver::new (no CS)SpiSoftCsDeviceDriver::newSpiBusDriver::new
managed cshardware-software triggered-
1 devicexxxx
1-3 devicesx-x-
4-6 devicesonly on esp32c*-x-
more than 6--x-
Dma----
polling transmitxxxx
isr transmit----
async ready----

The [Transfer::transfer], [Write::write] and [WriteIter::write_iter] functions lock the APB frequency and therefore the requests are always run at the requested baudrate. The primitive [FullDuplex::read] and [FullDuplex::send] do not lock the APB frequency and therefore may run at a different frequency.

TODO

  • Quad SPI
  • Slave SPI

Modules

Structs

Enums

Traits

  • A marker interface implemented by all SPI peripherals except SPI1 which should use a fixed set of pins

Type Definitions