1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-13 08:40:26 +01:00

sys/stdio_uart: add stdio_clear_stdin

This commit is contained in:
Hendrik van Essen 2023-07-18 23:00:33 +02:00
parent 87ae06a33e
commit 6f9edfe7a2
2 changed files with 16 additions and 0 deletions

View File

@ -102,6 +102,15 @@ void stdio_init(void);
int stdio_available(void);
#endif
/**
* @brief Clear the input buffer
*
* @note Requires 'USEMODULE += stdin'
*
* @warning This function does only work if the stdio implementation supports it.
*/
void stdio_clear_stdin(void);
/**
* @brief read @p len bytes from stdio uart into @p buffer
*

View File

@ -78,3 +78,10 @@ int stdio_available(void)
return tsrb_avail(&stdin_isrpipe.tsrb);
}
#endif
void stdio_clear_stdin(void)
{
if (IS_USED(MODULE_STDIN)) {
tsrb_clear(&stdin_isrpipe.tsrb);
}
}