first draft

Dependencies:   LMiC SX1272Libx mbed

Fork of LoRaWAN-lmic-app by Semtech

Revision:
6:fc465060b63e
Parent:
1:60184eda0066
Child:
8:0137acc9a6cd
diff -r 1b2fcc2582e8 -r fc465060b63e debug.h
--- a/debug.h	Thu Nov 26 17:20:53 2015 +0000
+++ b/debug.h	Tue Feb 23 15:42:41 2016 +0000
@@ -11,6 +11,9 @@
  *******************************************************************************/
 #ifndef _debug_hpp_
 #define _debug_hpp_
+#include <stdarg.h>
+#include <stdio.h>
+#include "oslmic.h"
 
 // intialize debug library
 void debug_init (void);
@@ -39,4 +42,22 @@
 // write label and 32-bit value as hex to USART
 void debug_val (const u1_t* label, u4_t val);
 
+//#define NDEBUG
+#ifndef NDEBUG
+
+/** Output a debug message
+ * 
+ * @param format printf-style format string, followed by variables
+ */
+static inline void debug(const char *format, ...) {
+    va_list args;
+    va_start(args, format);
+    vfprintf(stderr, format, args);
+    va_end(args);
+}
+
+#else
+static inline void debug(const char *format, ...) {}
+#endif
+
 #endif // _debug_hpp_