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 TUKS-COURSE-TIMER by
mbed_debug.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2013 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_DEBUG_H 00020 #define MBED_DEBUG_H 00021 #include "device.h" 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 #if DEVICE_STDIO_MESSAGES 00028 #include <stdio.h> 00029 #include <stdarg.h> 00030 00031 /** Output a debug message 00032 * 00033 * @param format printf-style format string, followed by variables 00034 */ 00035 static inline void debug(const char *format, ...) { 00036 va_list args; 00037 va_start(args, format); 00038 vfprintf(stderr, format, args); 00039 va_end(args); 00040 } 00041 00042 /** Conditionally output a debug message 00043 * 00044 * NOTE: If the condition is constant false (!= 1) and the compiler optimization 00045 * level is greater than 0, then the whole function will be compiled away. 00046 * 00047 * @param condition output only if condition is true (== 1) 00048 * @param format printf-style format string, followed by variables 00049 */ 00050 static inline void debug_if(int condition, const char *format, ...) { 00051 if (condition == 1) { 00052 va_list args; 00053 va_start(args, format); 00054 vfprintf(stderr, format, args); 00055 va_end(args); 00056 } 00057 } 00058 00059 #else 00060 static inline void debug(const char *format, ...) {} 00061 static inline void debug_if(int condition, const char *format, ...) {} 00062 00063 #endif 00064 00065 #ifdef __cplusplus 00066 } 00067 #endif 00068 00069 #endif 00070 00071 /** @}*/
Generated on Tue Jul 12 2022 17:38:48 by
