Knight KE
/
Game_Master
游戏王对战板,目前code还是空的
mbed-os/platform/mbed_debug.h@0:9b3d4731edbb, 2018-06-21 (annotated)
- Committer:
- WFKnight
- Date:
- Thu Jun 21 13:51:43 2018 +0000
- Revision:
- 0:9b3d4731edbb
UART, RTOS, LED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WFKnight | 0:9b3d4731edbb | 1 | |
WFKnight | 0:9b3d4731edbb | 2 | /** \addtogroup platform */ |
WFKnight | 0:9b3d4731edbb | 3 | /** @{*/ |
WFKnight | 0:9b3d4731edbb | 4 | /** |
WFKnight | 0:9b3d4731edbb | 5 | * \defgroup platform_debug Debug functions |
WFKnight | 0:9b3d4731edbb | 6 | * @{ |
WFKnight | 0:9b3d4731edbb | 7 | */ |
WFKnight | 0:9b3d4731edbb | 8 | |
WFKnight | 0:9b3d4731edbb | 9 | /* mbed Microcontroller Library |
WFKnight | 0:9b3d4731edbb | 10 | * Copyright (c) 2006-2013 ARM Limited |
WFKnight | 0:9b3d4731edbb | 11 | * |
WFKnight | 0:9b3d4731edbb | 12 | * Licensed under the Apache License, Version 2.0 (the "License"); |
WFKnight | 0:9b3d4731edbb | 13 | * you may not use this file except in compliance with the License. |
WFKnight | 0:9b3d4731edbb | 14 | * You may obtain a copy of the License at |
WFKnight | 0:9b3d4731edbb | 15 | * |
WFKnight | 0:9b3d4731edbb | 16 | * http://www.apache.org/licenses/LICENSE-2.0 |
WFKnight | 0:9b3d4731edbb | 17 | * |
WFKnight | 0:9b3d4731edbb | 18 | * Unless required by applicable law or agreed to in writing, software |
WFKnight | 0:9b3d4731edbb | 19 | * distributed under the License is distributed on an "AS IS" BASIS, |
WFKnight | 0:9b3d4731edbb | 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
WFKnight | 0:9b3d4731edbb | 21 | * See the License for the specific language governing permissions and |
WFKnight | 0:9b3d4731edbb | 22 | * limitations under the License. |
WFKnight | 0:9b3d4731edbb | 23 | */ |
WFKnight | 0:9b3d4731edbb | 24 | #ifndef MBED_DEBUG_H |
WFKnight | 0:9b3d4731edbb | 25 | #define MBED_DEBUG_H |
WFKnight | 0:9b3d4731edbb | 26 | #if DEVICE_STDIO_MESSAGES |
WFKnight | 0:9b3d4731edbb | 27 | #include <stdio.h> |
WFKnight | 0:9b3d4731edbb | 28 | #include <stdarg.h> |
WFKnight | 0:9b3d4731edbb | 29 | #endif |
WFKnight | 0:9b3d4731edbb | 30 | |
WFKnight | 0:9b3d4731edbb | 31 | #ifdef __cplusplus |
WFKnight | 0:9b3d4731edbb | 32 | extern "C" { |
WFKnight | 0:9b3d4731edbb | 33 | #endif |
WFKnight | 0:9b3d4731edbb | 34 | |
WFKnight | 0:9b3d4731edbb | 35 | |
WFKnight | 0:9b3d4731edbb | 36 | /** Output a debug message |
WFKnight | 0:9b3d4731edbb | 37 | * |
WFKnight | 0:9b3d4731edbb | 38 | * @param format printf-style format string, followed by variables |
WFKnight | 0:9b3d4731edbb | 39 | */ |
WFKnight | 0:9b3d4731edbb | 40 | static inline void debug(const char *format, ...) { |
WFKnight | 0:9b3d4731edbb | 41 | #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) |
WFKnight | 0:9b3d4731edbb | 42 | va_list args; |
WFKnight | 0:9b3d4731edbb | 43 | va_start(args, format); |
WFKnight | 0:9b3d4731edbb | 44 | vfprintf(stderr, format, args); |
WFKnight | 0:9b3d4731edbb | 45 | va_end(args); |
WFKnight | 0:9b3d4731edbb | 46 | #endif |
WFKnight | 0:9b3d4731edbb | 47 | } |
WFKnight | 0:9b3d4731edbb | 48 | |
WFKnight | 0:9b3d4731edbb | 49 | |
WFKnight | 0:9b3d4731edbb | 50 | /** Conditionally output a debug message |
WFKnight | 0:9b3d4731edbb | 51 | * |
WFKnight | 0:9b3d4731edbb | 52 | * NOTE: If the condition is constant false (== 0) and the compiler optimization |
WFKnight | 0:9b3d4731edbb | 53 | * level is greater than 0, then the whole function will be compiled away. |
WFKnight | 0:9b3d4731edbb | 54 | * |
WFKnight | 0:9b3d4731edbb | 55 | * @param condition output only if condition is true (!= 0) |
WFKnight | 0:9b3d4731edbb | 56 | * @param format printf-style format string, followed by variables |
WFKnight | 0:9b3d4731edbb | 57 | */ |
WFKnight | 0:9b3d4731edbb | 58 | static inline void debug_if(int condition, const char *format, ...) { |
WFKnight | 0:9b3d4731edbb | 59 | #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) |
WFKnight | 0:9b3d4731edbb | 60 | if (condition) { |
WFKnight | 0:9b3d4731edbb | 61 | va_list args; |
WFKnight | 0:9b3d4731edbb | 62 | va_start(args, format); |
WFKnight | 0:9b3d4731edbb | 63 | vfprintf(stderr, format, args); |
WFKnight | 0:9b3d4731edbb | 64 | va_end(args); |
WFKnight | 0:9b3d4731edbb | 65 | } |
WFKnight | 0:9b3d4731edbb | 66 | #endif |
WFKnight | 0:9b3d4731edbb | 67 | } |
WFKnight | 0:9b3d4731edbb | 68 | |
WFKnight | 0:9b3d4731edbb | 69 | |
WFKnight | 0:9b3d4731edbb | 70 | #ifdef __cplusplus |
WFKnight | 0:9b3d4731edbb | 71 | } |
WFKnight | 0:9b3d4731edbb | 72 | #endif |
WFKnight | 0:9b3d4731edbb | 73 | |
WFKnight | 0:9b3d4731edbb | 74 | #endif |
WFKnight | 0:9b3d4731edbb | 75 | |
WFKnight | 0:9b3d4731edbb | 76 | /**@}*/ |
WFKnight | 0:9b3d4731edbb | 77 | |
WFKnight | 0:9b3d4731edbb | 78 | /**@}*/ |
WFKnight | 0:9b3d4731edbb | 79 |