ESPHome  2024.5.5
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:

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

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}

Additional Inherited Members

- Static Protected Attributes inherited from esphome::spi::SPIDelegate
static SPIDelegate *const NULL_DELEGATE

Detailed Description

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

Definition at line 274 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 

Definition at line 276 of file spi.h.

Member Function Documentation

◆ cycle_clock_()

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

Definition at line 300 of file spi.h.

◆ transfer()

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

Implements esphome::spi::SPIDelegate.

Definition at line 84 of file spi.cpp.

◆ transfer_()

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

Definition at line 88 of file spi.cpp.

◆ write()

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

Reimplemented from esphome::spi::SPIDelegate.

Definition at line 86 of file spi.cpp.

◆ write16()

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

Reimplemented from esphome::spi::SPIDelegate.

Definition at line 289 of file spi.h.

Field Documentation

◆ clk_pin_

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

Definition at line 289 of file spi.h.

◆ clock_phase_

SPIClockPhase esphome::spi::SPIDelegateBitBash::clock_phase_

Definition at line 298 of file spi.h.

◆ clock_polarity_

SPIClockPolarity esphome::spi::SPIDelegateBitBash::clock_polarity_

Definition at line 297 of file spi.h.

◆ last_transition_

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

Definition at line 295 of file spi.h.

◆ sdi_pin_

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

Definition at line 294 of file spi.h.

◆ sdo_pin_

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

Definition at line 293 of file spi.h.

◆ wait_cycle_

uint32_t esphome::spi::SPIDelegateBitBash::wait_cycle_

Definition at line 296 of file spi.h.

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