Qubit 2020 / presensfirmwareupdate

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 /* Debug comm settings. */
00005 #define DEBUG_BAUD                 9600
00006 /* The number of bits in a word (5-8; default = 8) */
00007 #define DEBUG_NO_BITS                 8
00008 /* parity - The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None) */
00009 #define DEBUG_PARITY       Serial::None
00010 /* stop - The number of stop bits (1 or 2; default = 1) */
00011 #define DEBUG_NO_STOP_BITS            1
00012 
00013 #define DEBUG_MAX_TRACE_LENGTH 256
00014 
00015 #define INFO(  _formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,  DEBUG_LEVEL_INFO, _formatStr, ##__VA_ARGS__)
00016 #define ERROR( _formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__, DEBUG_LEVEL_ERROR, _formatStr, ##__VA_ARGS__)
00017 #define DEBUG1(_formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,     DEBUG_LEVEL_1, _formatStr, ##__VA_ARGS__)
00018 #define DEBUG2(_formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,     DEBUG_LEVEL_2, _formatStr, ##__VA_ARGS__)
00019 #define DEBUG3(_formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,     DEBUG_LEVEL_3, _formatStr, ##__VA_ARGS__)
00020 #define DEBUG4(_formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,     DEBUG_LEVEL_4, _formatStr, ##__VA_ARGS__)
00021 #define DEBUG5(_formatStr, ...) debugPrintf(__FILE__, __LINE__, __func__,     DEBUG_LEVEL_5, _formatStr, ##__VA_ARGS__)
00022 
00023 typedef enum
00024 {
00025     DEBUG_LEVEL_DISABLED = -2,
00026     DEBUG_LEVEL_ERROR    = -1,
00027     DEBUG_LEVEL_INFO     =  0,
00028     DEBUG_LEVEL_1        =  1,
00029     DEBUG_LEVEL_2        =  2,
00030     DEBUG_LEVEL_3        =  3,
00031     DEBUG_LEVEL_4        =  4,
00032     DEBUG_LEVEL_5        =  5
00033 } DebugLevel;
00034 
00035 void debugInit(int initDebugLvl);
00036 
00037 void debugSetLvl(int newDebugLvl);
00038 
00039 int debugGetCurrLvl();
00040 
00041 void debugPrintf(char* file, int line, const char* func, int debugLvl, char* format, ...);
00042 
00043 const char* debugFormatTraceLevel(int val);
00044 
00045 #endif //DEBUG_H