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.
Fork of OmniWheels by
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 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) 00042 va_list args; 00043 va_start(args, format); 00044 vfprintf(stderr, format, args); 00045 va_end(args); 00046 #endif 00047 } 00048 00049 00050 /** Conditionally output a debug message 00051 * 00052 * NOTE: If the condition is constant false (== 0) and the compiler optimization 00053 * level is greater than 0, then the whole function will be compiled away. 00054 * 00055 * @param condition output only if condition is true (!= 0) 00056 * @param format printf-style format string, followed by variables 00057 */ 00058 static inline void debug_if(int condition, const char *format, ...) { 00059 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) 00060 if (condition) { 00061 va_list args; 00062 va_start(args, format); 00063 vfprintf(stderr, format, args); 00064 va_end(args); 00065 } 00066 #endif 00067 } 00068 00069 00070 #ifdef __cplusplus 00071 } 00072 #endif 00073 00074 #endif 00075 00076 /**@}*/ 00077 00078 /**@}*/ 00079
Generated on Fri Jul 22 2022 04:53:56 by
