stm32f0: stm32f1: usart: send \r\n instead of \r
This commit is contained in:
parent
1e9a5b3fe4
commit
ece960b3c9
1 changed files with 3 additions and 1 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Reference in a new issue