Trident IoT Zigbee SDK
Loading...
Searching...
No Matches
tr_debug_print.h
Go to the documentation of this file.
1
10#ifndef TR_DEBUG_PRINT_H
11#define TR_DEBUG_PRINT_H
12#include "zb_common.h"
13
14// debug print colors
15#define DEBUG_BLACK "\033[30m"
16#define DEBUG_RED "\033[31m"
17#define DEBUG_GREEN "\033[32m"
18#define DEBUG_YELLOW "\033[33m"
19#define DEBUG_BLUE "\033[34m"
20#define DEBUG_MAGENTA "\033[35m"
21#define DEBUG_CYAN "\033[36m"
22#define DEBUG_WHITE "\033[37m"
23#define DEBUG_DEFAULT "\033[39m"
24#define DEBUG_RESET "\033[m"
25
26// set default color(s) if color print is disabled
27#ifndef TR_DEBUG_PRINT_COLOR_ENABLED
28#ifdef TR_DEBUG_PRINT_STACK_ENABLED
29#define TR_DEBUG_PRINT_STACK_COLOR DEBUG_DEFAULT
30#endif
31#ifdef TR_DEBUG_PRINT_CORE_ENABLED
32#define TR_DEBUG_PRINT_CORE_COLOR DEBUG_DEFAULT
33#endif
34#ifdef TR_DEBUG_PRINT_APP_ENABLED
35#define TR_DEBUG_PRINT_APP_COLOR DEBUG_DEFAULT
36#endif
37#ifdef TR_DEBUG_PRINT_ZCL_ENABLED
38#define TR_DEBUG_PRINT_ZCL_COLOR DEBUG_DEFAULT
39#endif
40#ifdef TR_DEBUG_PRINT_RX_MSGS_ENABLED
41#define TR_DEBUG_PRINT_RX_MSGS_COLOR DEBUG_DEFAULT
42#endif
43#endif /* ifndef TR_DEBUG_PRINT_COLOR_ENABLED */
44
45// print groups
55
56#ifdef TR_DEBUG_PRINT_STACK_ENABLED
57#define tr_stack_printf(...) tr_debug_printf(TR_DEBUG_PRINT_STACK, TR_DEBUG_PRINT_STACK_COLOR, __VA_ARGS__)
58#define tr_stack_println(...) tr_debug_println(TR_DEBUG_PRINT_STACK, TR_DEBUG_PRINT_STACK_COLOR, __VA_ARGS__)
59#else
60#define tr_stack_printf(...)
61#define tr_stack_println(...)
62#endif
63
64#ifdef TR_DEBUG_PRINT_CORE_ENABLED
65#define tr_core_printf(...) tr_debug_printf(TR_DEBUG_PRINT_CORE, TR_DEBUG_PRINT_CORE_COLOR, __VA_ARGS__)
66#define tr_core_println(...) tr_debug_println(TR_DEBUG_PRINT_CORE, TR_DEBUG_PRINT_CORE_COLOR, __VA_ARGS__)
67#else
68#define tr_core_printf(...)
69#define tr_core_println(...)
70#endif
71
72#ifdef TR_DEBUG_PRINT_APP_ENABLED
73#define tr_app_printf(...) tr_debug_printf(TR_DEBUG_PRINT_APP, TR_DEBUG_PRINT_APP_COLOR, __VA_ARGS__)
74#define tr_app_println(...) tr_debug_println(TR_DEBUG_PRINT_APP, TR_DEBUG_PRINT_APP_COLOR, __VA_ARGS__)
75#else
76#define tr_app_printf(...)
77#define tr_app_println(...)
78#endif
79
80#ifdef TR_DEBUG_PRINT_ZCL_ENABLED
81#define tr_zcl_printf(...) tr_debug_printf(TR_DEBUG_PRINT_ZCL, TR_DEBUG_PRINT_ZCL_COLOR, __VA_ARGS__)
82#define tr_zcl_println(...) tr_debug_println(TR_DEBUG_PRINT_ZCL, TR_DEBUG_PRINT_ZCL_COLOR, __VA_ARGS__)
83#else
84#define tr_zcl_printf(...)
85#define tr_zcl_println(...)
86#endif
87
88#ifdef TR_DEBUG_PRINT_RX_MSGS_ENABLED
89#define tr_rxmsgs_printf(...) tr_debug_printf(TR_DEBUG_PRINT_RX_MSGS, TR_DEBUG_PRINT_RX_MSGS_COLOR, __VA_ARGS__)
90#define tr_rxmsgs_println(...) tr_debug_println(TR_DEBUG_PRINT_RX_MSGS, TR_DEBUG_PRINT_RX_MSGS_COLOR, __VA_ARGS__)
91#else
92#define tr_rxmsgs_printf(...)
93#define tr_rxmsgs_println(...)
94#endif
95
105
108zb_uint32_t tr_get_print_group_mask(void);
109
113
117
122
124
129 const char *color,
130 const char *fmt,
131 ...);
132
134 const char *color,
135 const char *fmt,
136 ...);
137
138#endif // TR_DEBUG_PRINT_H
void tr_disable_print_group(tr_debug_print_group_t group)
disable a print group
zb_uint32_t tr_get_print_group_mask(void)
get the print group mask
void tr_enable_print_group(tr_debug_print_group_t group)
enable a print group
zb_bool_t tr_check_print_group(tr_debug_print_group_t group)
check to see if a print group is enabled
void tr_debug_println(tr_debug_print_group_t group, const char *color, const char *fmt,...)
void tr_debug_printf(tr_debug_print_group_t group, const char *color, const char *fmt,...)
tr_debug_print_group_t
Definition tr_debug_print.h:47
@ TR_DEBUG_PRINT_ZCL
Definition tr_debug_print.h:51
@ TR_DEBUG_PRINT_APP
Definition tr_debug_print.h:50
@ TR_DEBUG_PRINT_CORE
Definition tr_debug_print.h:49
@ TR_DEBUG_PRINT_ALL
Definition tr_debug_print.h:53
@ TR_DEBUG_PRINT_RX_MSGS
Definition tr_debug_print.h:52
@ TR_DEBUG_PRINT_STACK
Definition tr_debug_print.h:48