mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
Fix spi transfer with miso pin defined on espidf (#3450)
This commit is contained in:
parent
e5b3625f73
commit
8236e840a7
1 changed files with 6 additions and 4 deletions
|
@ -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 {
|
||||||
|
#endif // USE_SPI_ARDUINO_BACKEND
|
||||||
return this->transfer_<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE, true, true>(data);
|
return this->transfer_<BIT_ORDER, CLOCK_POLARITY, CLOCK_PHASE, true, true>(data);
|
||||||
}
|
#ifdef USE_SPI_ARDUINO_BACKEND
|
||||||
}
|
}
|
||||||
#endif // 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue