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