mirror of
https://github.com/esphome/esphome.git
synced 2025-10-18 09:43:47 +01:00
Fix spi transfer with miso pin defined on espidf (#3450)
This commit is contained in:
@@ -156,15 +156,17 @@ class SPIComponent : public Component {
|
|||||||
|
|
||||||
template<SPIBitOrder BIT_ORDER, SPIClockPolarity CLOCK_POLARITY, SPIClockPhase CLOCK_PHASE>
|
template<SPIBitOrder BIT_ORDER, SPIClockPolarity CLOCK_POLARITY, SPIClockPhase CLOCK_PHASE>
|
||||||
uint8_t transfer_byte(uint8_t data) {
|
uint8_t transfer_byte(uint8_t data) {
|
||||||
#ifdef USE_SPI_ARDUINO_BACKEND
|
|
||||||
if (this->miso_ != nullptr) {
|
if (this->miso_ != nullptr) {
|
||||||
|
#ifdef USE_SPI_ARDUINO_BACKEND
|
||||||
if (this->hw_spi_ != nullptr) {
|
if (this->hw_spi_ != nullptr) {
|
||||||
return this->hw_spi_->transfer(data);
|
return this->hw_spi_->transfer(data);
|
||||||
} else {
|
} else {
|
||||||
return this->transfer_<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE, true, true>(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // USE_SPI_ARDUINO_BACKEND
|
#endif // USE_SPI_ARDUINO_BACKEND
|
||||||
|
return this->transfer_<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE, true, true>(data);
|
||||||
|
#ifdef USE_SPI_ARDUINO_BACKEND
|
||||||
|
}
|
||||||
|
#endif // USE_SPI_ARDUINO_BACKEND
|
||||||
|
}
|
||||||
this->write_byte<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE>(data);
|
this->write_byte<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE>(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user