1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/stdio_uart: implementation of stdio_available

This commit is contained in:
Gunar Schorcht 2021-12-25 13:09:45 +01:00
parent a71dec81a2
commit 0ffad24112
3 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,7 @@ endif
ifneq (,$(filter stdio_uart_rx,$(USEMODULE)))
USEMODULE += isrpipe
USEMODULE += stdio_uart
USEMODULE += stdio_available
endif
ifneq (,$(filter stdio_uart,$(USEMODULE)))

View File

@ -49,6 +49,7 @@ config MODULE_STDIO_UART_RX
bool
depends on MODULE_STDIO_UART
select MODULE_ISRPIPE
select MODULE_STDIO_AVAILABLE
default y if MODULE_STDIN
help
Reception when using UART-based STDIO needs to be enabled.

View File

@ -67,6 +67,13 @@ void stdio_init(void)
#endif
}
#if IS_USED(MODULE_STDIO_AVAILABLE)
int stdio_available(void)
{
return tsrb_avail(&stdio_uart_isrpipe.tsrb);
}
#endif
ssize_t stdio_read(void* buffer, size_t count)
{
#ifdef MODULE_STDIO_UART_RX