57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
/***
|
|
* @Author: mbw
|
|
* @Date: 2024-08-30 11:34:58
|
|
* @LastEditors: mbw && 1600520629@qq.com
|
|
* @LastEditTime: 2024-08-30 11:52:09
|
|
* @FilePath: \USART1_Interrupt - RT-Thread\LIB\RTT\user_rtt.h
|
|
* @Description:
|
|
* @
|
|
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
|
*/
|
|
/*
|
|
* @Author: xmprocat
|
|
* @Date: 2023-03-20 20:26:22
|
|
* @LastEditors: xmprocat
|
|
* @LastEditTime: 2023-03-20 20:26:42
|
|
* @Description:
|
|
*/
|
|
#ifndef _LOG_H_
|
|
#define _LOH_H_
|
|
#include "SEGGER_RTT.h"
|
|
|
|
#define LOG_DEBUG 1
|
|
|
|
#if LOG_DEBUG
|
|
|
|
|
|
#define LOG_PROTO(type,color,format,...) \
|
|
SEGGER_RTT_printf(0," %s%s"format"\r\n%s", \
|
|
color, \
|
|
type, \
|
|
##__VA_ARGS__, \
|
|
RTT_CTRL_RESET)
|
|
|
|
/* 清屏*/
|
|
#define LOG_CLEAR() SEGGER_RTT_WriteString(0, " "RTT_CTRL_CLEAR)
|
|
|
|
/* 无颜色日志输出 */
|
|
#define RTT_LOG(format,...) LOG_PROTO("","",format,##__VA_ARGS__)
|
|
|
|
/* 有颜色格式日志输出 */
|
|
#define RTT_LOG_I(format,...) LOG_PROTO("I: ", RTT_CTRL_TEXT_BRIGHT_GREEN , format, ##__VA_ARGS__)
|
|
#define RTT_LOG_W(format,...) LOG_PROTO("W: ", RTT_CTRL_TEXT_BRIGHT_YELLOW, format, ##__VA_ARGS__)
|
|
#define RTT_LOG_E(format,...) LOG_PROTO("E: ", RTT_CTRL_TEXT_BRIGHT_RED , format, ##__VA_ARGS__)
|
|
#define RTT_LOG_D(format,...) LOG_PROTO("D: ", RTT_CTRL_TEXT_BRIGHT_BLACK , format, ##__VA_ARGS__)
|
|
|
|
#else
|
|
#define LOG_CLEAR()
|
|
#define LOG
|
|
#define LOGI
|
|
#define LOGW
|
|
#define LOGE
|
|
|
|
#endif
|
|
|
|
#endif // !_LOG_H_
|
|
|