wch-code/ch32v307_mp3_dac/User/debug.h
2024-05-05 22:27:52 +08:00

41 lines
1.6 KiB
C

#ifndef __DEBUG_H
#define __DEBUG_H
#include "ch32v30x.h"
#include <stdio.h>
#include <string.h>
#define CSI_START "\033["
#define CSI_END "\033[0m"
/* output log front color */
#define F_BLACK "30;"
#define F_RED "31;"
#define F_GREEN "32;"
#define F_YELLOW "33;"
#define F_BLUE "34;"
#define F_MAGENTA "35;"
#define F_CYAN "36;"
#define F_WHITE "37;"
/* output log background color */
#define B_NULL
#define B_BLACK "40;"
#define B_RED "41;"
#define B_GREEN "42;"
#define B_YELLOW "43;"
#define B_BLUE "44;"
#define B_MAGENTA "45;"
#define B_CYAN "46;"
#define B_WHITE "47;"
/* output log fonts style */
#define S_BOLD "1m"
#define S_UNDERLINE "4m"
#define S_BLINK "5m"
#define S_NORMAL "22m"
#define LOG_E(format, ...) printf(CSI_START F_RED S_NORMAL "E/%s: " format CSI_END "\r\n", __func__, ##__VA_ARGS__)
#define LOG_W(format, ...) printf(CSI_START F_YELLOW S_NORMAL "W/%s: " format CSI_END "\r\n", __func__, ##__VA_ARGS__)
#define LOG_I(format, ...) printf(CSI_START F_GREEN S_NORMAL "I/%s: " format CSI_END "\r\n", __func__, ##__VA_ARGS__)
#define LOG_D(format, ...) printf( "D/%s: " format "\r\n", __func__, ##__VA_ARGS__)
#endif