Libraries and Example of mbed parallel bus using I2C port expanders
Dependencies: HDSP253X mbed PCF8574_Bus
Dbg.h@7:8680b8b718c8, 2015-01-25 (annotated)
- Committer:
- wim
- Date:
- Sun Jan 25 17:52:55 2015 +0000
- Revision:
- 7:8680b8b718c8
- Parent:
- 2:1dab1089c332
Test of PCF8574 Bus interface to control HDSP253X Smart Alphanumeric LED matrix display.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim |
2:1dab1089c332 | 1 | /** \file |
wim |
2:1dab1089c332 | 2 | Debugging helpers header file |
wim |
2:1dab1089c332 | 3 | */ |
wim |
2:1dab1089c332 | 4 | |
wim |
2:1dab1089c332 | 5 | /** |
wim |
2:1dab1089c332 | 6 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
wim |
2:1dab1089c332 | 7 | |
wim |
2:1dab1089c332 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
wim |
2:1dab1089c332 | 9 | of this software and associated documentation files (the "Software"), to deal |
wim |
2:1dab1089c332 | 10 | in the Software without restriction, including without limitation the rights |
wim |
2:1dab1089c332 | 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim |
2:1dab1089c332 | 12 | copies of the Software, and to permit persons to whom the Software is |
wim |
2:1dab1089c332 | 13 | furnished to do so, subject to the following conditions: |
wim |
2:1dab1089c332 | 14 | |
wim |
2:1dab1089c332 | 15 | The above copyright notice and this permission notice shall be included in |
wim |
2:1dab1089c332 | 16 | all copies or substantial portions of the Software. |
wim |
2:1dab1089c332 | 17 | |
wim |
2:1dab1089c332 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim |
2:1dab1089c332 | 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim |
2:1dab1089c332 | 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim |
2:1dab1089c332 | 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim |
2:1dab1089c332 | 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim |
2:1dab1089c332 | 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim |
2:1dab1089c332 | 24 | THE SOFTWARE. |
wim |
2:1dab1089c332 | 25 | */ |
wim |
2:1dab1089c332 | 26 | |
wim |
2:1dab1089c332 | 27 | #ifndef DBG_H |
wim |
2:1dab1089c332 | 28 | #define DBG_H |
wim |
2:1dab1089c332 | 29 | |
wim |
2:1dab1089c332 | 30 | /*! |
wim |
2:1dab1089c332 | 31 | Define to enable debugging in one file |
wim |
2:1dab1089c332 | 32 | #define __DEBUG |
wim |
2:1dab1089c332 | 33 | */ |
wim |
2:1dab1089c332 | 34 | |
wim |
2:1dab1089c332 | 35 | #ifdef __DEBUG |
wim |
2:1dab1089c332 | 36 | |
wim |
2:1dab1089c332 | 37 | #ifndef __DEBUGSTREAM |
wim |
2:1dab1089c332 | 38 | #define __DEBUGSTREAM |
wim |
2:1dab1089c332 | 39 | |
wim |
2:1dab1089c332 | 40 | class DebugStream { |
wim |
2:1dab1089c332 | 41 | public: |
wim |
2:1dab1089c332 | 42 | static void debug(const char* format, ...); |
wim |
2:1dab1089c332 | 43 | static void release(); |
wim |
2:1dab1089c332 | 44 | static void breakPoint(const char* file, int line); |
wim |
2:1dab1089c332 | 45 | private: |
wim |
2:1dab1089c332 | 46 | |
wim |
2:1dab1089c332 | 47 | }; |
wim |
2:1dab1089c332 | 48 | |
wim |
2:1dab1089c332 | 49 | #undef DBG |
wim |
2:1dab1089c332 | 50 | #undef DBGL |
wim |
2:1dab1089c332 | 51 | #undef DBG_END |
wim |
2:1dab1089c332 | 52 | #undef BREAK |
wim |
2:1dab1089c332 | 53 | |
wim |
2:1dab1089c332 | 54 | //Debug output (if enabled), same syntax as printf, with heading info |
wim |
2:1dab1089c332 | 55 | //#define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0); |
wim |
2:1dab1089c332 | 56 | #define DBG(...) do{ DebugStream::debug("[%s @%d] ", __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0); |
wim |
2:1dab1089c332 | 57 | |
wim |
2:1dab1089c332 | 58 | //Debug output (if enabled), same syntax as printf, no heading info |
wim |
2:1dab1089c332 | 59 | #define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0); |
wim |
2:1dab1089c332 | 60 | #define DBG_END DebugStream::release |
wim |
2:1dab1089c332 | 61 | |
wim |
2:1dab1089c332 | 62 | //Breakpoint using serial debug interface (if debug enabled) |
wim |
2:1dab1089c332 | 63 | #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__) |
wim |
2:1dab1089c332 | 64 | #endif |
wim |
2:1dab1089c332 | 65 | |
wim |
2:1dab1089c332 | 66 | #else |
wim |
2:1dab1089c332 | 67 | #undef DBG |
wim |
2:1dab1089c332 | 68 | #undef DBGL |
wim |
2:1dab1089c332 | 69 | #undef DBG_END |
wim |
2:1dab1089c332 | 70 | #undef BREAK |
wim |
2:1dab1089c332 | 71 | |
wim |
2:1dab1089c332 | 72 | #define DBG(...) |
wim |
2:1dab1089c332 | 73 | #define DBGL(...) |
wim |
2:1dab1089c332 | 74 | #define DBG_END() |
wim |
2:1dab1089c332 | 75 | #define BREAK() |
wim |
2:1dab1089c332 | 76 | #endif |
wim |
2:1dab1089c332 | 77 | |
wim |
2:1dab1089c332 | 78 | #endif |