summaryrefslogtreecommitdiff
path: root/avr
diff options
context:
space:
mode:
authorLeo C2014-10-23 02:15:50 +0200
committerLeo C2014-10-23 02:15:50 +0200
commit424b184a9bab3b1b8fe93fbc9e8a6e9d566904c8 (patch)
tree243c9e1801dde49e7ddd33e06c2fc4df28896719 /avr
parentbad2d92d98f9990ee5ccf509c0eafe5b3af9f4dc (diff)
downloadz180-stamp-424b184a9bab3b1b8fe93fbc9e8a6e9d566904c8.zip
my_getchar() parameter: allow return without new character
Diffstat (limited to 'avr')
-rw-r--r--avr/cli_readline.c4
-rw-r--r--avr/con-utils.c6
-rw-r--r--avr/main.c2
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;
diff --git a/avr/main.c b/avr/main.c
index 2955630..2a1ecd3 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -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 */
}