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 File Reference

Logging and debug macro definitions for CANTramCore. More...

#include <Arduino.h>
Include dependency graph for Debug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_OUTPUT
 Disable all output when defined.
#define INFO_OUTPUT
#define ERROR_OUTPUT
#define WARNING_OUTPUT
#define CRITICAL_ERROR_OUTPUT
#define DEV_ERROR_OUTPUT
#define INSTRUCTION_OUTPUT
#define CHIP_OUTPUT
#define MEASUREMENT_OUTPUT
#define MACRO_LOCATION   ""
#define DEBUG_PRINT(x)
 Print a debug message without newline.
#define DEBUG_PRINTLN(x)
 Print a debug message with newline.
#define MEASUREMENT_PRINT(x)
 Print a measurement message without newline.
#define MEASUREMENT_PRINTLN(x)
 Print a measurement message with newline.
#define INSTRUCTION_PRINT(x)
 Print a INSTRUCTION message without newline.
#define INSTRUCTION_PRINTLN(x)
 Print a INSTRUCTION message without newline.
#define INFO_PRINT(x)
 Print an info-level message without newline.
#define INFO_PRINTLN(x)
 Print an info-level message with newline.
#define ERROR_PRINT(x)
 Print an error-level message without newline.
#define ERROR_PRINTLN(x)
 Print an error-level message with newline.
#define WARNING_PRINT(x)
 Print a warning-level message without newline.
#define WARNING_PRINTLN(x)
 Print a warning-level message with newline.
#define DEV_ERROR_PRINT(x)
 Print a developer-error-level message without newline.
#define DEV_ERROR_PRINTLN(x)
 Print a developer-error-level message with newline.
#define CHIP_PRINT(x)
 Print a chip-level message without newline.
#define CHIP_PRINTLN(x)
 Print a chip-level message with newline.
#define CRITICAL_ERROR_PRINT(x)
 Print a critical error message and halt execution.
#define CRITICAL_ERROR_PRINTLN(x)
 Print a critical error message with newline and halt execution.
#define NULL_PTR_CHECK(ptr)
 Check a pointer for null and report a critical error if null.

Detailed Description

Logging and debug macro definitions for CANTramCore.

Defines macros for debug, info, error, warning, developer error and chip-level logging. Macros prepend a level prefix and optionally include file/line information when DEBUG_SHOW_LOCATION is defined. Also provides a NULL pointer check macro that prints a critical error and halts execution when a null pointer is detected.

Macro Definition Documentation

◆ CHIP_PRINT

#define CHIP_PRINT ( x)
Value:
Serial.print((String) "CHIP: " + x + MACRO_LOCATION)

Print a chip-level message without newline.

Used for chip-related informational messages. Expands to Serial.print with "CHIP: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ CHIP_PRINTLN

#define CHIP_PRINTLN ( x)
Value:
Serial.println((String) "CHIP: " + x + MACRO_LOCATION)

Print a chip-level message with newline.

Used for chip-related informational messages. Expands to Serial.println with "CHIP: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ CRITICAL_ERROR_PRINT

#define CRITICAL_ERROR_PRINT ( x)
Value:
Serial.print((String) "CRITICAL ERROR: " + x + MACRO_LOCATION); \
while (true)

Print a critical error message and halt execution.

Prints "CRITICAL ERROR: " prefix with the provided message and optional file/line info, then enters an infinite loop to stop execution.

Parameters
xExpression or string to print (will be converted to String).
Note
This macro does not return.

◆ CRITICAL_ERROR_PRINTLN

#define CRITICAL_ERROR_PRINTLN ( x)
Value:
Serial.println((String) "CRITICAL ERROR: " + x + MACRO_LOCATION); \
while (true)

Print a critical error message with newline and halt execution.

Prints "CRITICAL ERROR: " prefix with the provided message and optional file/line info, then enters an infinite loop to stop execution.

Parameters
xExpression or string to print (will be converted to String).
Note
This macro does not return.

◆ DEBUG_OUTPUT

#define DEBUG_OUTPUT

Disable all output when defined.

Uncomment to completely disable all logging macros. If not defined, individual level macros control output.

◆ DEBUG_PRINT

