|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
#include <console.h> |
|
|
|
|
#include <macros.h> |
|
|
|
|
|
|
|
|
|
#define CONFIG_USER_ECHO 1 |
|
|
|
|
#define RECV_BUF_LEN 128 |
|
|
|
|
|
|
|
|
|
struct usart_console { |
|
|
|
@ -109,6 +110,7 @@ int console_getline(struct console *console_, char *buf, size_t n) |
|
|
|
|
case '\r': |
|
|
|
|
#if CONFIG_USER_ECHO |
|
|
|
|
usart_send_blocking(console->dev, '\r'); |
|
|
|
|
usart_send_blocking(console->dev, '\n'); |
|
|
|
|
#endif |
|
|
|
|
return 0; |
|
|
|
|
case 10: |
|
|
|
@ -181,6 +183,7 @@ ssize_t console_read(struct console *console_, char *buf, size_t n) |
|
|
|
|
*p++ = '\n'; |
|
|
|
|
#if CONFIG_USER_ECHO |
|
|
|
|
usart_send_blocking(console->dev, '\r'); |
|
|
|
|
usart_send_blocking(console->dev, '\n'); |
|
|
|
|
#endif |
|
|
|
|
console_getc(&c, console_); |
|
|
|
|
goto out; |
|
|
|
@ -214,7 +217,6 @@ static ssize_t usart_write(void *cookie, const char *buf, size_t n) |
|
|
|
|
|
|
|
|
|
if (buf[i] == '\n') { |
|
|
|
|
usart_send_blocking(console->dev, '\r'); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
usart_send_blocking(console->dev, buf[i]); |
|
|
|
|