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 */