Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed_debug.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /** 00005 * \defgroup platform_debug Debug functions 00006 * @{ 00007 */ 00008 00009 /* mbed Microcontroller Library 00010 * Copyright (c) 2006-2013 ARM Limited 00011 * 00012 * Licensed under the Apache License, Version 2.0 (the "License"); 00013 * you may not use this file except in compliance with the License. 00014 * You may obtain a copy of the License at 00015 * 00016 * http://www.apache.org/licenses/LICENSE-2.0 00017 * 00018 * Unless required by applicable law or agreed to in writing, software 00019 * distributed under the License is distributed on an "AS IS" BASIS, 00020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 * See the License for the specific language governing permissions and 00022 * limitations under the License. 00023 */ 00024 #ifndef MBED_DEBUG_H 00025 #define MBED_DEBUG_H 00026 #if DEVICE_STDIO_MESSAGES 00027 #include <stdio.h> 00028 #include <stdarg.h> 00029 #endif 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 00036 /** Output a debug message 00037 * 00038 * @param format printf-style format string, followed by variables 00039 */ 00040 static inline void debug(const char *format, ...) 00041 { 00042 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) 00043 va_list args; 00044 va_start(args, format); 00045 vfprintf(stderr, format, args); 00046 va_end(args); 00047 #endif 00048 } 00049 00050 00051 /** Conditionally output a debug message 00052 * 00053 * NOTE: If the condition is constant false (== 0) and the compiler optimization 00054 * level is greater than 0, then the whole function will be compiled away. 00055 * 00056 * @param condition output only if condition is true (!= 0) 00057 * @param format printf-style format string, followed by variables 00058 */ 00059 static inline void debug_if(int condition, const char *format, ...) 00060 { 00061 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) 00062 if (condition) { 00063 va_list args; 00064 va_start(args, format); 00065 vfprintf(stderr, format, args); 00066 va_end(args); 00067 } 00068 #endif 00069 } 00070 00071 00072 #ifdef __cplusplus 00073 } 00074 #endif 00075 00076 #endif 00077 00078 /**@}*/ 00079 00080 /**@}*/ 00081
Generated on Tue Aug 9 2022 00:37:14 by
