pin pong

Dependents:   SX1272PingPong

Fork of SX1276Lib by Semtech

Committer:
tmulrooney
Date:
Wed Feb 17 00:47:12 2016 +0000
Revision:
24:9100348e6c28
Parent:
23:273a2f93ae99
pin changes for FRDK-K22F

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 10:4a0720f9b7a3 1 /* Copyright (c) 2012 mbed.org, MIT License
GregCr 10:4a0720f9b7a3 2 *
GregCr 10:4a0720f9b7a3 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
GregCr 10:4a0720f9b7a3 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
GregCr 10:4a0720f9b7a3 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
GregCr 10:4a0720f9b7a3 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
GregCr 10:4a0720f9b7a3 7 * furnished to do so, subject to the following conditions:
GregCr 10:4a0720f9b7a3 8 *
GregCr 10:4a0720f9b7a3 9 * The above copyright notice and this permission notice shall be included in all copies or
GregCr 10:4a0720f9b7a3 10 * substantial portions of the Software.
GregCr 10:4a0720f9b7a3 11 *
GregCr 10:4a0720f9b7a3 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
GregCr 10:4a0720f9b7a3 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
GregCr 10:4a0720f9b7a3 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
GregCr 10:4a0720f9b7a3 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
GregCr 10:4a0720f9b7a3 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
GregCr 10:4a0720f9b7a3 17 */
GregCr 10:4a0720f9b7a3 18
GregCr 10:4a0720f9b7a3 19 #ifndef DEBUG_H
GregCr 10:4a0720f9b7a3 20 #define DEBUG_H
GregCr 10:4a0720f9b7a3 21
GregCr 10:4a0720f9b7a3 22 /** @file debug.h */
GregCr 10:4a0720f9b7a3 23
GregCr 10:4a0720f9b7a3 24 #include <stdarg.h>
GregCr 10:4a0720f9b7a3 25 #include <stdio.h>
GregCr 10:4a0720f9b7a3 26
tmulrooney 23:273a2f93ae99 27 #define NDEBUG
tmulrooney 23:273a2f93ae99 28 #ifndef NDEBUG
tmulrooney 23:273a2f93ae99 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
tmulrooney 23:273a2f93ae99 41 #else
tmulrooney 23:273a2f93ae99 42 static inline void debug(const char *format, ...) {}
tmulrooney 23:273a2f93ae99 43 #endif
tmulrooney 23:273a2f93ae99 44
tmulrooney 23:273a2f93ae99 45
tmulrooney 23:273a2f93ae99 46 //#define NDEBUG_IF
tmulrooney 23:273a2f93ae99 47 #ifndef NDEBUG_IF
tmulrooney 23:273a2f93ae99 48
GregCr 10:4a0720f9b7a3 49 /** Conditionally output a debug message
GregCr 10:4a0720f9b7a3 50 *
GregCr 10:4a0720f9b7a3 51 * @param condition output only if condition is true
GregCr 10:4a0720f9b7a3 52 * @param format printf-style format string, followed by variables
GregCr 10:4a0720f9b7a3 53 */
GregCr 10:4a0720f9b7a3 54 static inline void debug_if(bool condition, const char *format, ...) {
GregCr 10:4a0720f9b7a3 55 if(condition) {
GregCr 10:4a0720f9b7a3 56 va_list args;
GregCr 10:4a0720f9b7a3 57 va_start(args, format);
GregCr 10:4a0720f9b7a3 58 vfprintf(stderr, format, args);
GregCr 10:4a0720f9b7a3 59 va_end(args);
GregCr 10:4a0720f9b7a3 60 }
GregCr 10:4a0720f9b7a3 61 }
GregCr 10:4a0720f9b7a3 62 #else
tmulrooney 23:273a2f93ae99 63 static inline void debug_if(bool condition, const char *format, ...) {}
GregCr 10:4a0720f9b7a3 64 #endif
GregCr 10:4a0720f9b7a3 65
GregCr 10:4a0720f9b7a3 66 #endif