📄 event.c
字号:
#include "..\includes\includes.h"
#include "..\includes\includes.h"
/*
任务表:
1,按键扫描
2,等待定时中断
3,按键查询
4,用户操作超时事件
5,等待串行中断,并接收数据
*/
typedef struct
{
uint32 tWait; //允许等待时间
uint8 event[8];
uint32 wsTime; //记录开始等待事件发生的时间
} STRUCT_EVENT;
bank1 STRUCT_EVENT EVENT;
INT8U checkEventWaitTimeOut(void)
{ uint32 ntime;
if (EVENT.tWait==0)
return(FALSE);
else
{ ntime=loadSystemTime(TYPE_TIME_DHMS);
if (ntime-EVENT.wsTime>=EVENT.tWait)
return(TRUE);
else return(FALSE);
}
}
INT8U EventBurstWait(INT16U tWait,INT8U wEvent)
{
uint8 event=EVENT_NULL;
EVENT.tWait=tWait;
EVENT.wsTime=loadSystemTime(TYPE_TIME_DHMS);
while(1)
{ OS_SCHEDULE();
if (checkEventWaitTimeOut()==TRUE)
{ event=EVENT_TIMEOUT;
break;}
if (checkFull_comBuff()==TRUE)
{ event=EVENT_COM;
break;}
event =checkKeyEvent();
if (event!=EVENT_NULL)
{ if (wEvent!=EVENT_NULL)
{ if (event==wEvent)
break;}
else break;
}
}
return(event);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -