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.
Dependents: DISCO-L072CZ-LRWAN1_LoRa_PingPong
Fork of SX1276GenericLib by
debug/debug.h@26:87796ee62589, 2017-03-24 (annotated)
- Committer:
- Helmut64
- Date:
- Fri Mar 24 15:06:46 2017 +0000
- Revision:
- 26:87796ee62589
- Parent:
- 10:4a0720f9b7a3
Added support to work with the Murata Lora Modul, in addition to the mbed SX1276 board.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Helmut64 | 26:87796ee62589 | 1 | #if 0 |
| GregCr | 10:4a0720f9b7a3 | 2 | /* Copyright (c) 2012 mbed.org, MIT License |
| GregCr | 10:4a0720f9b7a3 | 3 | * |
| GregCr | 10:4a0720f9b7a3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| GregCr | 10:4a0720f9b7a3 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| GregCr | 10:4a0720f9b7a3 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| GregCr | 10:4a0720f9b7a3 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| GregCr | 10:4a0720f9b7a3 | 8 | * furnished to do so, subject to the following conditions: |
| GregCr | 10:4a0720f9b7a3 | 9 | * |
| GregCr | 10:4a0720f9b7a3 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
| GregCr | 10:4a0720f9b7a3 | 11 | * substantial portions of the Software. |
| GregCr | 10:4a0720f9b7a3 | 12 | * |
| GregCr | 10:4a0720f9b7a3 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| GregCr | 10:4a0720f9b7a3 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| GregCr | 10:4a0720f9b7a3 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| GregCr | 10:4a0720f9b7a3 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| GregCr | 10:4a0720f9b7a3 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| GregCr | 10:4a0720f9b7a3 | 18 | */ |
| GregCr | 10:4a0720f9b7a3 | 19 | |
| GregCr | 10:4a0720f9b7a3 | 20 | #ifndef DEBUG_H |
| GregCr | 10:4a0720f9b7a3 | 21 | #define DEBUG_H |
| GregCr | 10:4a0720f9b7a3 | 22 | |
| GregCr | 10:4a0720f9b7a3 | 23 | /** @file debug.h */ |
| GregCr | 10:4a0720f9b7a3 | 24 | |
| GregCr | 10:4a0720f9b7a3 | 25 | #ifndef NDEBUG |
| GregCr | 10:4a0720f9b7a3 | 26 | |
| GregCr | 10:4a0720f9b7a3 | 27 | #include <stdarg.h> |
| GregCr | 10:4a0720f9b7a3 | 28 | #include <stdio.h> |
| GregCr | 10:4a0720f9b7a3 | 29 | |
| GregCr | 10:4a0720f9b7a3 | 30 | /** Output a debug message |
| GregCr | 10:4a0720f9b7a3 | 31 | * |
| GregCr | 10:4a0720f9b7a3 | 32 | * @param format printf-style format string, followed by variables |
| GregCr | 10:4a0720f9b7a3 | 33 | */ |
| GregCr | 10:4a0720f9b7a3 | 34 | static inline void debug(const char *format, ...) { |
| GregCr | 10:4a0720f9b7a3 | 35 | va_list args; |
| GregCr | 10:4a0720f9b7a3 | 36 | va_start(args, format); |
| GregCr | 10:4a0720f9b7a3 | 37 | vfprintf(stderr, format, args); |
| GregCr | 10:4a0720f9b7a3 | 38 | va_end(args); |
| GregCr | 10:4a0720f9b7a3 | 39 | } |
| GregCr | 10:4a0720f9b7a3 | 40 | |
| GregCr | 10:4a0720f9b7a3 | 41 | /** Conditionally output a debug message |
| GregCr | 10:4a0720f9b7a3 | 42 | * |
| GregCr | 10:4a0720f9b7a3 | 43 | * @param condition output only if condition is true |
| GregCr | 10:4a0720f9b7a3 | 44 | * @param format printf-style format string, followed by variables |
| GregCr | 10:4a0720f9b7a3 | 45 | */ |
| GregCr | 10:4a0720f9b7a3 | 46 | static inline void debug_if(bool condition, const char *format, ...) { |
| GregCr | 10:4a0720f9b7a3 | 47 | if(condition) { |
| GregCr | 10:4a0720f9b7a3 | 48 | va_list args; |
| GregCr | 10:4a0720f9b7a3 | 49 | va_start(args, format); |
| GregCr | 10:4a0720f9b7a3 | 50 | vfprintf(stderr, format, args); |
| GregCr | 10:4a0720f9b7a3 | 51 | va_end(args); |
| GregCr | 10:4a0720f9b7a3 | 52 | } |
| GregCr | 10:4a0720f9b7a3 | 53 | } |
| GregCr | 10:4a0720f9b7a3 | 54 | |
| GregCr | 10:4a0720f9b7a3 | 55 | #else |
| GregCr | 10:4a0720f9b7a3 | 56 | |
| GregCr | 10:4a0720f9b7a3 | 57 | static inline void debug(const char *format, ...) {} |
| GregCr | 10:4a0720f9b7a3 | 58 | static inline void debug(bool condition, const char *format, ...) {} |
| GregCr | 10:4a0720f9b7a3 | 59 | |
| GregCr | 10:4a0720f9b7a3 | 60 | #endif |
| GregCr | 10:4a0720f9b7a3 | 61 | |
| GregCr | 10:4a0720f9b7a3 | 62 | #endif |
| Helmut64 | 26:87796ee62589 | 63 | |
| Helmut64 | 26:87796ee62589 | 64 | #endif |
