aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-02-21 09:13:53 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-02-21 09:13:53 -0500
commit5a6c8f4c22e6581f1b970afd68bf4c2c4db4ebf2 (patch)
tree24ba6301a64460067240605d5cbb6e320e0ccf32 /src
parentf27b19a531a61aa088d380174cc960b9f2e68237 (diff)
task pausing
Diffstat (limited to 'src')
-rw-r--r--src/display_draw.c4
-rw-r--r--src/task.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/display_draw.c b/src/display_draw.c
index 0d26e9a..be4becf 100644
--- a/src/display_draw.c
+++ b/src/display_draw.c
@@ -4,8 +4,8 @@
#include <clock.h>
volatile uint8_t lock = 0;
-#define LOCK while (lock) { delay(5); } lock = 1
-#define UNLOCK lock = 0
+#define LOCK while (lock) { delay(5); } task_hold(1); lock = 1
+#define UNLOCK task_hold(0); lock = 0
static unsigned int curx = 0;
static unsigned int cury = 0;
diff --git a/src/task.c b/src/task.c
index ee338de..b290e3c 100644
--- a/src/task.c
+++ b/src/task.c
@@ -16,6 +16,11 @@ static volatile int next_idx = 0;
static uint8_t task_enable = 0;
+void task_hold(uint8_t hold)
+{
+ task_enable = !hold;
+}
+
void task_init(void (*init)(void))
{
for (int i = 0; i < MAX_TASKS; i++)