Files
STM32F4-Base/simulator/dbg_log.h
T
2026-08-31 17:09:59 +08:00

39 lines
871 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* dbg_log.h — 模拟器专用调试日志 stub(覆盖 MCU 工程的 Drivers/BSP/dbg_log.h)
*
* 模拟器不使用 sys_clock.h / RTC,因此把 DBG_* 宏直接映射到 printf,
* 使 ui_menu.c 等共享代码的日志在 PC 控制台可见。
* DBG_TAG 仍需各 .c 文件在 include 前定义,这里保留该约定。
*/
#ifndef __DBG_LOG_H
#define __DBG_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#ifndef DBG_TAG
#define DBG_TAG ""
#endif
#define DBG_ERROR(fmt, ...) do { \
printf("[ERR]" DBG_TAG " " fmt "\n", ##__VA_ARGS__); \
} while (0)
#define DBG_INFO(fmt, ...) do { \
printf(DBG_TAG " " fmt "\n", ##__VA_ARGS__); \
} while (0)
#define DBG_DEBUG(fmt, ...) do { \
printf(DBG_TAG "(%s:%d) " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
} while (0)
#ifdef __cplusplus
}
#endif
#endif /* __DBG_LOG_H */