From a4bd4e916be663a4a4de30683ce54a55d2f2014a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 2 Jul 2021 14:40:41 +0530 Subject: [PATCH] esp32s2 - fix spi_never_reset() --- ports/esp32s2/common-hal/busio/SPI.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index ce05b74b4e..fee533e755 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -118,8 +118,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { spi_never_reset[self->host_id] = true; common_hal_never_reset_pin(self->clock); - common_hal_never_reset_pin(self->MOSI); - common_hal_never_reset_pin(self->MISO); + if (self->MOSI != NULL) { + common_hal_never_reset_pin(self->MOSI); + } + if (self->MISO != NULL) { + common_hal_never_reset_pin(self->MISO); + } } bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {