Simple sample of using a debug class and macros.

Dependencies:   mbed

Revision:
0:885c11431d59
diff -r 000000000000 -r 885c11431d59 debug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debug.h	Sun Aug 30 00:05:14 2015 +0000
@@ -0,0 +1,33 @@
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+
+#ifndef DEBUG
+  #define DEBUG // Comment this out for release mode builds.
+#endif
+
+
+// Simple error reporting.
+#ifdef DEBUG
+    #define DEBUG_ERROR(x) g_debugger.error(x);
+#else
+    #define DEBUG_ERROR(x) // x;
+#endif
+
+
+
+// debug error reporting object
+class debug
+{
+    public:
+
+        void error(const char* text);
+};
+
+
+// Created in the debug.cpp file.
+extern debug g_debugger;
+
+
+
+#endif // __DEBUG_H__