84 lines
2.4 KiB
C
84 lines
2.4 KiB
C
|
|
/*
|
|||
|
|
* debug.h
|
|||
|
|
*
|
|||
|
|
* Created on: May 14, 2025
|
|||
|
|
* Author: cc
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef MCU_DRIVER_DEBUG_H_
|
|||
|
|
#define MCU_DRIVER_DEBUG_H_
|
|||
|
|
|
|||
|
|
#include "ch564.h"
|
|||
|
|
#include <stdio.h>
|
|||
|
|
|
|||
|
|
/* UART Printf Definition */
|
|||
|
|
#define DEBUG_UART0 1
|
|||
|
|
#define DEBUG_UART1 2
|
|||
|
|
#define DEBUG_UART2 3
|
|||
|
|
#define DEBUG_UART3 4
|
|||
|
|
|
|||
|
|
/* DEBUG log function. DEBUG printf() <20><><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>*/
|
|||
|
|
#ifndef DBG_LOG_EN
|
|||
|
|
#define DBG_LOG_EN 1 //DEBUG LOG <20><><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#define DBG_Particular_EN 1 //<2F><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> -- <20><><EFBFBD>嵽<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
|||
|
|
#define DBG_NET_LOG_EN 1 //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʼ״̬*/
|
|||
|
|
#define DBG_OPT_ActCond_STATUS 1 //<2F><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_MQTT_STATUS 1 //MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_Debug_STATUS 1 //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_LOGIC_STATUS 1 //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_DEVICE_STATUS 1 //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_NET_STATUS 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
#define DBG_OPT_SYS_STATUS 1 //ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ*/
|
|||
|
|
#define DBG_BIT_ActCond_STATUS_bit 6
|
|||
|
|
#define DBG_BIT_MQTT_STATUS_bit 5
|
|||
|
|
#define DBG_BIT_Debug_STATUS_bit 4
|
|||
|
|
#define DBG_BIT_LOGIC_STATUS_bit 3
|
|||
|
|
#define DBG_BIT_DEVICE_STATUS_bit 2
|
|||
|
|
#define DBG_BIT_NET_STATUS_bit 1
|
|||
|
|
#define DBG_BIT_SYS_STATUS_bit 0
|
|||
|
|
|
|||
|
|
|
|||
|
|
#ifdef DBG_LOG_EN
|
|||
|
|
#define DBG_Printf(...) printf(__VA_ARGS__)
|
|||
|
|
#else
|
|||
|
|
#define DBG_Printf(...)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#ifdef DBG_Particular_EN
|
|||
|
|
#define DBG_log(...) {DBG_Printf("%s %s-%d :",__FILE__,__func__,__LINE__);DBG_Printf(__VA_ARGS__);}
|
|||
|
|
#else
|
|||
|
|
#define DBG_log(...) DBG_Printf(__VA_ARGS__)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#define DBG_INFO(msg) DBG_Printf("%s %s-%d :%s",__FILE__,__func__,__LINE__,msg)
|
|||
|
|
|
|||
|
|
#ifdef DBG_NET_LOG_EN
|
|||
|
|
#define DBG_NET_log(...) DBG_Printf(__VA_ARGS__)
|
|||
|
|
#else
|
|||
|
|
#define DBG_NET_log(...)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
extern uint32_t Dbg_Switch;
|
|||
|
|
|
|||
|
|
|
|||
|
|
extern volatile uint32_t SysTick_100us;
|
|||
|
|
extern volatile uint32_t SysTick_1ms;
|
|||
|
|
extern volatile uint32_t SysTick_1s;
|
|||
|
|
|
|||
|
|
void Systick_Init(void);
|
|||
|
|
void Delay_Us(uint32_t n);
|
|||
|
|
void Delay_Ms(uint32_t n);
|
|||
|
|
|
|||
|
|
void Dbg_NoTick_Print(int DbgOptBit ,const char *cmd, ...);
|
|||
|
|
void Dbg_Print(int DbgOptBit ,const char *cmd, ...);
|
|||
|
|
void Dbg_Println(int DbgOptBit ,const char *cmd, ...);
|
|||
|
|
void Dbg_Print_Buff(int DbgOptBit ,const char *cmd ,uint8_t *buff,uint32_t len);
|
|||
|
|
|
|||
|
|
#endif /* MCU_DRIVER_DEBUG_H_ */
|