mimxrt/machine_spi: Ignore transfers with len=0.
It was treated as an error before. The error surfaced when using the NINAW10 drivers for WiFi support. Even if this is a bad behavior of the NINA driver, machine_spi can be forgiving in that situation.
This commit is contained in:
parent
d2a02dcee3
commit
14b862f70f
@ -240,6 +240,7 @@ STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj
|
||||
STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
|
||||
machine_spi_obj_t *self = (machine_spi_obj_t *)self_in;
|
||||
|
||||
if (len > 0) {
|
||||
// Wait a short while for the previous transfer to finish, but not forever
|
||||
for (volatile int j = 0; (j < 5000) && ((self->spi_inst->SR & kLPSPI_ModuleBusyFlag) != 0); j++) {}
|
||||
|
||||
@ -252,6 +253,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
|
||||
if (LPSPI_MasterTransferBlocking(self->spi_inst, &masterXfer) != kStatus_Success) {
|
||||
mp_raise_OSError(EIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STATIC const mp_machine_spi_p_t machine_spi_p = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user