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