新手入门
- 积分
- 4
- 金钱
- 4
- 注册时间
- 2021-10-11
- 在线时间
- 1 小时
|
2金钱
程序设计结构如下:
static fVoidVoid * _apfTest[] = {
GUIDEMO_HardwareInfo,
#if 0//GUI_SUPPORT_TOUCH
GUIDEMO_Touch,
#endif
GUIDEMO_Speed,
#if GUI_SUPPORT_MEMDEV
GUIDEMO_Graph,
#endif
}
/* Run the individual demos ! */
for (_iTest = 0; _apfTest[_iTest]; /*_iTest++*/) {
(*_apfTest[_iTest])();
}
以上是个函数指针结构,根据_iTest的值执行不同的页面函数。
/*********************************************************************
*
* GUIDEMO_Speed
*
**********************************************************************
*/
void GUIDEMO_Speed(void) {
rt_kprintf("GUIDEMO_Speed\n");
GUI_Clear();
jCreateWindow();
GUI_X_SignalEvent();
while(1)
{
#ifdef GUI_BUFFERS
GUI_MULTIBUF_Begin();
#endif
GUI_Exec();
#ifdef GUI_BUFFERS
GUI_MULTIBUF_End();
#endif
GUI_X_WaitEventTimed(/*10*/3);
if(TimingSet == 1)
{
TimingSet = 0;
_iTest = 2;
break;
}
if(AudioDevice == 1)
{
AudioDevice = 0;
_iTest = 3;
break;
}
if(screen == 1)
{
screen = 0;
_iTest = 4;
break;
}
if(projector == 1)
{
projector = 0;
_iTest = 5;
break;
}
if(ESC_MENU == 1)
{
ESC_MENU = 0;
_iTest = 0;
break;
}
if(RelaySetPage2 == 1)
{
RelaySetPage2 = 0;
_iTest = 16;
break;
}
if(MENU_REFRESH == 1)
{
MENU_REFRESH = 0;
break;
}
}
}
/*********************************************************************
*
* GUIDEMO_Graph
*
**********************************************************************
*/
void GUIDEMO_Graph(void) {
rt_kprintf("graph\n");
GUI_Clear();
wCreateWindow();
GUI_X_SignalEvent();
while(1)
{
#ifdef GUI_BUFFERS
GUI_MULTIBUF_Begin();
#endif
GUI_Exec();
#ifdef GUI_BUFFERS
GUI_MULTIBUF_End();
#endif
GUI_X_WaitEventTimed(/*10*/3);
if(RelaySet == 1)
{
RelaySet = 0;
_iTest = 1;
break;
}
if(AudioDevice == 1)
{
AudioDevice = 0;
_iTest = 3;
break;
}
if(screen == 1)
{
screen = 0;
_iTest = 4;
break;
}
if(projector == 1)
{
projector = 0;
_iTest = 5;
break;
}
if(ESC_MENU == 1)
{
ESC_MENU = 0;
_iTest = 0;
break;
}
if(MENU_REFRESH == 1)
{
MENU_REFRESH = 0;
break;
}
}
}
问题:发现两个页面切换有大约1S的时延,不知如何解决?
|
|