From 8236e840a76fc94ac6ae3f023f8d26f619567033 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 9 May 2022 19:24:27 +1200 Subject: [PATCH] Fix spi transfer with miso pin defined on espidf (#3450) --- esphome/components/spi/spi.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/esphome/components/spi/spi.h b/esphome/components/spi/spi.h index 6c3fd17e56..7f0b0f481a 100644 --- a/esphome/components/spi/spi.h +++ b/esphome/components/spi/spi.h @@ -156,15 +156,17 @@ class SPIComponent : public Component { template uint8_t transfer_byte(uint8_t data) { -#ifdef USE_SPI_ARDUINO_BACKEND if (this->miso_ != nullptr) { +#ifdef USE_SPI_ARDUINO_BACKEND if (this->hw_spi_ != nullptr) { return this->hw_spi_->transfer(data); } else { - return this->transfer_(data); - } - } #endif // USE_SPI_ARDUINO_BACKEND + return this->transfer_(data); +#ifdef USE_SPI_ARDUINO_BACKEND + } +#endif // USE_SPI_ARDUINO_BACKEND + } this->write_byte(data); return 0; }