Problem With FT5406_GetMultiTouch

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problem With FT5406_GetMultiTouch

496 次查看
tomspiegel
Contributor II

Starting with a virgin demo_apps/touch_cursor project from a SDK_2.0_LPCXpresso54608 generated for Keil... I get the expected results running under debug. If I remove the USB and plug it in again, the program runs as it did under the debugger. Now if I replace the for(;;) in main() with the following code to use GetMultiTouch function, it runs great under the debugger. The cursor will jump to the last contact point as I apply 1, 2, 3, 4 fingers. But If I remove USB and plug it in again, then the cursor never moves as I touch the panel. If I press target reset on the back of the board, then it works ok.

    for (;;)
    {
        touch_point_t points[FT5406_MAX_TOUCHES];
        if (kStatus_Success == FT5406_GetMultiTouch(&touch_handle, NULL, points))
        {
            for (int i = 0; i != FT5406_MAX_TOUCHES; ++i)
            {
                touch_point_t *p = points + i;
                if (p->TOUCH_EVENT == kTouch_Down)
                    APP_SetCursorPosition(p->TOUCH_Y, p->TOUCH_X);
            }
        }

    }

2 回复数

378 次查看
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Tom,

The LCD display does not detect any touch the first time the program runs so it will read back all 0xFF and this will cause the application to decode 0xFF number of touches causing a hardfault, please add the following code to the FT5406_GetMultiTouch function just before  the line that says /* Decode valid touch points */  :

       /* No touch, first time program runs */
        if (touch_data->TD_STATUS == 0xFF)
        {
            touch_data->TD_STATUS=0x0;
        }


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励

378 次查看
tomspiegel
Contributor II

That solved the problem for me. Thanks