move xbee user code in a separate file
[protos/xbee-avr.git] / cmdline.c
index 0b0c606..736fa52 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -30,7 +30,6 @@
 #include <parse.h>
 #include <rdline.h>
 #include <uart.h>
-#include <clock_time.h>
 
 #include "callout.h"
 #include "main.h"
@@ -137,12 +136,12 @@ void emergency(char c)
  * it dynamically */
 void mylog(struct error * e, ...)
 {
-       va_list ap;
 #ifndef HOST_VERSION
        u16 stream_flags = stdout->flags;
 #endif
-       uint8_t i;
-       time_h tv;
+       va_list ap;
+       uint8_t i, flags;
+       uint32_t ms;
 
        if (e->severity > ERROR_SEVERITY_ERROR) {
                if (xbeeboard.log_level < e->severity)
@@ -156,8 +155,11 @@ void mylog(struct error * e, ...)
        }
 
        va_start(ap, e);
-       tv = time_get_time();
-       printf_P(PSTR("%d.%.3d: "), (int)tv.s, (int)(tv.us/1000UL));
+       IRQ_LOCK(flags);
+       ms = global_ms;
+       IRQ_UNLOCK(flags);
+
+       printf_P(PSTR("%d.%.3d: "), (int)(ms/1000UL), (int)(ms%1000UL));
 
        vfprintf_P(stdout, e->text, ap);
        printf_P(PSTR("\r\n"));