Add missing undefined symbols to be sure to use mine
Dependents: DS130x_I2CApp MCP41xxxApp FM24Vxx_I2CApp MCP320xApp ... more
Diff: Debug.h
- Revision:
- 5:7ddb6bca6d01
- Parent:
- 4:d03fcf494eb6
- Child:
- 6:14a596126adf
--- a/Debug.h Wed Dec 08 13:16:16 2010 +0000 +++ b/Debug.h Wed Dec 08 13:33:24 2010 +0000 @@ -27,7 +27,7 @@ /** The steps below describe how to use this library: * 1. Import this library to your project 'As file', because you will need to modify this file as described in step 2 * 2. Edit this library - * 3. Remove comment from line 64 (search for '//#define __DEBUG' in this file) to get the DEBUG macro defimed properly. By default, __DEBUG flahg is undef + * 3. Remove comment from line 66 (search for '//#define __DEBUG' in this file) to get the DEBUG macro defimed properly. By default, __DEBUG flahg is undef * 4. Rebuild this library and use the debug macro as decribe in sample code * * IMPORTANT: If you modify this libray, please keep this comment up to date for future users @@ -41,13 +41,15 @@ * * int main() { * DEBUG_ENTER("main") // Log the entry of the C function 'main' - * int counter = 0; + * * std::string str("This is a sample for heaxdecimal dump using DebugLibrary"); * DEBUG(">>> Example:"); * HEXADUMP((unsigned char *)str.c_str(), str.length()); * DEBUG("==="); - * HEXADUMP_OFFSET((unsigned char *)str.c_str(), str.length(), 19); + * HEXADUMP_OFFSET((unsigned char *)str.c_str(), str.length() - 19, 19); * DEBUG("<<<"); + * + * int counter = 0; * while(1) { * DEBUG("In loop [%d]", counter++) // A sample message * myled = 1; @@ -70,13 +72,23 @@ #ifdef __DEBUG -/** This class implements debug functionalities based on USB console interface. V0.0.0.5 +/** This class implements debug functionalities based on USB console interface. V0.0.0.6 * * Note that this class is based on Helper pattern */ class DebugHelper { + /** Convert the specified digit into hexadecimal number (0x30..0x39 (0..9), 0x47..x4c (A..F)) + * + * @param p_digit The digit to convert + * @return An hexadecimal digit (0..9-A..F) + */ static inline unsigned char ToHexDigit(unsigned char p_digit) { return ((p_digit < 10) ? (p_digit + 0x30) : (p_digit + 0x37)); }; + /** Convert the specified hexadecimal digit into a character if it is printable, or replace by a '.' otherwise + * + * @param p_digit The hexadecimal digit to convert + * @return A character is it's printable, '.' otherwise + */ static inline char ToCharDigit(unsigned char p_digit) { return (((p_digit < 0x20) || (p_digit > 0x80)) ? '.' : (char)p_digit); }; public: /** Standard log method