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

Merge pull request #19837 from HendrikVE/stdio_uart_add_flush_rx

sys/stdio_uart: add stdio_clear_stdin
This commit is contained in:
Marian Buschsieweke 2024-11-27 11:27:03 +00:00 committed by GitHub
commit 67a22dba5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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

@ -81,3 +81,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);
}
}