From bf0c32364aa086742551f53d8a6db0fab505cc61 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Mon, 24 Apr 2017 16:14:09 +0800 Subject: [PATCH] SPI: Also check SPI_TRANS_USE_[T|R]XDATA when decifding to turn on MOSI/MISO. Fixes https://github.com/espressif/esp-idf/issues/488 --- components/driver/spi_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index 5b6b0b477f..5bf3955d06 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -551,8 +551,8 @@ static void IRAM_ATTR spi_intr(void *arg) } else { host->hw->addr=trans->address & 0xffffffff; } - host->hw->user.usr_mosi=(trans->tx_buffer==NULL)?0:1; - host->hw->user.usr_miso=(trans->rx_buffer==NULL)?0:1; + host->hw->user.usr_mosi=(trans->tx_buffer!=NULL || (trans->flags & SPI_TRANS_USE_TXDATA))?1:0; + host->hw->user.usr_miso=(trans->rx_buffer!=NULL || (trans->flags & SPI_TRANS_USE_RXDATA))?1:0; //Call pre-transmission callback, if any if (dev->cfg.pre_cb) dev->cfg.pre_cb(trans);