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

#include <spi.h>

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

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}
 

Static Protected Attributes

static SPIDelegate *const NULL_DELEGATE
 

Detailed Description

Definition at line 170 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 176 of file spi.h.

◆ ~SPIDelegate()

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

Definition at line 184 of file spi.h.

Member Function Documentation

◆ begin_transaction()

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

Reimplemented in esphome::spi::SPIDelegateDummy.

Definition at line 187 of file spi.h.

◆ end_transaction()

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

Reimplemented in esphome::spi::SPIDelegateDummy.

Definition at line 190 of file spi.h.

◆ is_ready()

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

Definition at line 14 of file spi.cpp.

◆ read_array()

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

Definition at line 240 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 196 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 198 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 208 of file spi.h.

◆ write16()

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

Reimplemented in esphome::spi::SPIDelegateBitBash.

Definition at line 217 of file spi.h.

◆ write_array()

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

Definition at line 234 of file spi.h.

◆ write_array16()

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

Definition at line 227 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 212 of file spi.h.

Field Documentation

◆ bit_order_

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

Definition at line 249 of file spi.h.

◆ cs_pin_

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

Definition at line 252 of file spi.h.

◆ data_rate_

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

Definition at line 250 of file spi.h.

◆ mode_

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

Definition at line 251 of file spi.h.

◆ NULL_DELEGATE

SPIDelegate *const esphome::spi::SPIDelegate::NULL_DELEGATE
staticprotected
Initial value:
=
new SPIDelegateDummy()

Definition at line 253 of file spi.h.


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