SmartMesh QSL for STM32F4 version

Fork of COG-AD4050_QSL by APS Lab

Committer:
APS_Lab
Date:
Wed May 02 09:26:10 2018 +0000
Revision:
0:8ca1e814a851
Child:
1:b909b8399252
version1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
APS_Lab 0:8ca1e814a851 1 /*
APS_Lab 0:8ca1e814a851 2 Copyright (c) 2016, Dust Networks. All rights reserved.
APS_Lab 0:8ca1e814a851 3
APS_Lab 0:8ca1e814a851 4 Debug macros (based on http://c.learncodethehardway.org/book/ex20.html ).
APS_Lab 0:8ca1e814a851 5
APS_Lab 0:8ca1e814a851 6 \license See attached DN_LICENSE.txt.
APS_Lab 0:8ca1e814a851 7 */
APS_Lab 0:8ca1e814a851 8
APS_Lab 0:8ca1e814a851 9 #ifndef DN_DEBUG_H
APS_Lab 0:8ca1e814a851 10 #define DN_DEBUG_H
APS_Lab 0:8ca1e814a851 11
APS_Lab 0:8ca1e814a851 12 #include <stdio.h>
APS_Lab 0:8ca1e814a851 13 #include <errno.h>
APS_Lab 0:8ca1e814a851 14 #include <string.h>
APS_Lab 0:8ca1e814a851 15
APS_Lab 0:8ca1e814a851 16 /* Comment out this define to include debug messages */
APS_Lab 0:8ca1e814a851 17 #define NDEBUG 0
APS_Lab 0:8ca1e814a851 18
APS_Lab 0:8ca1e814a851 19 /* Comment out this define to include log messages */
APS_Lab 0:8ca1e814a851 20 #define NLOG 0
APS_Lab 0:8ca1e814a851 21
APS_Lab 0:8ca1e814a851 22 #if 0
APS_Lab 0:8ca1e814a851 23 #ifdef NDEBUG
APS_Lab 0:8ca1e814a851 24 #define debug(M, ...) do {}while(0)
APS_Lab 0:8ca1e814a851 25 #else
APS_Lab 0:8ca1e814a851 26 #define debug(M, ...) fprintf(stderr, "DEBUG %s:%d: " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
APS_Lab 0:8ca1e814a851 27 #endif
APS_Lab 0:8ca1e814a851 28
APS_Lab 0:8ca1e814a851 29 #define clean_errno() (errno == 0 ? "None" : strerror(errno))
APS_Lab 0:8ca1e814a851 30
APS_Lab 0:8ca1e814a851 31 #ifdef NLOG
APS_Lab 0:8ca1e814a851 32 #define log_err(M, ...) do {}while(0)
APS_Lab 0:8ca1e814a851 33 #define log_warn(M, ...) do {}while(0)
APS_Lab 0:8ca1e814a851 34 #define log_info(M, ...) do {}while(0)
APS_Lab 0:8ca1e814a851 35 #else
APS_Lab 0:8ca1e814a851 36 #define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
APS_Lab 0:8ca1e814a851 37 #define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
APS_Lab 0:8ca1e814a851 38 #define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d) " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
APS_Lab 0:8ca1e814a851 39 #endif
APS_Lab 0:8ca1e814a851 40
APS_Lab 0:8ca1e814a851 41 #endif
APS_Lab 0:8ca1e814a851 42
APS_Lab 0:8ca1e814a851 43 #endif
APS_Lab 0:8ca1e814a851 44