Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
mbed/mbed_debug.h@15:aeb817f93336, 2018-12-14 (annotated)
- Committer:
- MikeGray92
- Date:
- Fri Dec 14 22:35:36 2018 +0000
- Revision:
- 15:aeb817f93336
- Parent:
- 0:3a767f41cf04
Removed some unused code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 1 | /* mbed Microcontroller Library |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 2 | * Copyright (c) 2006-2013 ARM Limited |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 3 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 5 | * you may not use this file except in compliance with the License. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 6 | * You may obtain a copy of the License at |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 7 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 9 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 10 | * Unless required by applicable law or agreed to in writing, software |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 13 | * See the License for the specific language governing permissions and |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 14 | * limitations under the License. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 15 | */ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 16 | #ifndef MBED_DEBUG_H |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 17 | #define MBED_DEBUG_H |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 18 | #include "device.h" |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 19 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 20 | #ifdef __cplusplus |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 21 | extern "C" { |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 22 | #endif |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 23 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 24 | #if DEVICE_STDIO_MESSAGES |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 25 | #include <stdio.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 26 | #include <stdarg.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 27 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 28 | /** Output a debug message |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 29 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 30 | * @param format printf-style format string, followed by variables |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 31 | */ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 32 | static inline void debug(const char *format, ...) { |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 33 | va_list args; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 34 | va_start(args, format); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 35 | vfprintf(stderr, format, args); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 36 | va_end(args); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 37 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 38 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 39 | /** Conditionally output a debug message |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 40 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 41 | * NOTE: If the condition is constant false (!= 1) and the compiler optimization |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 42 | * level is greater than 0, then the whole function will be compiled away. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 43 | * |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 44 | * @param condition output only if condition is true (== 1) |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 45 | * @param format printf-style format string, followed by variables |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 46 | */ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 47 | static inline void debug_if(int condition, const char *format, ...) { |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 48 | if (condition == 1) { |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 49 | va_list args; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 50 | va_start(args, format); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 51 | vfprintf(stderr, format, args); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 52 | va_end(args); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 53 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 54 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 55 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 56 | #else |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 57 | static inline void debug(const char *format, ...) {} |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 58 | static inline void debug_if(int condition, const char *format, ...) {} |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 59 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 60 | #endif |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 61 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 62 | #ifdef __cplusplus |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 63 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 64 | #endif |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 65 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 66 | #endif |