diff options
author | Leo C | 2014-10-23 02:15:50 +0200 |
---|---|---|
committer | Leo C | 2014-10-23 02:15:50 +0200 |
commit | 424b184a9bab3b1b8fe93fbc9e8a6e9d566904c8 (patch) | |
tree | 243c9e1801dde49e7ddd33e06c2fc4df28896719 /avr | |
parent | bad2d92d98f9990ee5ccf509c0eafe5b3af9f4dc (diff) | |
download | z180-stamp-424b184a9bab3b1b8fe93fbc9e8a6e9d566904c8.zip |
my_getchar() parameter: allow return without new character
Diffstat (limited to 'avr')
-rw-r--r-- | avr/cli_readline.c | 4 | ||||
-rw-r--r-- | avr/con-utils.c | 6 | ||||
-rw-r--r-- | avr/main.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/avr/cli_readline.c b/avr/cli_readline.c index 17d5494..6b5f47e 100644 --- a/avr/cli_readline.c +++ b/avr/cli_readline.c @@ -74,7 +74,7 @@ static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen) #define CREAD_HIST_CHAR ('!') #define getcmd_putch(ch) putchar(ch) -#define getcmd_getch() my_getchar() +#define getcmd_getch() my_getchar(1) #define getcmd_cbeep() getcmd_putch('\a') #define HIST_MAX 5 @@ -500,7 +500,7 @@ static int cli_readline_into_buffer(const FLASH char *const prompt, char *buffer for (;;) { - c = my_getchar(); + c = my_getchar(1); /* * Special character handling diff --git a/avr/con-utils.c b/avr/con-utils.c index 02657b9..b8017ed 100644 --- a/avr/con-utils.c +++ b/avr/con-utils.c @@ -12,14 +12,14 @@ uint_fast8_t tstc(void) return serial_tstc(); } -int my_getchar(void) +int my_getchar(uint_fast8_t waitforchar) { int c; do { bg_shed(); c = serial_getc(); - } while (c < 0); + } while ((c < 0) && waitforchar); return c; } @@ -57,7 +57,7 @@ uint_fast8_t confirm_yesno(void) ; i = 0; while (i < sizeof(str_input)) { - str_input[i] = my_getchar(); + str_input[i] = my_getchar(1); putchar(str_input[i]); if (str_input[i] == '\r') break; @@ -144,7 +144,7 @@ static int abortboot(int bootdelay) */ if (bootdelay >= 0) { if (tstc()) { /* we got a key press */ - (void) my_getchar(); /* consume input */ + (void) my_getchar(1); /* consume input */ my_puts_P(PSTR("\b\b\b 0")); abort = 1; /* don't auto boot */ } |