From a57ba313b865a4a2d39a94b30c2983401b097524 Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Sat, 27 Nov 2010 09:49:00 +1100 Subject: [PATCH] implement queue_wait() --- dda_queue.c | 9 +++++++++ dda_queue.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/dda_queue.c b/dda_queue.c index d295c14..ad33992 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -10,6 +10,7 @@ #include "temp.h" #include "delay.h" #include "sersendf.h" +#include "clock.h" uint8_t mb_head = 0; uint8_t mb_tail = 0; @@ -114,3 +115,11 @@ void queue_flush() { // restore interrupt flag SREG = sreg; } + +void queue_wait() { + for (;queue_empty() == 0;) { + ifclock(CLOCK_FLAG_10MS) { + clock_10ms(); + } + } +} diff --git a/dda_queue.h b/dda_queue.h index 46b4a4f..26f0aa2 100644 --- a/dda_queue.h +++ b/dda_queue.h @@ -36,4 +36,7 @@ void print_queue(void); // flush the queue for eg; emergency stop void queue_flush(void); +// wait for queue to empty +void queue_wait(void); + #endif /* _DDA_QUEUE */