Files
LaserTracing/Module/LaserTracing_Debug/UartDebug.h
T

60 lines
1.2 KiB
C

#ifndef __DEBUG_H
#define __DEBUG_H
#include "bsp.h"
#if (USE_DEBUG != 0)
#define DEBUG_BUFSIZE 200
#define DEBUG_BUFF_SIZE_MAX 512
#define DebugUartSend(X) LPUartSend(X)
void vcom_Send( char *format, ... );
void vcom_Send2(uint8_t *sData, uint16_t len);
#define DBG_LOG2(x, y) vcom_Send2(x, y) //打印长度超过缓存DEBUG_BUFF_SIZE_MAX的信息
#define DBG_LOG(...) vcom_Send(__VA_ARGS__)
#define DBG_LOG_F(fmt,arg...) LOG("[%s] "fmt,__FUNCTION__,##arg)
#define DBG_ARRAY(ARRAY,SIZE) { \
if(ARRAY != NULL) { \
for(int i = 0; i < SIZE; i++) { \
DBG_LOG("%02x ",ARRAY[i]); \
} \
DBG_LOG("\r\n"); \
} \
}
typedef enum {
DBG_CH_UART0 = 0, //默认串口调试方式 Uart0Init
DBG_CH_RS485_1, //RS485_1 (LPUART0)
}DebugChannel_e;
extern volatile DebugChannel_e gDebugChannel;
typedef void (*DebugExec)(int argc, char *argv[]);
typedef struct{
char *DBGCmd;
DebugExec DBGExec;
}DBGFunType;
void DebugUartIRQ(uint8_t Data);
void DebugLoopHandler(void);
void Debug1mSRoutine(void);
//void ReadBootPara(BootPara rData);
//void WriteBootPara(BootPara wData);
//extern BootPara_t BLPara;
#else
#define DBG_LOG2(x, y)
#define DBG_LOG(...)
#define DBG_LOG_F(fmt,arg...)
#define DBG_ARRAY(ARRAY,SIZE)
#endif
#endif