diff options
| author | Kamil Tomaszewski <kamil.tomaszewski@sony.com> | 2021-03-11 18:06:49 +0100 |
|---|---|---|
| committer | Kamil Tomaszewski <kamil.tomaszewski@sony.com> | 2021-03-11 18:06:49 +0100 |
| commit | 18668f6e2848a5a36d37df42354ecd1ee53786ba (patch) | |
| tree | 0a305d5d8cb8dcb53b605cadcaaa6d2704cda75c | |
| parent | 76d0870fba5a86813242c37ee653c1fc7e008c65 (diff) | |
spresense: fix spi to work with only one data pin
| -rw-r--r-- | ports/cxd56/common-hal/busio/SPI.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ports/cxd56/common-hal/busio/SPI.c b/ports/cxd56/common-hal/busio/SPI.c index 2d365d482..56ab0758d 100644 --- a/ports/cxd56/common-hal/busio/SPI.c +++ b/ports/cxd56/common-hal/busio/SPI.c @@ -35,9 +35,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * const mcu_pin_obj_t *mosi, const mcu_pin_obj_t *miso) { int port = -1; - if (clock->number == PIN_SPI4_SCK && mosi->number == PIN_SPI4_MOSI && miso->number == PIN_SPI4_MISO) { + if (clock->number == PIN_SPI4_SCK && + (mosi == NULL || mosi->number == PIN_SPI4_MOSI) && + (miso == NULL || miso->number == PIN_SPI4_MISO)) { port = 4; - } else if (clock->number == PIN_EMMC_CLK && mosi->number == PIN_EMMC_DATA0 && miso->number == PIN_EMMC_DATA1) { + } else if (clock->number == PIN_EMMC_CLK && + (mosi == NULL || mosi->number == PIN_EMMC_DATA0) && + (miso == NULL || miso->number == PIN_EMMC_DATA1)) { port = 5; } |
