File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -653,7 +653,7 @@ static void console_loop(void)
653653 int ret ;
654654 int idx = 0 ;
655655 char cmd [CMD_BUFFER_SIZE ];
656- char c ;
656+ unsigned char c ;
657657 while (1 ) {
658658 printf ("\r\n" );
659659 printf ("cmd> " );
@@ -662,9 +662,23 @@ static void console_loop(void)
662662 do {
663663 ret = uart_rx_isr ((uint8_t * )& c , 1 );
664664 if (ret > 0 ) {
665- if (c == '\r' )
666- break ;
667- cmd [idx ++ ] = c ;
665+ if ((c >= 32 ) && (c < 127 )) {
666+ printf ("%c" , c );
667+ fflush (stdout );
668+ cmd [idx ++ ] = (char )c ;
669+ } else if (c == '\r' ) {
670+ printf ("\r\n" );
671+ fflush (stdout );
672+ break ; /* End of command. Parse it. */
673+ } else if (c == 0x08 ) { /* Backspace */
674+ if (idx > 0 ) {
675+ printf ("%c" , 0x08 );
676+ printf (" " );
677+ printf ("%c" , 0x08 );
678+ fflush (stdout );
679+ idx -- ;
680+ }
681+ }
668682 }
669683 } while (idx < (CMD_BUFFER_SIZE - 1 ));
670684 if (idx > 0 ) {
You can’t perform that action at this time.
0 commit comments