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