#ifndef __DEBUG_H #define __DEBUG_H #include "stm32f10x.h" #include // 调试功能开关(1=开启调试,0=关闭调试) #define DEBUG_ENABLE 1 // 暂时关闭,添加Debug.c后改回1 // 调试串口初始化(使用USART2,PA2/PA3) void Debug_Init(void); // 调试信息输出函数 void Debug_Printf(const char* format, ...); // 快捷宏定义 #if DEBUG_ENABLE #define DEBUG_PRINT(...) Debug_Printf(__VA_ARGS__) #define DEBUG_INFO(msg) Debug_Printf("[INFO] %s\r\n", msg) #define DEBUG_ERROR(msg) Debug_Printf("[ERROR] %s\r\n", msg) #define DEBUG_OK(msg) Debug_Printf("[OK] %s\r\n", msg) #else #define DEBUG_PRINT(...) #define DEBUG_INFO(msg) #define DEBUG_ERROR(msg) #define DEBUG_OK(msg) #endif #endif