diff options
| author | Damien Le Moal <[email protected]> | 2019-01-18 13:46:31 +0900 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2019-01-21 09:58:33 +0530 |
| commit | 58d9f2983a4a1ebdbe62f7d40e10ea3bc7d6bbaf (patch) | |
| tree | 94c3fc0d87a3c41e95e3fc4e5aa8c62b0fd74b0c | |
| parent | 9c4aca4f1b7bfc52660589705846fc52ff7c015b (diff) | |
kendryte/k210: Fix console
Clear console input when intializing it.
Signed-off-by: Damien Le Moal <[email protected]>
| -rw-r--r-- | platform/kendryte/k210/uarths.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/platform/kendryte/k210/uarths.c b/platform/kendryte/k210/uarths.c index 2a189aad..f8f4974c 100644 --- a/platform/kendryte/k210/uarths.c +++ b/platform/kendryte/k210/uarths.c @@ -35,6 +35,10 @@ void uarths_init(u32 baud_rate, enum uarths_stopbit stopbit) uarths->ip.rxwm = 0; uarths->ie.txwm = 1; uarths->ie.rxwm = 0; + + /* Clear input */ + if (!uarths->rxdata.empty) + (void)uarths_getc(); } void uarths_putc(char c) @@ -46,11 +50,11 @@ void uarths_putc(char c) char uarths_getc(void) { - struct uarths_rxdata recv = uarths->rxdata; + struct uarths_rxdata rx = uarths->rxdata; - if (recv.empty) + if (rx.empty) return '\0'; - return recv.data; + return rx.data; } |
