新手上路
积分 33
金钱 33
注册时间 2020-2-19
在线时间 10 小时
1 金钱
我最近移植的触摸驱动,坐标已经到ENWIN了,但是就是不触发回调函数,找了很多资料都没办法.哪位可否帮下忙?
下面是部分代码:
#define GUI_NUM_LAYERS 1 // Maximum number of available layers
#define GUI_OS (1)
#define GUI_MAXTASK (2) // ×î′ó¿éμ÷óÃEMWINμÄèÎÎñêy
#ifndef GUI_SUPPORT_TOUCH
#define GUI_SUPPORT_TOUCH (1) // Support touchscreen
#endif
#define GUI_DEFAULT_FONT &GUI_Font6x8
#define GUI_SUPPORT_MOUSE (1) /* Support a mouse */
#define GUI_WINSUPPORT (1) /* Use window manager */
#define GUI_SUPPORT_MEMDEV (1) /* Memory device package available */
#define GUI_SUPPORT_DEVICES (1) /* Enable use of device pointers */
int GUI_TOUCH_X_MeasureX(void)
{
int32_t xvalue;
rt_device_read(touch0,0,&postion,4);
xvalue=postion.x;
// if(xvalue!=0xffff) rt_kprintf("x=%d\n",postion.x);
return xvalue;
}
int GUI_TOUCH_X_MeasureY(void)
{
int32_t yvalue;
rt_device_read(touch0,0,&postion,4);
yvalue = postion.y;
// if(yvalue!=0xffff)rt_kprintf("y=%d",postion.y);
mGPIDState.x=postion.x;
mGPIDState.y=postion.y;
if(postion.y!=0xffff) mGPIDState.Pressed=0x01;
else mGPIDState.Pressed=0x00;
mGPIDState.Layer=0;
GUI_PID_StoreState(&mGPIDState);
return yvalue;
}
void task(){
while (1)
{
GUI_TOUCH_Exec();
GUI_PID_GetState(&mGPIDState);
// WM_SetpfPollPID(&mGPIDState);
if((mGPIDState.x!=0xffff)&&(mGPIDState.Pressed))
printf("px=%x py=%x pp=%d\n",mGPIDState.x,mGPIDState.y,mGPIDState.Pressed);
rt_thread_mdelay(5);
}
}
case WM_INIT_DIALOG:
//FRAMWIN¿Ø¼t3õê¼»ˉ
WM_SetFocus(hItem);
WM_SetCapture(hItem,1);
WM_EnableWindow(hItem);
hItem = pMsg->hWin;
FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII);
FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
FRAMEWIN_SetText(hItem, "ALIENTEK LISTBOX");
FRAMEWIN_SetTextColor(hItem,GUI_YELLOW);
//LISTBOX¿Ø¼t3õê¼»ˉ
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
LISTBOX_SetFont(hItem, GUI_FONT_20_ASCII);
LISTBOX_SetAutoScrollH(hItem,1); //¼¤»î×Ô¶ˉê1óÃˮƽ1ö¶ˉìõ
LISTBOX_SetAutoScrollV(hItem,1); //¼¤»î×Ô¶ˉê1óÃ′1Ö±1ö¶ˉìõ
LISTBOX_AddString(hItem, "LED1 ON");
LISTBOX_AddString(hItem, "LED1 OFF");
LISTBOX_AddString(hItem, "BEEP ON");
LISTBOX_AddString(hItem, "BEEP OFF");
LISTBOX_AddString(hItem, "ALL ON");
LISTBOX_AddString(hItem, "ALL OFF");
我来回答