From 380a7087d403dbd944518bdc870bc66ca9cec032 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Mar 2022 14:53:46 -0700 Subject: [PATCH] Fix 3-wire SPI on ESP Simplifying the checks fixed it. Fixes #6141 --- ports/espressif/common-hal/busio/SPI.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ports/espressif/common-hal/busio/SPI.c b/ports/espressif/common-hal/busio/SPI.c index 0b4b0d7f1a..4eff1be54c 100644 --- a/ports/espressif/common-hal/busio/SPI.c +++ b/ports/espressif/common-hal/busio/SPI.c @@ -205,11 +205,10 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, if (len == 0) { return true; } - // Other than the read special case, stop transfers that don't have a pin/array match - if (!self->MOSI && (data_out != data_in)) { + if (self->MOSI == NULL && data_out != NULL) { mp_raise_ValueError(translate("No MOSI Pin")); } - if (!self->MISO && data_in) { + if (self->MISO == NULL && data_in != NULL) { mp_raise_ValueError(translate("No MISO Pin")); }