Initial commit: CCU621_M firmware project with BLE debug link support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef MYLOG_H
|
||||
#define MYLOG_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "app_init/app_init.h"
|
||||
|
||||
/* 提取文件名(去掉路径),用于日志输出。 */
|
||||
#define BASENAME(file) \
|
||||
(strrchr((file), '/') ? (strrchr((file), '/') + 1) : \
|
||||
(strrchr((file), '\\') ? (strrchr((file), '\\') + 1) : (file)))
|
||||
|
||||
/* 每个任务的日志开关:1-允许打印,0-禁止打印。 */
|
||||
extern uint8_t u8_task_log_flag[MY_TASK_NUM];
|
||||
|
||||
void v_mylog_task(void *argument);
|
||||
void v_format_logMsg(int id, const char *file, int line, const char *func, const char *fmt, ...);
|
||||
void v_mylog_udp_send_data(const uint8_t *data, uint16_t len);
|
||||
|
||||
#define MYLOG_ID_FORCE_OCPP 0xFFU
|
||||
#define MYLOG_ID_FORCE_IES 0xFEU
|
||||
|
||||
/* id=0xFFU 表示强制打印;其余 id 需在范围内且开关为1才打印。 */
|
||||
#define MYLOG_MSG(id, fmt, ...) \
|
||||
do { \
|
||||
if (((id) == 0xFFU) || (((uint32_t)(id) < (uint32_t)MY_TASK_NUM) && (u8_task_log_flag[(uint32_t)(id)] == 1U))) { \
|
||||
v_format_logMsg((id), BASENAME(__FILE__), __LINE__, __func__, (fmt), ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user