funcgetch.c

来自「本人编写的无线电话程序,给予PIC18C801设计,包括了uCOS的移植以及菜单」· C语言 代码 · 共 30 行

C
30
字号
#include "Includes.h"
#include "funccommon.h"
#include "event.h"

//this is a common function to wait for message and discard useless message
//return 0xff for MSG_MENU_CANCEL and key value for key press event
INT8U MFunc_WaitForInput(INT8U val){
	INT8U rom * pMsg;
	INT8U err,retval;
	for(;;){
		pMsg = OSQPend(peventMenu,val,&err);
		if(err==OS_TIMEOUT)
			return(0xFD);
			
		else if((INT24U)pMsg >= PTR_MAX){
			if((INT24U)pMsg == MSG_MENU_CANCEL){
				return(0xff);
			}
		}
		else{
			retval = 0xff;
			if(((MSG_HEAD *)pMsg)->Msg_ID == MSG_MENU_KEY){
				retval = ((MSG_KEYPRESS *)pMsg)->Key;
			}
			Func_Clear_Msg(pMsg);			
			if(retval != 0xff) return(retval);
		}
	}
}

⌨️ 快捷键说明

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