Merge pull request #7673 from gamblor21/atmel-spi-tx-len-fix
Fix for long length SPI writes on ATMEL
This commit is contained in:
commit
4e169bb956
@ -268,7 +268,14 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
||||
}
|
||||
int32_t status;
|
||||
if (len >= 16) {
|
||||
status = sercom_dma_write(self->spi_desc.dev.prvt, data, len);
|
||||
size_t bytes_remaining = len;
|
||||
|
||||
// Maximum DMA transfer is 65535
|
||||
while (bytes_remaining > 0) {
|
||||
size_t to_send = (bytes_remaining > 65535) ? 65535 : bytes_remaining;
|
||||
status = sercom_dma_write(self->spi_desc.dev.prvt, data + (len - bytes_remaining), to_send);
|
||||
bytes_remaining -= to_send;
|
||||
}
|
||||
} else {
|
||||
struct io_descriptor *spi_io;
|
||||
spi_m_sync_get_io_descriptor(&self->spi_desc, &spi_io);
|
||||
|
Loading…
Reference in New Issue
Block a user