mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
api/mbed_debug.h@621:9c82b0f79f3d, 2015-09-11 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Sep 11 09:30:09 2015 +0100
- Revision:
- 621:9c82b0f79f3d
- Parent:
- 25:002053b42e66
Synchronized with git revision 6c1d63e069ab9bd86de92e8296ca783681257538
Full URL: https://github.com/mbedmicro/mbed/commit/6c1d63e069ab9bd86de92e8296ca783681257538/
ignore target files not supported by the yotta module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 13:0645d8841f51 | 1 | /* mbed Microcontroller Library |
bogdanm | 13:0645d8841f51 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 13:0645d8841f51 | 3 | * |
bogdanm | 13:0645d8841f51 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 13:0645d8841f51 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 13:0645d8841f51 | 6 | * You may obtain a copy of the License at |
bogdanm | 13:0645d8841f51 | 7 | * |
bogdanm | 13:0645d8841f51 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 13:0645d8841f51 | 9 | * |
bogdanm | 13:0645d8841f51 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 13:0645d8841f51 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 13:0645d8841f51 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 13:0645d8841f51 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 13:0645d8841f51 | 14 | * limitations under the License. |
bogdanm | 13:0645d8841f51 | 15 | */ |
bogdanm | 13:0645d8841f51 | 16 | #ifndef MBED_DEBUG_H |
bogdanm | 13:0645d8841f51 | 17 | #define MBED_DEBUG_H |
bogdanm | 13:0645d8841f51 | 18 | #include "device.h" |
bogdanm | 13:0645d8841f51 | 19 | |
bogdanm | 13:0645d8841f51 | 20 | #ifdef __cplusplus |
bogdanm | 13:0645d8841f51 | 21 | extern "C" { |
bogdanm | 13:0645d8841f51 | 22 | #endif |
bogdanm | 13:0645d8841f51 | 23 | |
mbed_official | 25:002053b42e66 | 24 | #if DEVICE_STDIO_MESSAGES |
bogdanm | 13:0645d8841f51 | 25 | #include <stdio.h> |
bogdanm | 13:0645d8841f51 | 26 | #include <stdarg.h> |
bogdanm | 13:0645d8841f51 | 27 | |
bogdanm | 13:0645d8841f51 | 28 | /** Output a debug message |
bogdanm | 13:0645d8841f51 | 29 | * |
bogdanm | 13:0645d8841f51 | 30 | * @param format printf-style format string, followed by variables |
bogdanm | 13:0645d8841f51 | 31 | */ |
bogdanm | 13:0645d8841f51 | 32 | static inline void debug(const char *format, ...) { |
bogdanm | 13:0645d8841f51 | 33 | va_list args; |
bogdanm | 13:0645d8841f51 | 34 | va_start(args, format); |
bogdanm | 13:0645d8841f51 | 35 | vfprintf(stderr, format, args); |
bogdanm | 13:0645d8841f51 | 36 | va_end(args); |
bogdanm | 13:0645d8841f51 | 37 | } |
bogdanm | 13:0645d8841f51 | 38 | |
bogdanm | 13:0645d8841f51 | 39 | /** Conditionally output a debug message |
bogdanm | 13:0645d8841f51 | 40 | * |
bogdanm | 13:0645d8841f51 | 41 | * NOTE: If the condition is constant false (!= 1) and the compiler optimization |
bogdanm | 13:0645d8841f51 | 42 | * level is greater than 0, then the whole function will be compiled away. |
bogdanm | 13:0645d8841f51 | 43 | * |
bogdanm | 13:0645d8841f51 | 44 | * @param condition output only if condition is true (== 1) |
bogdanm | 13:0645d8841f51 | 45 | * @param format printf-style format string, followed by variables |
bogdanm | 13:0645d8841f51 | 46 | */ |
bogdanm | 13:0645d8841f51 | 47 | static inline void debug_if(int condition, const char *format, ...) { |
bogdanm | 13:0645d8841f51 | 48 | if (condition == 1) { |
bogdanm | 13:0645d8841f51 | 49 | va_list args; |
bogdanm | 13:0645d8841f51 | 50 | va_start(args, format); |
bogdanm | 13:0645d8841f51 | 51 | vfprintf(stderr, format, args); |
bogdanm | 13:0645d8841f51 | 52 | va_end(args); |
bogdanm | 13:0645d8841f51 | 53 | } |
bogdanm | 13:0645d8841f51 | 54 | } |
bogdanm | 13:0645d8841f51 | 55 | |
bogdanm | 13:0645d8841f51 | 56 | #else |
bogdanm | 13:0645d8841f51 | 57 | static inline void debug(const char *format, ...) {} |
bogdanm | 13:0645d8841f51 | 58 | static inline void debug_if(int condition, const char *format, ...) {} |
bogdanm | 13:0645d8841f51 | 59 | |
bogdanm | 13:0645d8841f51 | 60 | #endif |
bogdanm | 13:0645d8841f51 | 61 | |
bogdanm | 13:0645d8841f51 | 62 | #ifdef __cplusplus |
bogdanm | 13:0645d8841f51 | 63 | } |
bogdanm | 13:0645d8841f51 | 64 | #endif |
bogdanm | 13:0645d8841f51 | 65 | |
bogdanm | 13:0645d8841f51 | 66 | #endif |