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