![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
SmartMesh QSL for STM32F4 version
Fork of COG-AD4050_QSL by
sm_qsl/dn_debug.h@1:b909b8399252, 2018-07-12 (annotated)
- Committer:
- APS_Lab
- Date:
- Thu Jul 12 09:19:12 2018 +0000
- Revision:
- 1:b909b8399252
- Parent:
- 0:8ca1e814a851
SmartMesh for STM32F4 version
Who changed what in which revision?
User | Revision | Line number | New 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 | 1:b909b8399252 | 22 | #if 1 |
APS_Lab | 0:8ca1e814a851 | 23 | #ifdef NDEBUG |
APS_Lab | 1:b909b8399252 | 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 | 1:b909b8399252 | 32 | //#define log_err(M, ...) do {}while(0) |
APS_Lab | 1:b909b8399252 | 33 | //#define log_warn(M, ...) do {}while(0) |
APS_Lab | 1:b909b8399252 | 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 |