mimxrt10xx: Return proper UART read length when everything was read
This commit is contained in:
parent
59eb35da30
commit
18c12e7822
@ -270,9 +270,14 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
|
||||
LPUART_TransferAbortReceive(self->uart, &self->handle);
|
||||
}
|
||||
|
||||
// No data left, we got it all
|
||||
if (self->handle.rxData == NULL) {
|
||||
return len;
|
||||
}
|
||||
|
||||
// The only place we can reliably tell how many bytes have been received is from the current
|
||||
// wp in the handle (because the abort nukes rxDataSize, and reading it before abort is a race.)
|
||||
return self->handle.rxData-data;
|
||||
return self->handle.rxData - data;
|
||||
}
|
||||
|
||||
// Write characters.
|
||||
|
Loading…
Reference in New Issue
Block a user