mQ Fork

Fork of SX1272Lib by Semtech

Committer:
Benedict_Tizzano
Date:
Fri Mar 30 19:00:02 2018 +0000
Revision:
8:71574856a120
Parent:
0:45c4f0364ca4
machineQ branch

Who changed what in which revision?

UserRevisionLine numberNew 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 */
Benedict_Tizzano 8:71574856a120 33 /*
mluis 0:45c4f0364ca4 34 static inline void debug(const char *format, ...) {
mluis 0:45c4f0364ca4 35 va_list args;
mluis 0:45c4f0364ca4 36 va_start(args, format);
mluis 0:45c4f0364ca4 37 vfprintf(stderr, format, args);
mluis 0:45c4f0364ca4 38 va_end(args);
mluis 0:45c4f0364ca4 39 }
Benedict_Tizzano 8:71574856a120 40 **/
mluis 0:45c4f0364ca4 41 /** Conditionally output a debug message
mluis 0:45c4f0364ca4 42 *
mluis 0:45c4f0364ca4 43 * @param condition output only if condition is true
mluis 0:45c4f0364ca4 44 * @param format printf-style format string, followed by variables
mluis 0:45c4f0364ca4 45 */
mluis 0:45c4f0364ca4 46 static inline void debug_if(bool condition, const char *format, ...) {
mluis 0:45c4f0364ca4 47 if(condition) {
mluis 0:45c4f0364ca4 48 va_list args;
mluis 0:45c4f0364ca4 49 va_start(args, format);
mluis 0:45c4f0364ca4 50 vfprintf(stderr, format, args);
mluis 0:45c4f0364ca4 51 va_end(args);
mluis 0:45c4f0364ca4 52 }
mluis 0:45c4f0364ca4 53 }
mluis 0:45c4f0364ca4 54
mluis 0:45c4f0364ca4 55 #else
mluis 0:45c4f0364ca4 56
mluis 0:45c4f0364ca4 57 static inline void debug(const char *format, ...) {}
mluis 0:45c4f0364ca4 58 static inline void debug(bool condition, const char *format, ...) {}
mluis 0:45c4f0364ca4 59
mluis 0:45c4f0364ca4 60 #endif
mluis 0:45c4f0364ca4 61
mluis 0:45c4f0364ca4 62 #endif