sentry_gimbal_hzz/bsp/log/bsp_log.h

44 lines
1.3 KiB
C
Raw Normal View History

2022-11-11 21:20:58 +08:00
#ifndef _BSP_LOG_H
#define _BSP_LOG_H
2023-01-01 17:32:22 +08:00
/**
* @brief ,LOGI,LOGW,LOGE等使用
2023-01-01 17:32:22 +08:00
*
*/
#define LOG_PROTO(type,color,format,...) \
SEGGER_RTT_printf(BUFFER_INDEX," %s%s"format"\r\n%s", \
color, \
type, \
##__VA_ARGS__, \
RTT_CTRL_RESET)
/* 清屏 */
#define LOG_CLEAR() SEGGER_RTT_WriteString(0, " "RTT_CTRL_CLEAR)
/* 无颜色日志输出 */
#define LOG(format,...) LOG_PROTO("","",format,##__VA_ARGS__)
/* 有颜色格式日志输出 */
#define LOGINFO(format,...) LOG_PROTO("I: ", RTT_CTRL_TEXT_BRIGHT_GREEN , format, ##__VA_ARGS__)
#define LOGWARNING(format,...) LOG_PROTO("W: ", RTT_CTRL_TEXT_BRIGHT_YELLOW, format, ##__VA_ARGS__)
#define LOGERROR(format,...) LOG_PROTO("E: ", RTT_CTRL_TEXT_BRIGHT_RED , format, ##__VA_ARGS__)
2022-12-02 23:10:36 +08:00
2023-01-01 17:32:22 +08:00
/**
* @brief segger RTT打印日志,,printf
*
* @param fmt
* @param ...
* @return int log字符数
2023-01-01 17:32:22 +08:00
*/
int PrintLog(const char *fmt, ...);
2022-12-02 23:10:36 +08:00
2023-01-01 17:32:22 +08:00
/**
* @brief sprintf(),float转换为字符串进行打印
*
* @param str
* @param va float
*/
2022-11-11 21:20:58 +08:00
void Float2Str(char *str, float va);
#endif