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