idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
SPI Component

Type-safe SPI master bus driver for ESP32. More...

Namespaces

namespace  idfxx
 
namespace  idfxx::spi
 SPI driver classes.
 

Classes

struct  idfxx::spi::bus_config
 SPI bus configuration. More...
 
class  idfxx::spi::master_bus
 A SPI master bus. More...
 

Enumerations

enum class  idfxx::spi::host_device : int {
  idfxx::spi::host_device::spi1 = SPI1_HOST ,
  idfxx::spi::host_device::spi2 = SPI2_HOST ,
  idfxx::spi::host_device::spi3 = SPI3_HOST
}
 General purpose SPI Host Controller ID. More...
 
enum class  idfxx::spi::dma_chan : int {
  idfxx::spi::dma_chan::disabled = SPI_DMA_DISABLED ,
  idfxx::spi::dma_chan::ch_auto = SPI_DMA_CH_AUTO
}
 SPI DMA channel selection. More...
 
enum class  idfxx::spi::bus_flags : uint32_t {
  idfxx::spi::bus_flags::slave = SPICOMMON_BUSFLAG_SLAVE ,
  idfxx::spi::bus_flags::master = SPICOMMON_BUSFLAG_MASTER ,
  idfxx::spi::bus_flags::iomux_pins = SPICOMMON_BUSFLAG_IOMUX_PINS ,
  idfxx::spi::bus_flags::sclk = SPICOMMON_BUSFLAG_SCLK ,
  idfxx::spi::bus_flags::miso = SPICOMMON_BUSFLAG_MISO ,
  idfxx::spi::bus_flags::mosi = SPICOMMON_BUSFLAG_MOSI ,
  idfxx::spi::bus_flags::dual ,
  idfxx::spi::bus_flags::wphd = SPICOMMON_BUSFLAG_WPHD ,
  idfxx::spi::bus_flags::quad = SPICOMMON_BUSFLAG_QUAD ,
  idfxx::spi::bus_flags::io4_io7 = SPICOMMON_BUSFLAG_IO4_IO7 ,
  idfxx::spi::bus_flags::octal = SPICOMMON_BUSFLAG_OCTAL ,
  idfxx::spi::bus_flags::native_pins = SPICOMMON_BUSFLAG_NATIVE_PINS ,
  idfxx::spi::bus_flags::slp_allow_pd = SPICOMMON_BUSFLAG_SLP_ALLOW_PD
}
 SPI bus capability and configuration flags. More...
 

Detailed Description

Type-safe SPI master bus driver for ESP32.

Provides SPI bus lifecycle management with support for DMA transfers.

Depends on Core Utilities for error handling and GPIO Component for pin configuration.

Enumeration Type Documentation

◆ bus_flags

enum class idfxx::spi::bus_flags : uint32_t
strong

SPI bus capability and configuration flags.

These flags serve two purposes:

  • When passed to bus initialization, they specify required bus capabilities that the driver will verify (e.g., requiring certain pins to be present).
  • After initialization, they indicate the actual capabilities of the bus.
Enumerator
slave 

Bus supports slave mode.

master 

Bus supports master mode.

iomux_pins 

Bus uses IOMUX pins.

sclk 

Check existing of SCLK pin. Or indicates CLK line initialized.

miso 

Check existing of MISO pin. Or indicates MISO line initialized.

mosi 

Check existing of MOSI pin. Or indicates MOSI line initialized.

dual 

Check MOSI and MISO pins can output. Or indicates bus able to work under DIO mode.

wphd 

Check existing of WP and HD pins. Or indicates WP & HD pins initialized.

quad 

Check existing of MOSI/MISO/WP/HD pins as output.

Or indicates bus able to work under QIO mode.

io4_io7 

Check existing of IO4~IO7 pins. Or indicates IO4~IO7 pins initialized.

octal 

Check existing of MOSI/MISO/WP/HD/SPIIO4/SPIIO5/SPIIO6/SPIIO7 pins as output.

Or indicates bus able to work under octal mode.

native_pins 

Bus uses native pins.

slp_allow_pd 

Allow to power down the peripheral during light sleep, and auto recover then.

Definition at line 70 of file master.hpp.

◆ dma_chan

enum class idfxx::spi::dma_chan : int
strong

SPI DMA channel selection.

Enumerator
disabled 

No DMA.

ch_auto 

Auto select DMA channel.

Definition at line 52 of file master.hpp.

◆ host_device

enum class idfxx::spi::host_device : int
strong

General purpose SPI Host Controller ID.

Enumerator
spi1 

SPI1.

spi2 

SPI2.

spi3 

SPI3.

Definition at line 40 of file master.hpp.