mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 11:29:26 +00:00
Tidy up print/debug logging headers (#22969)
This commit is contained in:
parent
f2299ee5f8
commit
bb71145632
@ -24,10 +24,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "avr/xprintf.h"
|
#include "avr/xprintf.h"
|
||||||
|
|
||||||
// Create user & normal print defines
|
|
||||||
#define print(s) xputs(PSTR(s))
|
|
||||||
#define println(s) xputs(PSTR(s "\r\n"))
|
|
||||||
#define uprint(s) xputs(PSTR(s))
|
|
||||||
#define uprintln(s) xputs(PSTR(s "\r\n"))
|
|
||||||
#define uprintf(fmt, ...) __xprintf(PSTR(fmt), ##__VA_ARGS__)
|
|
@ -54,26 +54,14 @@ extern debug_config_t debug_config;
|
|||||||
* Debug print utils
|
* Debug print utils
|
||||||
*/
|
*/
|
||||||
#ifndef NO_DEBUG
|
#ifndef NO_DEBUG
|
||||||
|
# define dprintf(fmt, ...) \
|
||||||
# define dprint(s) \
|
do { \
|
||||||
do { \
|
if (debug_config.enable) xprintf(fmt, ##__VA_ARGS__); \
|
||||||
if (debug_enable) print(s); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
# define dprintln(s) \
|
|
||||||
do { \
|
|
||||||
if (debug_enable) println(s); \
|
|
||||||
} while (0)
|
|
||||||
# define dprintf(fmt, ...) \
|
|
||||||
do { \
|
|
||||||
if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \
|
|
||||||
} while (0)
|
|
||||||
# define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)
|
|
||||||
|
|
||||||
#else /* NO_DEBUG */
|
#else /* NO_DEBUG */
|
||||||
|
|
||||||
# define dprint(s)
|
|
||||||
# define dprintln(s)
|
|
||||||
# define dprintf(fmt, ...)
|
# define dprintf(fmt, ...)
|
||||||
# define dmsg(s)
|
|
||||||
|
|
||||||
#endif /* NO_DEBUG */
|
#endif /* NO_DEBUG */
|
||||||
|
|
||||||
|
#define dprint(s) dprintf(s)
|
||||||
|
#define dprintln(s) dprintf(s "\r\n")
|
||||||
|
#define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)
|
||||||
|
@ -52,40 +52,27 @@ void print_set_sendchar(sendchar_func_t func);
|
|||||||
# if __has_include_next("_print.h")
|
# if __has_include_next("_print.h")
|
||||||
# include_next "_print.h" /* Include the platforms print.h */
|
# include_next "_print.h" /* Include the platforms print.h */
|
||||||
# else
|
# else
|
||||||
// Fall back to lib/printf
|
# include "printf.h" // // Fall back to lib/printf/printf.h
|
||||||
# include "printf.h" // lib/printf/printf.h
|
|
||||||
|
|
||||||
// Create user & normal print defines
|
|
||||||
# define print(s) printf(s)
|
|
||||||
# define println(s) printf(s "\r\n")
|
|
||||||
# define xprintf printf
|
# define xprintf printf
|
||||||
# define uprint(s) printf(s)
|
# endif
|
||||||
# define uprintln(s) printf(s "\r\n")
|
#else
|
||||||
# define uprintf printf
|
|
||||||
|
|
||||||
# endif /* __has_include_next("_print.h") */
|
|
||||||
#else /* NO_PRINT */
|
|
||||||
# undef xprintf
|
|
||||||
// Remove print defines
|
// Remove print defines
|
||||||
# define print(s)
|
# undef xprintf
|
||||||
# define println(s)
|
|
||||||
# define xprintf(fmt, ...)
|
# define xprintf(fmt, ...)
|
||||||
# define uprintf(fmt, ...)
|
#endif
|
||||||
# define uprint(s)
|
|
||||||
# define uprintln(s)
|
|
||||||
|
|
||||||
#endif /* NO_PRINT */
|
// Resolve before USER_PRINT can remove
|
||||||
|
#define uprintf xprintf
|
||||||
|
|
||||||
#ifdef USER_PRINT
|
#ifdef USER_PRINT
|
||||||
// Remove normal print defines
|
// Remove normal print defines
|
||||||
# undef print
|
|
||||||
# undef println
|
|
||||||
# undef xprintf
|
# undef xprintf
|
||||||
# define print(s)
|
|
||||||
# define println(s)
|
|
||||||
# define xprintf(fmt, ...)
|
# define xprintf(fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define print(s) xprintf(s)
|
||||||
|
#define println(s) xprintf(s "\r\n")
|
||||||
|
|
||||||
#define print_dec(i) xprintf("%u", i)
|
#define print_dec(i) xprintf("%u", i)
|
||||||
#define print_decs(i) xprintf("%d", i)
|
#define print_decs(i) xprintf("%d", i)
|
||||||
/* hex */
|
/* hex */
|
||||||
@ -121,6 +108,9 @@ void print_set_sendchar(sendchar_func_t func);
|
|||||||
//
|
//
|
||||||
// !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!!
|
// !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!!
|
||||||
|
|
||||||
|
#define uprint(s) uprintf(s)
|
||||||
|
#define uprintln(s) uprintf(s "\r\n")
|
||||||
|
|
||||||
/* decimal */
|
/* decimal */
|
||||||
#define uprint_dec(i) uprintf("%u", i)
|
#define uprint_dec(i) uprintf("%u", i)
|
||||||
#define uprint_decs(i) uprintf("%d", i)
|
#define uprint_decs(i) uprintf("%d", i)
|
||||||
|
Loading…
Reference in New Issue
Block a user