drivers: uart_xmc4xxx: Check that receive buffers have data in poll_in
As per XMCLib documentation we need to check that data has been received before reading the buffers. Fixes test_uart_poll_in test in tests/drivers/uart/uart_basic_api. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
This commit is contained in:
parent
4c2ff6dc2f
commit
aa91500aee
1 changed files with 4 additions and 0 deletions
|
@ -23,6 +23,10 @@ static int uart_xmc4xxx_poll_in(const struct device *dev, unsigned char *c)
|
|||
{
|
||||
const struct uart_xmc4xx_config *config = dev->config;
|
||||
|
||||
if (!XMC_USIC_CH_GetReceiveBufferStatus(config->uart)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*c = (unsigned char)XMC_UART_CH_GetReceivedData(config->uart);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue