From aa38e5c1f48e31213ee349aa5cd6f06c85bda70d Mon Sep 17 00:00:00 2001 From: android <android@lingyun.com> Date: Tue, 25 Jun 2024 21:49:39 +0800 Subject: [PATCH] Add GD32F103RCT6 ADC converter board SDK source code --- mcu_sdk/gd32f103/rk_eFire/Utiles/Utilities/logger.h | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 133 insertions(+), 0 deletions(-) diff --git a/mcu_sdk/gd32f103/rk_eFire/Utiles/Utilities/logger.h b/mcu_sdk/gd32f103/rk_eFire/Utiles/Utilities/logger.h new file mode 100644 index 0000000..a4c70ee --- /dev/null +++ b/mcu_sdk/gd32f103/rk_eFire/Utiles/Utilities/logger.h @@ -0,0 +1,133 @@ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include <stdarg.h> + +#define OS_LOG_NONE 0 /* Set rollback size to 0 will not rollback */ + +typedef enum +{ + LOG_LEVEL_DISB = 0, /* Disable "Debug" */ + LOG_LEVEL_FATAL, /* Debug Level "Fatal" */ + LOG_LEVEL_ERROR, /* Debug Level "ERROR" */ + LOG_LEVEL_WARN, /* Debug Level "warnning" */ + LOG_LEVEL_NRML, /* Debug Level "Normal" */ + LOG_LEVEL_DEBUG, /* Debug Level "Debug" */ + LOG_LEVEL_INFO, /* Debug Level "Information" */ + LOG_LEVEL_TRACE, /* Debug Level "Trace" */ + LOG_LEVEL_MAX, +}dbg_level_e; + +typedef enum +{ + DEBUG_NONE = 0, /* ������debug */ + DEBUG_MODE /* debug ģʽ*/ +} DebugMode_e; + + +#define TH_EXPORT +#define TH_VSNPRINTF vsnprintf +#define TH_SNPRINTF snprintf /* int snprintf(char *str, size_t size, const char *format, ...); */ + + +//������ɫ +#define COLOR_NORMAL "\033[0m" +#define COLOR_BLACK "\033[0;40;30m" +#define COLOR_RED "\033[0;40;31m" +#define COLOR_LRED "\033[1;40;31m" /* ����*/ +#define COLOR_GREEN "\033[0;40;32m" +#define COLOR_YELLOW "\033[0;40;33m" +#define COLOR_LYELLOW "\033[1;40;33m" +#define COLOR_BLUE "\033[0;40;34m" +#define COLOR_PURPLE "\033[0;40;35m" +#define COLOR_CYAN "\033[0;40;36m" +#define COLOR_LCYAN "\033[1;40;36m" +#define COLOR_WHILE "\033[0;40;37m" + +//�����ӡ���� +#define TH_PRINT_DEBUG 0 /* �����õ���Ϣ */ +#define TH_PRINT_INFO 1 /* ��֪ϵͳ�����¼�����Ϣ */ +#define TH_PRINT_PRIMA 2 /* ��ʾ��Ҫ����������*/ +#define TH_PRINT_ALERT 3 /* δ�� */ +#define TH_PRINT_WARN 4 /* ���Է��ṩ����ȷ�����������Ĵ��� */ +#define TH_PRINT_EMERG 5 /* ���IJ�(CORE)����,����,����ϵͳ,�ļ���д���� */ +#define TH_PRINT_FAIL 6 /* �����������Ĵ���(�ٴγ��Կ��ܳɹ�,������)*/ +#define TH_PRINT_ERR 7 /* ����(���ܿ��Ӧ�ÿ�)��ʾ��ϵͳ�Դ��� */ +#define TH_PRINT_MAX 8 /* ��� */ + +//���嵱ǰ��ӡ���� +//����TH_PRINT_CUR����Ĵ�ӡ��Ϣ�����������뵽���ļ��С� +#define TH_PRINT_CUR TH_PRINT_INFO + +#if TH_PRINT_DEBUG>=TH_PRINT_CUR +#define DebugPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_WHILE,pstrMod,TH_PRINT_DEBUG,"!!!!!","",__LINE__,__FUNCTION__,##args) +#else +#define DebugPrintf(pstrMod,args...) +#endif + +#if TH_PRINT_INFO>=TH_PRINT_CUR +#define InforPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_GREEN,pstrMod,TH_PRINT_INFO,"info","",__LINE__,__FUNCTION__,##args) +#else +#define InforPrintf(pstrMod,args...) +#endif + +#if TH_PRINT_PRIMA>=TH_PRINT_CUR +#define PrimaPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_LYELLOW,pstrMod,TH_PRINT_PRIMA,"prima","",__LINE__,__FUNCTION__,##args) +#else +#define PrimaPrintf(pstrMod,args...) +#endif + + +#if TH_PRINT_FAIL>=TH_PRINT_CUR +#define FailPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_RED,pstrMod,TH_PRINT_FAIL,"fail","",__LINE__,__FUNCTION__,##args) +#else +#define FailPrintf(pstrMod,args...) +#endif + +#if TH_PRINT_WARN>=TH_PRINT_CUR +#define WarningPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_YELLOW,pstrMod,TH_PRINT_WARN,"warning","",__LINE__,__FUNCTION__,##args) +#else +#define WarningPrintf(pstrMod,args...) +#endif + +#if TH_PRINT_ERR>=TH_PRINT_CUR +#define ErrorPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_LRED,pstrMod,TH_PRINT_ERR,"error","",__LINE__,__FUNCTION__,##args) +#else +#define ErrorPrintf(pstrMod,args...) +#endif + +#if TH_PRINT_ALERT>=TH_PRINT_CUR +#define AlertPrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_CYAN,pstrMod,TH_PRINT_ALERT,"alert","",__LINE__,__FUNCTION__,##args) +#else +#define AlertPrintf(pstrMod,args...) +#endif + +#define NonePrintf(pstrMod,args...) \ + Board_DebugPrintf(COLOR_NORMAL,pstrMod,TH_PRINT_MAX,"none","",__LINE__,__FUNCTION__,##args) + +/* + * �������� + * �ڲ�ģ��ʹ�� + * ������Դ�ӡ���� + */ +#define ES800_DebugPrint(args,sz...) DebugPrintf("ES800",args,##sz) +#define ES800_InforPrint(args,sz...) InforPrintf("ES800",args,##sz) +#define ES800_PrimaPrint(args,sz...) PrimaPrintf("ES800",args,##sz) +#define ES800_FailPrint(args,sz...) FailPrintf("ES800",args,##sz) +#define ES800_WarningPrint(args,sz...) WarningPrintf("ES800",args,##sz) +#define ES800_ErrorPrint(args,sz...) ErrorPrintf("ES800",args,##sz) +#define ES800_AlertPrint(args,sz...) AlertPrintf("ES800",args,##sz) +#define ES800_NonePrint(args,sz...) NonePrintf("ES800",args,##sz) + +void Board_DebugInit(int Level); +void Board_DebugDeInit(void); +void Board_DebugPrintf(char *Color, char *Module, int Level, char *LevelName, char *FileName, int LineNum, const char *Func, char *Fmt, ...); + +#endif /* End of __LOGGER_H__ */ -- Gitblit v1.9.1