Driver for the SX1272 RF Transceiver

Dependents:   LoRaWAN_mbed_lmic_agriculture_app

Fork of SX1272Lib by Semtech

Committer:
GTsapparellas
Date:
Mon Apr 02 12:06:02 2018 +0000
Revision:
8:60c42278731e
Parent:
0:45c4f0364ca4
SX1272MB2xAS LoRa shield attached on FRDM-K64F ARM mbed board.

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.
GTsapparellas 8:60c42278731e 17 *
GTsapparellas 8:60c42278731e 18 * /////////////////////////////////////////////////////////////////////////////
GTsapparellas 8:60c42278731e 19 *
GTsapparellas 8:60c42278731e 20 * Used by Giorgos Tsapparellas for Internet of Things (IoT) smart monitoring
GTsapparellas 8:60c42278731e 21 * device for agriculture using LoRaWAN technology.
GTsapparellas 8:60c42278731e 22 *
GTsapparellas 8:60c42278731e 23 * Date of issued copy: 20 January 2018
GTsapparellas 8:60c42278731e 24 *
GTsapparellas 8:60c42278731e 25 * Modifications:
GTsapparellas 8:60c42278731e 26 * - No external modifications of the existing "AS IT IS" software.
mluis 0:45c4f0364ca4 27 */
mluis 0:45c4f0364ca4 28
mluis 0:45c4f0364ca4 29 #ifndef DEBUG_H
mluis 0:45c4f0364ca4 30 #define DEBUG_H
mluis 0:45c4f0364ca4 31
mluis 0:45c4f0364ca4 32 /** @file debug.h */
mluis 0:45c4f0364ca4 33
mluis 0:45c4f0364ca4 34 #ifndef NDEBUG
mluis 0:45c4f0364ca4 35
mluis 0:45c4f0364ca4 36 #include <stdarg.h>
mluis 0:45c4f0364ca4 37 #include <stdio.h>
mluis 0:45c4f0364ca4 38
mluis 0:45c4f0364ca4 39 /** Output a debug message
mluis 0:45c4f0364ca4 40 *
mluis 0:45c4f0364ca4 41 * @param format printf-style format string, followed by variables
mluis 0:45c4f0364ca4 42 */
mluis 0:45c4f0364ca4 43 static inline void debug(const char *format, ...) {
mluis 0:45c4f0364ca4 44 va_list args;
mluis 0:45c4f0364ca4 45 va_start(args, format);
mluis 0:45c4f0364ca4 46 vfprintf(stderr, format, args);
mluis 0:45c4f0364ca4 47 va_end(args);
mluis 0:45c4f0364ca4 48 }
mluis 0:45c4f0364ca4 49
mluis 0:45c4f0364ca4 50 /** Conditionally output a debug message
mluis 0:45c4f0364ca4 51 *
mluis 0:45c4f0364ca4 52 * @param condition output only if condition is true
mluis 0:45c4f0364ca4 53 * @param format printf-style format string, followed by variables
mluis 0:45c4f0364ca4 54 */
mluis 0:45c4f0364ca4 55 static inline void debug_if(bool condition, const char *format, ...) {
mluis 0:45c4f0364ca4 56 if(condition) {
mluis 0:45c4f0364ca4 57 va_list args;
mluis 0:45c4f0364ca4 58 va_start(args, format);
mluis 0:45c4f0364ca4 59 vfprintf(stderr, format, args);
mluis 0:45c4f0364ca4 60 va_end(args);
mluis 0:45c4f0364ca4 61 }
mluis 0:45c4f0364ca4 62 }
mluis 0:45c4f0364ca4 63
mluis 0:45c4f0364ca4 64 #else
mluis 0:45c4f0364ca4 65
mluis 0:45c4f0364ca4 66 static inline void debug(const char *format, ...) {}
mluis 0:45c4f0364ca4 67 static inline void debug(bool condition, const char *format, ...) {}
mluis 0:45c4f0364ca4 68
mluis 0:45c4f0364ca4 69 #endif
mluis 0:45c4f0364ca4 70
mluis 0:45c4f0364ca4 71 #endif