ESPHome  1.15.2
Data Structures | Enumerations
esphome::spi Namespace Reference

Data Structures

class  SPIComponent
 
class  SPIDevice
 

Enumerations

enum  SPIBitOrder { BIT_ORDER_LSB_FIRST, BIT_ORDER_MSB_FIRST }
 The bit-order for SPI devices. This defines how the data read from and written to the device is interpreted. More...
 
enum  SPIClockPolarity { CLOCK_POLARITY_LOW = false, CLOCK_POLARITY_HIGH = true }
 The SPI clock signal polarity,. More...
 
enum  SPIClockPhase { CLOCK_PHASE_LEADING, CLOCK_PHASE_TRAILING }
 The SPI clock signal phase. More...
 
enum  SPIDataRate : uint32_t {
  DATA_RATE_1KHZ = 1000, DATA_RATE_200KHZ = 200000, DATA_RATE_1MHZ = 1000000, DATA_RATE_2MHZ = 2000000,
  DATA_RATE_4MHZ = 4000000, DATA_RATE_8MHZ = 8000000
}
 The SPI clock signal data rate. More...
 

Enumeration Type Documentation

◆ SPIBitOrder

The bit-order for SPI devices. This defines how the data read from and written to the device is interpreted.

Enumerator
BIT_ORDER_LSB_FIRST 

The least significant bit is transmitted/received first.

BIT_ORDER_MSB_FIRST 

The most significant bit is transmitted/received first.

Definition at line 11 of file spi.h.

◆ SPIClockPhase

The SPI clock signal phase.

This defines when the data signals are sampled. Most SPI devices use the LEADING clock phase.

Enumerator
CLOCK_PHASE_LEADING 

The data is sampled on a leading clock edge. (CPHA=0)

CLOCK_PHASE_TRAILING 

The data is sampled on a trailing clock edge. (CPHA=1)

Definition at line 37 of file spi.h.

◆ SPIClockPolarity

The SPI clock signal polarity,.

This defines how the clock signal is used. Flipping this effectively inverts the clock signal.

Enumerator
CLOCK_POLARITY_LOW 

The clock signal idles on LOW.

(CPOL=0)

A rising edge means a leading edge for the clock.

CLOCK_POLARITY_HIGH 

The clock signal idles on HIGH.

(CPOL=1)

A falling edge means a trailing edge for the clock.

Definition at line 21 of file spi.h.

◆ SPIDataRate

enum esphome::spi::SPIDataRate : uint32_t

The SPI clock signal data rate.

This defines for what duration the clock signal is HIGH/LOW. So effectively the rate of bytes can be calculated using

effective_byte_rate = spi_data_rate / 16

Implementations can use the pre-defined constants here, or use an integer in the template definition to manually use a specific data rate.

Enumerator
DATA_RATE_1KHZ 
DATA_RATE_200KHZ 
DATA_RATE_1MHZ 
DATA_RATE_2MHZ 
DATA_RATE_4MHZ 
DATA_RATE_8MHZ 

Definition at line 51 of file spi.h.