ESPHome  2024.9.2
Public Member Functions | Protected Attributes
esphome::spi::SPIDelegate Class Referenceabstract

#include <spi.h>

Inheritance diagram for esphome::spi::SPIDelegate:
esphome::spi::SPIDelegateBitBash

Public Member Functions

 SPIDelegate ()=default
 
 SPIDelegate (uint32_t data_rate, SPIBitOrder bit_order, SPIMode mode, GPIOPin *cs_pin)
 
virtual ~SPIDelegate ()
 
virtual void begin_transaction ()
 
virtual void end_transaction ()
 
virtual uint8_t transfer (uint8_t data)=0
 
virtual void transfer (uint8_t *ptr, size_t length)
 
virtual void transfer (const uint8_t *txbuf, uint8_t *rxbuf, size_t length)
 
virtual void write (uint16_t data, size_t num_bits)
 write a variable length data item, up to 16 bits. More...
 
virtual void write_cmd_addr_data (size_t cmd_bits, uint32_t cmd, size_t addr_bits, uint32_t address, const uint8_t *data, size_t length, uint8_t bus_width)
 
virtual void write16 (uint16_t data)
 
virtual void write_array16 (const uint16_t *data, size_t length)
 
virtual void write_array (const uint8_t *ptr, size_t length)
 
virtual void read_array (uint8_t *ptr, size_t length)
 
virtual bool is_ready ()
 

Protected Attributes

SPIBitOrder bit_order_ {BIT_ORDER_MSB_FIRST}
 
uint32_t data_rate_ {1000000}
 
SPIMode mode_ {MODE0}
 
GPIOPincs_pin_ {NullPin::NULL_PIN}
 

Detailed Description

Definition at line 168 of file spi.h.

Constructor & Destructor Documentation

◆ SPIDelegate() [1/2]

esphome::spi::SPIDelegate::SPIDelegate ( )
default

◆ SPIDelegate() [2/2]

esphome::spi::SPIDelegate::SPIDelegate ( uint32_t  data_rate,
SPIBitOrder  bit_order,
SPIMode  mode,
GPIOPin cs_pin 
)
inline

Definition at line 174 of file spi.h.

◆ ~SPIDelegate()

virtual esphome::spi::SPIDelegate::~SPIDelegate ( )
inlinevirtual

Definition at line 182 of file spi.h.

Member Function Documentation

◆ begin_transaction()

virtual void esphome::spi::SPIDelegate::begin_transaction ( )
inlinevirtual

Definition at line 185 of file spi.h.

◆ end_transaction()

virtual void esphome::spi::SPIDelegate::end_transaction ( )
inlinevirtual

Definition at line 188 of file spi.h.

◆ is_ready()

bool esphome::spi::SPIDelegate::is_ready ( )
virtual

Definition at line 10 of file spi.cpp.

◆ read_array()

virtual void esphome::spi::SPIDelegate::read_array ( uint8_t *  ptr,
size_t  length 
)
inlinevirtual

Definition at line 238 of file spi.h.

◆ transfer() [1/3]

virtual uint8_t esphome::spi::SPIDelegate::transfer ( uint8_t  data)
pure virtual

◆ transfer() [2/3]

virtual void esphome::spi::SPIDelegate::transfer ( uint8_t *  ptr,
size_t  length 
)
inlinevirtual

Definition at line 194 of file spi.h.

◆ transfer() [3/3]

virtual void esphome::spi::SPIDelegate::transfer ( const uint8_t *  txbuf,
uint8_t *  rxbuf,
size_t  length 
)
inlinevirtual

Definition at line 196 of file spi.h.

◆ write()

virtual void esphome::spi::SPIDelegate::write ( uint16_t  data,
size_t  num_bits 
)
inlinevirtual

write a variable length data item, up to 16 bits.

Parameters
dataThe data to send. Should be LSB-aligned (i.e. top bits will be discarded.)
num_bitsThe number of bits to send

Reimplemented in esphome::spi::SPIDelegateBitBash.

Definition at line 206 of file spi.h.

◆ write16()

virtual void esphome::spi::SPIDelegate::write16 ( uint16_t  data)
inlinevirtual

Reimplemented in esphome::spi::SPIDelegateBitBash.

Definition at line 215 of file spi.h.

◆ write_array()

virtual void esphome::spi::SPIDelegate::write_array ( const uint8_t *  ptr,
size_t  length 
)
inlinevirtual

Definition at line 232 of file spi.h.

◆ write_array16()

virtual void esphome::spi::SPIDelegate::write_array16 ( const uint16_t *  data,
size_t  length 
)
inlinevirtual

Definition at line 225 of file spi.h.

◆ write_cmd_addr_data()

virtual void esphome::spi::SPIDelegate::write_cmd_addr_data ( size_t  cmd_bits,
uint32_t  cmd,
size_t  addr_bits,
uint32_t  address,
const uint8_t *  data,
size_t  length,
uint8_t  bus_width 
)
inlinevirtual

Definition at line 210 of file spi.h.

Field Documentation

◆ bit_order_

SPIBitOrder esphome::spi::SPIDelegate::bit_order_ {BIT_ORDER_MSB_FIRST}
protected

Definition at line 247 of file spi.h.

◆ cs_pin_

GPIOPin* esphome::spi::SPIDelegate::cs_pin_ {NullPin::NULL_PIN}
protected

Definition at line 250 of file spi.h.

◆ data_rate_

uint32_t esphome::spi::SPIDelegate::data_rate_ {1000000}
protected

Definition at line 248 of file spi.h.

◆ mode_

SPIMode esphome::spi::SPIDelegate::mode_ {MODE0}
protected

Definition at line 249 of file spi.h.


The documentation for this class was generated from the following files: