Skip to content

Commit 18668f6

Browse files
committed
spresense: fix spi to work with only one data pin
1 parent 76d0870 commit 18668f6

File tree

1 file changed

+6
-2
lines changed
  • ports/cxd56/common-hal/busio

1 file changed

+6
-2
lines changed

ports/cxd56/common-hal/busio/SPI.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
3535
const mcu_pin_obj_t *mosi, const mcu_pin_obj_t *miso) {
3636
int port = -1;
3737

38-
if (clock->number == PIN_SPI4_SCK && mosi->number == PIN_SPI4_MOSI && miso->number == PIN_SPI4_MISO) {
38+
if (clock->number == PIN_SPI4_SCK &&
39+
(mosi == NULL || mosi->number == PIN_SPI4_MOSI) &&
40+
(miso == NULL || miso->number == PIN_SPI4_MISO)) {
3941
port = 4;
40-
} else if (clock->number == PIN_EMMC_CLK && mosi->number == PIN_EMMC_DATA0 && miso->number == PIN_EMMC_DATA1) {
42+
} else if (clock->number == PIN_EMMC_CLK &&
43+
(mosi == NULL || mosi->number == PIN_EMMC_DATA0) &&
44+
(miso == NULL || miso->number == PIN_EMMC_DATA1)) {
4145
port = 5;
4246
}
4347

0 commit comments

Comments
 (0)