ESPHome  2024.11.1
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::spi::SPIDelegateBitBash Class Reference

An implementation of SPI that relies only on software toggling of pins. More...

#include <spi.h>

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

Public Member Functions

 SPIDelegateBitBash (uint32_t clock, SPIBitOrder bit_order, SPIMode mode, GPIOPin *cs_pin, GPIOPin *clk_pin, GPIOPin *sdo_pin, GPIOPin *sdi_pin)
 
uint8_t transfer (uint8_t data) override
 
void write (uint16_t data, size_t num_bits) override
 
void write16 (uint16_t data) override
 
- Public Member Functions inherited from esphome::spi::SPIDelegate
 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 void transfer (uint8_t *ptr, size_t length)
 
virtual void transfer (const uint8_t *txbuf, uint8_t *rxbuf, size_t length)
 
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 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 Member Functions

void HOT cycle_clock_ ()
 
uint16_t transfer_ (uint16_t data, size_t num_bits)
 

Protected Attributes

GPIOPinclk_pin_
 
GPIOPinsdo_pin_
 
GPIOPinsdi_pin_
 
uint32_t last_transition_ {0}
 
uint32_t wait_cycle_
 
SPIClockPolarity clock_polarity_
 
SPIClockPhase clock_phase_
 
- Protected Attributes inherited from esphome::spi::SPIDelegate
SPIBitOrder bit_order_ {BIT_ORDER_MSB_FIRST}
 
uint32_t data_rate_ {1000000}
 
SPIMode mode_ {MODE0}
 
GPIOPincs_pin_ {NullPin::NULL_PIN}
 

Detailed Description

An implementation of SPI that relies only on software toggling of pins.

Definition at line 257 of file spi.h.

Constructor & Destructor Documentation

◆ SPIDelegateBitBash()

esphome::spi::SPIDelegateBitBash::SPIDelegateBitBash ( uint32_t  clock,
SPIBitOrder  bit_order,
SPIMode  mode,
GPIOPin cs_pin,
GPIOPin clk_pin,
GPIOPin sdo_pin,
GPIOPin sdi_pin 
)
inline

Definition at line 259 of file spi.h.

Member Function Documentation

◆ cycle_clock_()

void HOT esphome::spi::SPIDelegateBitBash::cycle_clock_ ( )
inlineprotected

Definition at line 283 of file spi.h.

◆ transfer()

uint8_t esphome::spi::SPIDelegateBitBash::transfer ( uint8_t  data)
overridevirtual

Implements esphome::spi::SPIDelegate.

Definition at line 78 of file spi.cpp.

◆ transfer_()

uint16_t esphome::spi::SPIDelegateBitBash::transfer_ ( uint16_t  data,
size_t  num_bits 
)
protected

Definition at line 82 of file spi.cpp.

◆ write()

void esphome::spi::SPIDelegateBitBash::write ( uint16_t  data,
size_t  num_bits 
)
overridevirtual

Reimplemented from esphome::spi::SPIDelegate.

Definition at line 80 of file spi.cpp.

◆ write16()

void esphome::spi::SPIDelegateBitBash::write16 ( uint16_t  data)
inlineoverridevirtual

Reimplemented from esphome::spi::SPIDelegate.

Definition at line 272 of file spi.h.

Field Documentation

◆ clk_pin_

GPIOPin* esphome::spi::SPIDelegateBitBash::clk_pin_
protected

Definition at line 272 of file spi.h.

◆ clock_phase_

SPIClockPhase esphome::spi::SPIDelegateBitBash::clock_phase_
protected

Definition at line 281 of file spi.h.

◆ clock_polarity_

SPIClockPolarity esphome::spi::SPIDelegateBitBash::clock_polarity_
protected

Definition at line 280 of file spi.h.

◆ last_transition_

uint32_t esphome::spi::SPIDelegateBitBash::last_transition_ {0}
protected

Definition at line 278 of file spi.h.

◆ sdi_pin_

GPIOPin* esphome::spi::SPIDelegateBitBash::sdi_pin_
protected

Definition at line 277 of file spi.h.

◆ sdo_pin_

GPIOPin* esphome::spi::SPIDelegateBitBash::sdo_pin_
protected

Definition at line 276 of file spi.h.

◆ wait_cycle_

uint32_t esphome::spi::SPIDelegateBitBash::wait_cycle_
protected

Definition at line 279 of file spi.h.


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