📄 debug.h
字号:
/* ########################################################################## */
/* Filename : debug.h */
/* */
/* Description : */
/* This file contains functions to implement various debugging modes. */
/* Direct Debugging - Normal debugging. Used under normal situations */
/* eg. Trace runs. */
/* Syntax : debug(&string) */
/* Buffered Debugging - Debugging thru a buffer (ie RS232). Mostly used in */
/* time-critical situations eg. During interrupts. */
/* Syntax : console(rs232Putc,&string) */
/* */
/* Settings : */
/* DEBUG_MODE - Selects the debugging mode. */
/* DEBUG_NONE (All debugging disabled) */
/* DEBUG_DIRECT (Only direct debugging supported) */
/* DEBUG_BUFFERED (Only buffered debugging supported) */
/* DEBUG_FULL (All debugging supported) */
/* pin_flag - Pin assignment for flag() function. */
/* */
/* User Functions : */
/* void debug() - Sends a debugging string thru the RS232 directly. */
/* void console() - Sends a debugging string thru the RS232 via a buffer. */
/* void flag() - Asserts a logic high on a pre-defined I/O pin. */
/* breakpoint() - Halts program execution until user sends a byte thru */
/* the RS232 and returns it. */
/* */
/* Interrupts Used : */
/* INT_TBE (For buffered debugging) */
/* */
/* ########################################################################## */
#DEFINE DEBUG_NONE 0
#DEFINE DEBUG_DIRECT 1
#DEFINE DEBUG_BUFFERED 2
#DEFINE DEBUG_FULL 3
#IFNDEF DEBUG_MODE
#DEFINE DEBUG_MODE DEBUG_NONE
#ENDIF
#IF DEBUG_MODE==DEBUG_BUFFERED
#DEFINE console printf
#DEFINE debug(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) //Ignores debugging lines.
#ELIF DEBUG_MODE==DEBUG_DIRECT
#DEFINE console(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) //Ignores debugging lines.
#DEFINE debug printf
#ELIF DEBUG_MODE==DEBUG_FULL
#DEFINE console ptinf
#DEFINE debug printf
#ENDIF
#ELSE //Debugging disabled.
#DEFINE console(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) //Ignores debugging lines.
#DEFINE debug(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) //Ignores debugging lines.
#ENDIF
#IFNDEF pin_flag
#DEFINE pin_flag pin_a0
#ENDIF
#DEFINE flag() output_high(pin_flag)
#DEFINE breakpoint getc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -