AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!

Dependents:   IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers debug.h Source File

debug.h

00001 /*
00002     debug.h 
00003   Copyright (c) Donatien Garnier 2012
00004   donatien.garnier@appnearme.com
00005   http://www.appnearme.com/
00006 */
00007 
00008 #ifndef DEBUG_H_
00009 #define DEBUG_H_
00010 
00011 #include "core/fwk.h"
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 
00017 #if !DEBUG_DISABLED
00018 
00019 void debug(int level, const char* module, int line, const char* fmt, ...);
00020 void debugx_enter(void);
00021 void debugx(const char* fmt, ...);
00022 void debugx_leave(void);
00023 
00024 #else
00025 #ifdef __DEBUG__
00026 #undef __DEBUG__
00027 #define __DEBUG__ 0
00028 #endif
00029 
00030 #endif
00031 
00032 #if __DEBUG__ > 0
00033 #ifndef __MODULE__
00034 #error "__MODULE__ must be defined"
00035 #endif
00036 #endif
00037 
00038 #if __DEBUG__ >= 1
00039 #define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00040 #else
00041 #define ERR(...)
00042 #endif
00043 
00044 #if __DEBUG__ >= 2
00045 #define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00046 #else
00047 #define WARN(...)
00048 #endif
00049 
00050 #if __DEBUG__ >= 3
00051 #define DBG(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00052 #define DBGX_ENTER() do{ debugx_enter(); }while(0);
00053 #define DBGX(...) do{ debugx(__VA_ARGS__); }while(0)
00054 #define DBGX_LEAVE() do{ debugx_leave(); }while(0);
00055 #else
00056 #define DBG(...)
00057 #define DBGX_ENTER()
00058 #define DBGX(...)
00059 #define DBGX_LEAVE()
00060 #endif
00061 
00062 #ifdef __cplusplus
00063 }
00064 #endif
00065 
00066 #endif
00067