#define DEBUG_PRINT ( x)
Value:
Serial.print((String) "DEBUG: " + x + MACRO_LOCATION)

Print a debug message without newline.

Expands to Serial.print with "DEBUG: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ DEBUG_PRINTLN

#define DEBUG_PRINTLN ( x)
Value:
Serial.println((String) "DEBUG: " + x + MACRO_LOCATION)

Print a debug message with newline.

Expands to Serial.println with "DEBUG: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ DEV_ERROR_PRINT

#define DEV_ERROR_PRINT ( x)
Value:
Serial.print((String) "DEV_ERROR: " + x + MACRO_LOCATION)

Print a developer-error-level message without newline.

For development-only diagnostics. Expands to Serial.print with "DEV_ERROR: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ DEV_ERROR_PRINTLN

#define DEV_ERROR_PRINTLN ( x)
Value:
Serial.println((String) "DEV_ERROR: " + x + MACRO_LOCATION)

Print a developer-error-level message with newline.

For development-only diagnostics. Expands to Serial.println with "DEV_ERROR: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ ERROR_PRINT

#define ERROR_PRINT ( x)
Value:
Serial.print((String) "ERROR: " + x + MACRO_LOCATION)

Print an error-level message without newline.

Expands to Serial.print with "ERROR: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ ERROR_PRINTLN

#define ERROR_PRINTLN ( x)
Value:
Serial.println((String) "ERROR: " + x + MACRO_LOCATION)

Print an error-level message with newline.

Expands to Serial.println with "ERROR: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ INFO_PRINT

#define INFO_PRINT ( x)
Value:
Serial.print((String) "INFO: " + x + MACRO_LOCATION)

Print an info-level message without newline.

Expands to Serial.print with "INFO: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ INFO_PRINTLN

#define INFO_PRINTLN ( x)
Value:
Serial.println((String) "INFO: " + x + MACRO_LOCATION)

Print an info-level message with newline.

Expands to Serial.println with "INFO: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ INSTRUCTION_PRINT

#define INSTRUCTION_PRINT ( x)
Value:
Serial.print((String) "INSTRUCTION: " + x + MACRO_LOCATION)

Print a INSTRUCTION message without newline.

Expands to Serial.print with "INSTRUCTION: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ INSTRUCTION_PRINTLN

#define INSTRUCTION_PRINTLN ( x)
Value:
Serial.println((String) "INSTRUCTION: " + x + MACRO_LOCATION)

Print a INSTRUCTION message without newline.

Expands to Serial.println with "INSTRUCTION: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ MEASUREMENT_PRINT

#define MEASUREMENT_PRINT ( x)
Value:
Serial.print((String) "MEASUREMENT: " + x + MACRO_LOCATION)

Print a measurement message without newline.

Expands to Serial.print with "MEASUREMENT: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ MEASUREMENT_PRINTLN

#define MEASUREMENT_PRINTLN ( x)
Value:
Serial.println((String) "MEASUREMENT: " + x + MACRO_LOCATION)

Print a measurement message with newline.

Expands to Serial.println with "MEASUREMENT: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ NULL_PTR_CHECK

#define NULL_PTR_CHECK ( ptr)
Value:
if (ptr == nullptr) { \
CRITICAL_ERROR_PRINTLN("Null pointer exception: " + #ptr); \
}

Check a pointer for null and report a critical error if null.

Evaluates the provided pointer expression and if it is nullptr, prints a critical error with the pointer name and halts execution.

Parameters
ptrPointer expression to check.
Returns
This macro does not return on failure; execution halts in an infinite loop after reporting the error.

◆ WARNING_PRINT

#define WARNING_PRINT ( x)
Value:
Serial.print((String) "WARNING: " + x + MACRO_LOCATION)

Print a warning-level message without newline.

Expands to Serial.print with "WARNING: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).

◆ WARNING_PRINTLN

#define WARNING_PRINTLN ( x)
Value:
Serial.println((String) "WARNING: " + x + MACRO_LOCATION)

Print a warning-level message with newline.

Expands to Serial.println with "WARNING: " prefix and optional file/line info.

Parameters
xExpression or string to print (will be converted to String).