39 lines
871 B
C
39 lines
871 B
C
/*
|
||
* 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 */
|