takashi yamanoue
/
XBee_API_ex2
Xbee test 2
LPC1768/dbg/dbg.h@0:ffac63d6a7f0, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:08:27 2012 +0000
- Revision:
- 0:ffac63d6a7f0
xbee test 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:ffac63d6a7f0 | 1 | |
takashiyamanoue | 0:ffac63d6a7f0 | 2 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
takashiyamanoue | 0:ffac63d6a7f0 | 4 | |
takashiyamanoue | 0:ffac63d6a7f0 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
takashiyamanoue | 0:ffac63d6a7f0 | 6 | of this software and associated documentation files (the "Software"), to deal |
takashiyamanoue | 0:ffac63d6a7f0 | 7 | in the Software without restriction, including without limitation the rights |
takashiyamanoue | 0:ffac63d6a7f0 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
takashiyamanoue | 0:ffac63d6a7f0 | 9 | copies of the Software, and to permit persons to whom the Software is |
takashiyamanoue | 0:ffac63d6a7f0 | 10 | furnished to do so, subject to the following conditions: |
takashiyamanoue | 0:ffac63d6a7f0 | 11 | |
takashiyamanoue | 0:ffac63d6a7f0 | 12 | The above copyright notice and this permission notice shall be included in |
takashiyamanoue | 0:ffac63d6a7f0 | 13 | all copies or substantial portions of the Software. |
takashiyamanoue | 0:ffac63d6a7f0 | 14 | |
takashiyamanoue | 0:ffac63d6a7f0 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
takashiyamanoue | 0:ffac63d6a7f0 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
takashiyamanoue | 0:ffac63d6a7f0 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
takashiyamanoue | 0:ffac63d6a7f0 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
takashiyamanoue | 0:ffac63d6a7f0 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
takashiyamanoue | 0:ffac63d6a7f0 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
takashiyamanoue | 0:ffac63d6a7f0 | 21 | THE SOFTWARE. |
takashiyamanoue | 0:ffac63d6a7f0 | 22 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 23 | |
takashiyamanoue | 0:ffac63d6a7f0 | 24 | /** \file |
takashiyamanoue | 0:ffac63d6a7f0 | 25 | Debugging helpers header file |
takashiyamanoue | 0:ffac63d6a7f0 | 26 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 27 | |
takashiyamanoue | 0:ffac63d6a7f0 | 28 | //#ifdef DBG_H |
takashiyamanoue | 0:ffac63d6a7f0 | 29 | //#define DBG_H |
takashiyamanoue | 0:ffac63d6a7f0 | 30 | |
takashiyamanoue | 0:ffac63d6a7f0 | 31 | #ifdef __LWIP_DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 32 | #define __DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 33 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 34 | |
takashiyamanoue | 0:ffac63d6a7f0 | 35 | /*! |
takashiyamanoue | 0:ffac63d6a7f0 | 36 | \def __DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 37 | To define to enable debugging in one file |
takashiyamanoue | 0:ffac63d6a7f0 | 38 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 39 | |
takashiyamanoue | 0:ffac63d6a7f0 | 40 | #ifdef __DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 41 | |
takashiyamanoue | 0:ffac63d6a7f0 | 42 | #ifndef __DEBUGSTREAM |
takashiyamanoue | 0:ffac63d6a7f0 | 43 | #define __DEBUGSTREAM |
takashiyamanoue | 0:ffac63d6a7f0 | 44 | |
takashiyamanoue | 0:ffac63d6a7f0 | 45 | |
takashiyamanoue | 0:ffac63d6a7f0 | 46 | class DebugStream |
takashiyamanoue | 0:ffac63d6a7f0 | 47 | { |
takashiyamanoue | 0:ffac63d6a7f0 | 48 | public: |
takashiyamanoue | 0:ffac63d6a7f0 | 49 | static void debug(const char* format, ...); |
takashiyamanoue | 0:ffac63d6a7f0 | 50 | static void release(); |
takashiyamanoue | 0:ffac63d6a7f0 | 51 | static void breakPoint(const char* file, int line); |
takashiyamanoue | 0:ffac63d6a7f0 | 52 | private: |
takashiyamanoue | 0:ffac63d6a7f0 | 53 | |
takashiyamanoue | 0:ffac63d6a7f0 | 54 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 55 | |
takashiyamanoue | 0:ffac63d6a7f0 | 56 | #undef DBG |
takashiyamanoue | 0:ffac63d6a7f0 | 57 | #undef DBG_END |
takashiyamanoue | 0:ffac63d6a7f0 | 58 | #undef BREAK |
takashiyamanoue | 0:ffac63d6a7f0 | 59 | |
takashiyamanoue | 0:ffac63d6a7f0 | 60 | ///Debug output (if enabled), same syntax as printf, with heading info |
takashiyamanoue | 0:ffac63d6a7f0 | 61 | #define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0); |
takashiyamanoue | 0:ffac63d6a7f0 | 62 | |
takashiyamanoue | 0:ffac63d6a7f0 | 63 | ///Debug output (if enabled), same syntax as printf, no heading info |
takashiyamanoue | 0:ffac63d6a7f0 | 64 | #define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0); |
takashiyamanoue | 0:ffac63d6a7f0 | 65 | #define DBG_END DebugStream::release |
takashiyamanoue | 0:ffac63d6a7f0 | 66 | |
takashiyamanoue | 0:ffac63d6a7f0 | 67 | ///Break point usin serial debug interface (if debug enbaled) |
takashiyamanoue | 0:ffac63d6a7f0 | 68 | #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__) |
takashiyamanoue | 0:ffac63d6a7f0 | 69 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 70 | |
takashiyamanoue | 0:ffac63d6a7f0 | 71 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 72 | #undef DBG |
takashiyamanoue | 0:ffac63d6a7f0 | 73 | #undef DBG_END |
takashiyamanoue | 0:ffac63d6a7f0 | 74 | #undef BREAK |
takashiyamanoue | 0:ffac63d6a7f0 | 75 | #define DBG(...) |
takashiyamanoue | 0:ffac63d6a7f0 | 76 | #define DBG_END() |
takashiyamanoue | 0:ffac63d6a7f0 | 77 | #define BREAK() |
takashiyamanoue | 0:ffac63d6a7f0 | 78 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 79 | |
takashiyamanoue | 0:ffac63d6a7f0 | 80 | #ifdef __LWIP_DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 81 | #ifndef __SNPRINTF |
takashiyamanoue | 0:ffac63d6a7f0 | 82 | #define __SNPRINTF |
takashiyamanoue | 0:ffac63d6a7f0 | 83 | #include "mbed.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 84 | |
takashiyamanoue | 0:ffac63d6a7f0 | 85 | //int snprintf(char *str, int size, const char *format, ...); |
takashiyamanoue | 0:ffac63d6a7f0 | 86 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 87 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 88 | |
takashiyamanoue | 0:ffac63d6a7f0 | 89 | #ifdef __LWIP_DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 90 | #undef __DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 91 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 92 | |
takashiyamanoue | 0:ffac63d6a7f0 | 93 | //#endif |
takashiyamanoue | 0:ffac63d6a7f0 | 94 |