Simple sample of using a debug class and macros.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers debug.h Source File

debug.h

00001 #ifndef __DEBUG_H__
00002 #define __DEBUG_H__
00003 
00004 
00005 #ifndef DEBUG
00006   #define DEBUG // Comment this out for release mode builds.
00007 #endif
00008 
00009 
00010 // Simple error reporting.
00011 #ifdef DEBUG
00012     #define DEBUG_ERROR(x) g_debugger.error(x);
00013 #else
00014     #define DEBUG_ERROR(x) // x;
00015 #endif
00016 
00017 
00018 
00019 // debug error reporting object
00020 class debug
00021 {
00022     public:
00023 
00024         void error(const char* text);
00025 };
00026 
00027 
00028 // Created in the debug.cpp file.
00029 extern debug g_debugger;
00030 
00031 
00032 
00033 #endif // __DEBUG_H__