Martin Werluschnig / Mbed 2 deprecated Diplomarbeit_MW_CW

Dependencies:   mbed

Committer:
martwerl
Date:
Wed Oct 17 17:19:45 2018 +0000
Revision:
0:afeca64a6543
Diplomarbeit_MW_CW

Who changed what in which revision?

UserRevisionLine numberNew contents of line
martwerl 0:afeca64a6543 1 /* mbed Microcontroller Library
martwerl 0:afeca64a6543 2 * Copyright (c) 2006-2013 ARM Limited
martwerl 0:afeca64a6543 3 *
martwerl 0:afeca64a6543 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
martwerl 0:afeca64a6543 5 * of this software and associated documentation files (the "Software"), to deal
martwerl 0:afeca64a6543 6 * in the Software without restriction, including without limitation the rights
martwerl 0:afeca64a6543 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
martwerl 0:afeca64a6543 8 * copies of the Software, and to permit persons to whom the Software is
martwerl 0:afeca64a6543 9 * furnished to do so, subject to the following conditions:
martwerl 0:afeca64a6543 10 *
martwerl 0:afeca64a6543 11 * The above copyright notice and this permission notice shall be included in
martwerl 0:afeca64a6543 12 * all copies or substantial portions of the Software.
martwerl 0:afeca64a6543 13 *
martwerl 0:afeca64a6543 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
martwerl 0:afeca64a6543 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
martwerl 0:afeca64a6543 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
martwerl 0:afeca64a6543 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
martwerl 0:afeca64a6543 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
martwerl 0:afeca64a6543 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
martwerl 0:afeca64a6543 20 * SOFTWARE.
martwerl 0:afeca64a6543 21 */
martwerl 0:afeca64a6543 22 #ifndef MBED_DEBUG_H
martwerl 0:afeca64a6543 23 #define MBED_DEBUG_H
martwerl 0:afeca64a6543 24 #include "device.h"
martwerl 0:afeca64a6543 25
martwerl 0:afeca64a6543 26 #ifdef __cplusplus
martwerl 0:afeca64a6543 27 extern "C" {
martwerl 0:afeca64a6543 28 #endif
martwerl 0:afeca64a6543 29
martwerl 0:afeca64a6543 30 #ifdef DEVICE_STDIO_MESSAGES
martwerl 0:afeca64a6543 31 #include <stdio.h>
martwerl 0:afeca64a6543 32 #include <stdarg.h>
martwerl 0:afeca64a6543 33
martwerl 0:afeca64a6543 34 /** Output a debug message
martwerl 0:afeca64a6543 35 *
martwerl 0:afeca64a6543 36 * @param format printf-style format string, followed by variables
martwerl 0:afeca64a6543 37 */
martwerl 0:afeca64a6543 38 static inline void debug(const char *format, ...) {
martwerl 0:afeca64a6543 39 va_list args;
martwerl 0:afeca64a6543 40 va_start(args, format);
martwerl 0:afeca64a6543 41 vfprintf(stderr, format, args);
martwerl 0:afeca64a6543 42 va_end(args);
martwerl 0:afeca64a6543 43 }
martwerl 0:afeca64a6543 44
martwerl 0:afeca64a6543 45 /** Conditionally output a debug message
martwerl 0:afeca64a6543 46 *
martwerl 0:afeca64a6543 47 * NOTE: If the condition is constant false (!= 1) and the compiler optimization
martwerl 0:afeca64a6543 48 * level is greater than 0, then the whole function will be compiled away.
martwerl 0:afeca64a6543 49 *
martwerl 0:afeca64a6543 50 * @param condition output only if condition is true (== 1)
martwerl 0:afeca64a6543 51 * @param format printf-style format string, followed by variables
martwerl 0:afeca64a6543 52 */
martwerl 0:afeca64a6543 53 static inline void debug_if(int condition, const char *format, ...) {
martwerl 0:afeca64a6543 54 if (condition == 1) {
martwerl 0:afeca64a6543 55 va_list args;
martwerl 0:afeca64a6543 56 va_start(args, format);
martwerl 0:afeca64a6543 57 vfprintf(stderr, format, args);
martwerl 0:afeca64a6543 58 va_end(args);
martwerl 0:afeca64a6543 59 }
martwerl 0:afeca64a6543 60 }
martwerl 0:afeca64a6543 61
martwerl 0:afeca64a6543 62 #else
martwerl 0:afeca64a6543 63 static inline void debug(const char *format, ...) {}
martwerl 0:afeca64a6543 64 static inline void debug_if(int condition, const char *format, ...) {}
martwerl 0:afeca64a6543 65
martwerl 0:afeca64a6543 66 #endif
martwerl 0:afeca64a6543 67
martwerl 0:afeca64a6543 68 #ifdef __cplusplus
martwerl 0:afeca64a6543 69 }
martwerl 0:afeca64a6543 70 #endif
martwerl 0:afeca64a6543 71
martwerl 0:afeca64a6543 72 #endif
martwerl 0:afeca64a6543 73