CANTram Framework
1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
Debug.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <Arduino.h>
4
12
17
// #define NO_OUTPUT // Uncomment to disable all output
18
#ifndef NO_OUTPUT
19
#define DEBUG_OUTPUT
// Comment out to disable debug output
20
#define INFO_OUTPUT
// Comment out to disable info output
21
#define ERROR_OUTPUT
// Comment out to disable error output
22
#define WARNING_OUTPUT
// Comment out to disable warning output
23
#define CRITICAL_ERROR_OUTPUT
// Comment out to disable critical error output
24
#define DEV_ERROR_OUTPUT
25
#define INSTRUCTION_OUTPUT
// Comment out to disable instruction output
26
#define CHIP_OUTPUT
// Comment out to disable chip output
27
#define MEASUREMENT_OUTPUT
// Comment out to disable measurement output
28
#endif
29
36
#ifdef DEBUG_SHOW_LOCATION
37
#define MACRO_LOCATION ("\n" + String(__FILE__) + ":" + String(__LINE__))
38
#else
39
#define MACRO_LOCATION ""
40
#endif
41
48
#ifdef DEBUG_OUTPUT
49
#define DEBUG_PRINT(x) Serial.print((String) "DEBUG: " + x + MACRO_LOCATION)
50
#else
51
#define DEBUG_PRINT(x)
52
#endif
53
54
55
62
#ifdef DEBUG_OUTPUT
63
#define DEBUG_PRINTLN(x) Serial.println((String) "DEBUG: " + x + MACRO_LOCATION)
64
#else
65
#define DEBUG_PRINTLN(x)
66
#endif
67
74
#ifdef MEASUREMENT_OUTPUT
75
#define MEASUREMENT_PRINT(x) Serial.print((String) "MEASUREMENT: " + x + MACRO_LOCATION)
76
#else
77
#define MEASUREMENT_PRINT(x)
78
#endif
79
80
81
88
#ifdef MEASUREMENT_OUTPUT
89
#define MEASUREMENT_PRINTLN(x) Serial.println((String) "MEASUREMENT: " + x + MACRO_LOCATION)
90
#else
91
#define MEASUREMENT_PRINTLN(x)
92
#endif
93
100
#ifdef INSTRUCTION_OUTPUT
101
#define INSTRUCTION_PRINT(x) Serial.print((String) "INSTRUCTION: " + x + MACRO_LOCATION)
102
#else
103
#define INSTRUCTION_PRINT(x)
104
#endif
105
112
#ifdef INSTRUCTION_OUTPUT
113
#define INSTRUCTION_PRINTLN(x) Serial.println((String) "INSTRUCTION: " + x + MACRO_LOCATION)
114
#else
115
#define INSTRUCTION_PRINTLN(x)
116
#endif
117
124
#ifdef INFO_OUTPUT
125
#define INFO_PRINT(x) Serial.print((String) "INFO: " + x + MACRO_LOCATION)
126
#else
127
#define INFO_PRINT(x)
128
#endif
129
136
#ifdef INFO_OUTPUT
137
#define INFO_PRINTLN(x) Serial.println((String) "INFO: " + x + MACRO_LOCATION)
138
#else
139
#define INFO_PRINTLN(x)
140
#endif
141
148
#ifdef ERROR_OUTPUT
149
#define ERROR_PRINT(x) Serial.print((String) "ERROR: " + x + MACRO_LOCATION)
150
#else
151
#define ERROR_PRINT(x)
152
#endif
153
160
#ifdef ERROR_OUTPUT
161
#define ERROR_PRINTLN(x) Serial.println((String) "ERROR: " + x + MACRO_LOCATION)
162
#else
163
#define ERROR_PRINTLN(x)
164
#endif
165
172
#ifdef WARNING_OUTPUT
173
#define WARNING_PRINT(x) Serial.print((String) "WARNING: " + x + MACRO_LOCATION)
174
#else
175
#define WARNING_PRINT(x)
176
#endif
177
184
#ifdef WARNING_OUTPUT
185
#define WARNING_PRINTLN(x) Serial.println((String) "WARNING: " + x + MACRO_LOCATION)
186
#else
187
#define WARNING_PRINTLN(x)
188
#endif
189
196
#ifdef DEV_ERROR_OUTPUT
197
#define DEV_ERROR_PRINT(x) Serial.print((String) "DEV_ERROR: " + x + MACRO_LOCATION)
198
#else
199
#define DEV_ERROR_PRINT(x)
200
#endif
201
208
#ifdef DEV_ERROR_OUTPUT
209
#define DEV_ERROR_PRINTLN(x) Serial.println((String) "DEV_ERROR: " + x + MACRO_LOCATION)
210
#else
211
#define DEV_ERROR_PRINTLN(x)
212
#endif
213
220
#ifdef CHIP_OUTPUT
221
#define CHIP_PRINT(x) Serial.print((String) "CHIP: " + x + MACRO_LOCATION)
222
#else
223
#define CHIP_PRINT(x)
224
#endif
225
232
#ifdef CHIP_OUTPUT
233
#define CHIP_PRINTLN(x) Serial.println((String) "CHIP: " + x + MACRO_LOCATION)
234
#else
235
#define CHIP_PRINTLN(x)
236
#endif
237
245
#ifdef CRITICAL_ERROR_OUTPUT
246
#define CRITICAL_ERROR_PRINT(x) \
247
Serial.print((String) "CRITICAL ERROR: " + x + MACRO_LOCATION); \
248
while (true)
249
#else
250
#define CRITICAL_ERROR_PRINT(x)
251
#endif
252
260
#ifdef CRITICAL_ERROR_OUTPUT
261
#define CRITICAL_ERROR_PRINTLN(x) \
262
Serial.println((String) "CRITICAL ERROR: " + x + MACRO_LOCATION); \
263
while (true)
264
#else
265
#define CRITICAL_ERROR_PRINTLN(x)
266
#endif
267
275
#define NULL_PTR_CHECK(ptr) \
276
if (ptr == nullptr) { \
277
CRITICAL_ERROR_PRINTLN("Null pointer exception: " + #ptr); \
278
}
279
Documents
PlatformIO
Projects
CANTramFrameworkUsage
lib
CANTramFramework
include
Debug.h
Generated by
1.14.0