⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macro.h

📁 综合实验源代码-计算器
💻 H
字号:
/* store the status byte in FIFO0 for the chosen endpoint *************/
/* store the status byte in FIFO0 for the chosen endpoint *************/
#define EPSTATUS(epbit) {if(TSTBIT(stalld,epbit)) write_usb(TXD0,1);    \
                         else write_usb(TXD0,0); break;}

/* Flush and disable the USB TX0 **************************************/
#define FLUSHTX0 {write_usb(TXC0,FLUSH);}

/* Flush and disable the USB TX1 **************************************/
#define FLUSHTX1 {write_usb(TXC1,FLUSH);}

/* Flush and disable the USB TX2 **************************************/
#define FLUSHTX2 {write_usb(TXC2,FLUSH);}

/* Flush and disable the USB TX3 **************************************/
#define FLUSHTX3 {write_usb(TXC3,FLUSH);}

/* Flush and disable the USB RX0 **************************************/
#define FLUSHRX0 {write_usb(RXC0,FLUSH);}

/* Flush and disable the USB RX1 **************************************/
#define FLUSHRX1 {write_usb(RXC1,FLUSH);}

/* Flush and disable the USB RX2 **************************************/
#define FLUSHRX2 {write_usb(RXC2,FLUSH);}

/* Flush and disable the USB RX3 **************************************/
#define FLUSHRX3 {write_usb(RXC3,FLUSH);}

/* enable TX0, using the appropriate DATA PID *************************/
#define TXEN0_PID {if(TSTBIT(dtapid,TGL0PID)) write_usb(TXC0,TX_TOGL+TX_EN);\
            else write_usb(TXC0,TX_EN); TGLBIT(dtapid,TGL0PID);}

/* enable TX1, using the appropriate DATA PID, but not toggling it ****/
#define TXEN1_PID_NO_TGL {if(TSTBIT(dtapid,TGL1PID))                   \
            write_usb(TXC1,TX_TOGL+TX_LAST+TX_EN); else                \
            write_usb(TXC1,TX_LAST+TX_EN);}

/* enable TX1, using the appropriate DATA PID *************************/
#define TXEN1_PID {TXEN1_PID_NO_TGL; TGLBIT(dtapid,TGL1PID);}

/* clears the multi-packet mode bits **********************************/
#define CLR_GETDESC {CLRBIT(status,GETDESC); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_SENDCMD {CLRBIT(status,SENDCMD); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_READSTA {CLRBIT(status,READSTA); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_UPLOAD  {CLRBIT(status,UPLOAD); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_DOWNLOAD {CLRBIT(status,DOWNLOAD); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_ROOT    {CLRBIT(status,READROOT); /*CLRBIT(status,MLTIPKT);*/}
#define CLR_MEM    {CLRBIT(status,READMEM); /*CLRBIT(status,MLTIPKT);*/}

#define CLR_MLTIPKT {CLR_GETDESC;CLR_SENDCMD;CLR_READSTA;CLR_UPLOAD;CLR_DOWNLOAD;CLR_ROOT;CLR_MEM}
      
/* sets status.GETDESC and status.MLTIPKT *****************************/
#define SET_GETDESC {SETBIT(status,GETDESC); /*SETBIT(status,MLTIPKT);*/}

/* sets status.SENDCMD and status.MLTIPKT *****************************/
#define SET_SENDCMD {SETBIT(status,SENDCMD); /*SETBIT(status,MLTIPKT);*/}

/* sets status.READSTA and status.MLTIPKT *****************************/
#define SET_READSTA {SETBIT(status,READSTA); /*SETBIT(status,MLTIPKT);*/}

#define SET_UPLOAD  {SETBIT(status,UPLOAD); /*SETBIT(status,MLTIPKT);*/}
#define SET_DOWNLOAD {SETBIT(status,DOWNLOAD);/*SETBIT(status,MLTIPKT);*/}
#define SET_ROOT  {SETBIT(status,READROOT); /*SETBIT(status,MLTIPKT);*/}
#define SET_MEM  {SETBIT(status,READMEM); /*SETBIT(status,MLTIPKT);*/}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -