summaryrefslogtreecommitdiff
path: root/avr/con-utils.c
diff options
context:
space:
mode:
authorLeo C2014-08-13 21:00:21 +0200
committerLeo C2014-08-13 21:00:21 +0200
commit72f5882239bb88b8a68f305802e0dde37a975604 (patch)
treea932ba22f7174de0fd773cf31d4d914dd548dfdd /avr/con-utils.c
parentd684c21619905153eff68c43927207248925f6c2 (diff)
downloadz180-stamp-72f5882239bb88b8a68f305802e0dde37a975604.zip
Add memory commands (cmp, cp, md, mm, mw, nm)
Add kind of scheduler for background tasks
Diffstat (limited to 'avr/con-utils.c')
-rw-r--r--avr/con-utils.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/avr/con-utils.c b/avr/con-utils.c
index 430ba98..02657b9 100644
--- a/avr/con-utils.c
+++ b/avr/con-utils.c
@@ -1,13 +1,14 @@
#include <string.h>
-#include <stdio.h>
+#include "common.h"
#include "serial.h"
+#include "background.h"
#include "con-utils.h"
-
uint_fast8_t tstc(void)
{
+ bg_shed();
return serial_tstc();
}
@@ -15,16 +16,19 @@ int my_getchar(void)
{
int c;
- while((c = serial_getc()) < 0)
- ;
+ do {
+ bg_shed();
+ c = serial_getc();
+ } while (c < 0);
+
return c;
}
/* test if ctrl-c was pressed */
-static uint_fast8_t ctrlc_disabled = 0; /* see disable_ctrl() */
-static uint_fast8_t ctrlc_was_pressed = 0;
+static uint_fast8_t ctrlc_disabled; /* see disable_ctrl() */
+static uint_fast8_t ctrlc_was_pressed;
uint_fast8_t ctrlc(void)
{