We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fe40035 + 96e2a72 commit 353411aCopy full SHA for 353411a
ports/atmel-samd/common-hal/busio/SPI.c
@@ -271,10 +271,17 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
271
size_t bytes_remaining = len;
272
273
// Maximum DMA transfer is 65535
274
- while (bytes_remaining > 0) {
+ while (1) {
275
size_t to_send = (bytes_remaining > 65535) ? 65535 : bytes_remaining;
276
status = sercom_dma_write(self->spi_desc.dev.prvt, data + (len - bytes_remaining), to_send);
277
bytes_remaining -= to_send;
278
+ if (bytes_remaining > 0) {
279
+ // Multi-part transfer; let other things run before doing the next chunk.
280
+ RUN_BACKGROUND_TASKS;
281
+ } else {
282
+ // All done.
283
+ break;
284
+ }
285
}
286
} else {
287
struct io_descriptor *spi_io;
0 commit comments