// file: debug_print.h
/*******************************************************************************
 * Debug print macros (conditional compilation)
 *
 * Debug output macros using SEGGER RTT (Real Time Transfer).
 * Sends logs to the PC in real time via J-Link debugger.
 * Minimal impact on system timing since UART is not used.
 *
 * === Conditional compilation ===
 * ENABLE_PRINTF = 1: DBG_PRINTF maps to SEGGER_RTT_printf (channel 0)
 *                    -> Actual log output (for debugging)
 * ENABLE_PRINTF = 0: DBG_PRINTF maps to an empty macro
 *                    -> Completely removed from code (for release builds)
 *
 * === Usage ===
 * DBG_PRINTF("val: %d\r\n", value);  // Same format string as printf
 * View output in SEGGER RTT Viewer or J-Link RTT Client.
 ******************************************************************************/
#ifndef DEBUG_PRINT_H
#define DEBUG_PRINT_H

#define ENABLE_PRINTF 1  /* 1=Enable debug output, 0=Disable globally */

#if ENABLE_PRINTF
    #include "SEGGER_RTT.h"
    /* Print formatted string to SEGGER RTT channel 0 */
    #define DBG_PRINTF(...) SEGGER_RTT_printf(0, __VA_ARGS__)
#else
    /* Empty macro: compiler removes all call-site code */
    #define DBG_PRINTF(...) // Do nothing
#endif

#endif // DEBUG_PRINT_H
