From 06afb09fdbcc506a018999dc31b5805c6c0cda07 Mon Sep 17 00:00:00 2001
From: "matthias.ringwald"
 <matthias.ringwald@1a0a8af8-31b5-11de-8e0c-53a27eea117e>
Date: Fri, 5 Aug 2011 14:58:02 +0000
Subject: [PATCH] fix compile for embedded

---
 src/debug.h             | 6 +++---
 src/run_loop_embedded.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/debug.h b/src/debug.h
index b67de966c..5413bcfbe 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -40,19 +40,19 @@
 #include <stdio.h>
 
 #ifdef ENABLE_LOG_DEBUG
-#define log_debug(format, ...)  printf(format,  ## __VA_ARGS__)
+#define log_debug(format, ...)  printf(format"\r",  ## __VA_ARGS__)
 #else
 #define log_debug(...)
 #endif
 
 #ifdef ENABLE_LOG_INFO
-#define log_info(format, ...)  printf(format,  ## __VA_ARGS__)
+#define log_info(format, ...)  printf(format"\r",  ## __VA_ARGS__)
 #else
 #define log_info(...)
 #endif
 
 #ifdef ENABLE_LOG_ERROR
-#define log_error(format, ...)  printf(format,  ## __VA_ARGS__)
+#define log_error(format, ...)  printf(format"\r",  ## __VA_ARGS__)
 #else
 #define log_error(...)
 #endif
diff --git a/src/run_loop_embedded.c b/src/run_loop_embedded.c
index 25a9485cc..b7b477d4f 100644
--- a/src/run_loop_embedded.c
+++ b/src/run_loop_embedded.c
@@ -37,6 +37,13 @@
  *  individually. Calling ds->isReady() before calling ds->process() doesn't 
  *  make sense, so we just poll each data source round robin.
  *
+ *  To support an idle state, where an MCU could go to sleep, the process function
+ *  has to return if it has to called again as soon as possible
+ *
+ *  After calling process() on every data source and evaluating the pending timers,
+ *  the idle hook gets called if no data source did indicate that it needs to be
+ *  called right away.
+ *
  */
 
 
@@ -136,7 +143,7 @@ void embedded_execute() {
             ts->process(ts);
         }
 #endif
-        
+        // race condition.. poll data source, IRQ occurs -> data source gets ready -> IDLE hook makes MCU sleep?
     }
 }