From 8e4be5dca748fb6b9b4022f027aa22713bc7a64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=99=E8=92=99plus?= Date: Wed, 26 Apr 2023 06:26:15 +0000 Subject: [PATCH] =?UTF-8?q?update=20include/rtdbg.h.=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=8C=E5=96=84LOG=5FHEX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蒙蒙plus --- include/rtdbg.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/rtdbg.h b/include/rtdbg.h index 4eb544aecb..05e3838b46 100644 --- a/include/rtdbg.h +++ b/include/rtdbg.h @@ -7,6 +7,7 @@ * Date Author Notes * 2016-11-12 Bernard The first version * 2018-05-25 armink Add simple API, such as LOG_D, LOG_E + * 2023-04-26 mengplus Add simple API, such as LOG_HEX */ /* @@ -147,6 +148,16 @@ extern "C" { _DBG_LOG_X_END; \ } \ while (0) +#define dbg_hex(type, buff, size) \ + do \ + { \ + _DBG_LOG_HDR("H", 0); \ + for (int i = 0; i < size; i++) \ + { \ + LOG_RAW(type, buff[i]); \ + } \ + _DBG_LOG_X_END; \ + } while (0) #define dbg_raw(...) rt_kprintf(__VA_ARGS__); @@ -156,6 +167,7 @@ extern "C" { #define dbg_enter #define dbg_exit #define dbg_log_line(lvl, color_n, fmt, ...) +#define dbg_hex(type, buff, size) #define dbg_raw(...) #endif /* DBG_ENABLE */ @@ -185,7 +197,7 @@ extern "C" { #define LOG_RAW(...) dbg_raw(__VA_ARGS__) -#define LOG_HEX(name, width, buf, size) +#define LOG_HEX(type, buff, size) dbg_hex(type, buff, size) #endif /* defined(RT_USING_ULOG) && define(DBG_ENABLE) */ -- Gitee