drivers: serial: numicro: fix poll_in function

The poll_in function of the NuMicro UART driver was using the UART_Read
function from the Nuvoton HAL, which is blocking. Replace it with a
non-blocking implementation.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
This commit is contained in:
Filip Brozovic 2022-09-26 23:05:49 +02:00 committed by Carles Cufí
commit c60e100ab3

View file

@ -27,13 +27,13 @@ struct uart_numicro_data {
static int uart_numicro_poll_in(const struct device *dev, unsigned char *c)
{
const struct uart_numicro_config *config = dev->config;
uint32_t count;
count = UART_Read(config->uart, c, 1);
if (!count) {
if ((config->uart->FIFOSTS & UART_FIFOSTS_RXEMPTY_Msk) != 0) {
return -1;
}
*c = (uint8_t)config->uart->DAT;
return 0;
}