implement common_hal_busio_uart_clear_rx_buffer

This commit is contained in:
hathach 2018-10-03 11:39:01 +07:00
parent f543c8415d
commit 08cbb03bdd

View File

@ -250,7 +250,11 @@ uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
}
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
// Discard received byte, and queue 1-byte transfer for rx_characters_available()
if ( self->rx_count > 0 ) {
self->rx_count = -1;
_VERIFY_ERR(nrfx_uarte_rx(&self->uarte, self->buffer, 1));
}
}
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {