eGUI + TWR-K70F120M + TWR_LCD_RGB touch calibration

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

eGUI + TWR-K70F120M + TWR_LCD_RGB touch calibration

跳至解决方案
1,183 次查看
gaminn
Contributor IV

Hello,

I'm unable to pass calibration procedure (D4D_CalibrateTouchScreen()). My touch screen controller is cr touch (d4dtch_cr_touch.c version 0.0.4.0, date Nov-24-2011). When I touch yellow cross, I get {25, 25} {124, 250} {225, 450} coordinates on the screen (that seems fine), but the code never passes

if ((X[0] > X[1]) && (X[1] > X[2]) && (Y[0] > Y[1]) && (Y[1] > Y[2])) // line 775 in d4d_low.c, version 0.0.43.0, date Feb-23-2011

How should I configure D4D or cr touch to pass the calibration procedure?

Thanks

Martin

标签 (1)
标记 (4)
0 项奖励
1 解答
735 次查看
LuisCasado
NXP Employee
NXP Employee

Hello,

You need to call periodically D4D_CheckTouchScreen();


In the eGUI examples, this is done using PIT timer interrupt. You can mantain some timing flags to be used in your application. This is the typical code:

/**************************************************************//*!

* Periodic IRQ callback or IRQ function

******************************************************************/

void pit_ch0_callback(void)

{

   static Byte actual_time = 0;

  TIME_FLAGS flags;

 

  actual_time++;

  flags.all = (LWord)(actual_time ^ (actual_time - 1));

 

  time.all |= flags.all;

 

  if(flags.bits.b50ms)

  {   

  //  Key_CheckKeys();

    D4D_CheckTouchScreen();

   

  }

   

  D4D_TimeTickPut();

  if(flags.bits.b100ms)

  {

    time100sm_cnt++;   

  }

     

}

The flags definition:

// typedef definitions

typedef union

{

  LWord all;

 

  struct

  {

    unsigned b25ms :1;

    unsigned b50ms : 1;

    unsigned b100ms : 1;

    unsigned b200ms : 1;

    unsigned b400ms : 1;

    unsigned b800ms : 1;

    unsigned b1600ms : 1;   

    unsigned b3200ms : 1;

  }bits;

 

}TIME_FLAGS;

 

// global variables externs

extern TIME_FLAGS time;

extern LWord time100sm_cnt;

Best Regards,

Luis

在原帖中查看解决方案

0 项奖励
5 回复数
735 次查看
gaminn
Contributor IV

OK, now I can pass the calibration procedure.

However, I have another problem - after the calibration is done, my application doesn't receive any touches. The function "D4DTCH_GetPositionRaw_CrTouch() - d4dtch_cr_touch.c" is never called from that moment.

I call D4D_Poll in my main application loop.

0 项奖励
736 次查看
LuisCasado
NXP Employee
NXP Employee

Hello,

You need to call periodically D4D_CheckTouchScreen();


In the eGUI examples, this is done using PIT timer interrupt. You can mantain some timing flags to be used in your application. This is the typical code:

/**************************************************************//*!

* Periodic IRQ callback or IRQ function

******************************************************************/

void pit_ch0_callback(void)

{

   static Byte actual_time = 0;

  TIME_FLAGS flags;

 

  actual_time++;

  flags.all = (LWord)(actual_time ^ (actual_time - 1));

 

  time.all |= flags.all;

 

  if(flags.bits.b50ms)

  {   

  //  Key_CheckKeys();

    D4D_CheckTouchScreen();

   

  }

   

  D4D_TimeTickPut();

  if(flags.bits.b100ms)

  {

    time100sm_cnt++;   

  }

     

}

The flags definition:

// typedef definitions

typedef union

{

  LWord all;

 

  struct

  {

    unsigned b25ms :1;

    unsigned b50ms : 1;

    unsigned b100ms : 1;

    unsigned b200ms : 1;

    unsigned b400ms : 1;

    unsigned b800ms : 1;

    unsigned b1600ms : 1;   

    unsigned b3200ms : 1;

  }bits;

 

}TIME_FLAGS;

 

// global variables externs

extern TIME_FLAGS time;

extern LWord time100sm_cnt;

Best Regards,

Luis

0 项奖励
735 次查看
gaminn
Contributor IV

I modified the example project and deleted the PIT interrupt... Thanks!

0 项奖励
735 次查看
VuPhung
Contributor I

Hi,

I'm using eGUI v2.07; I have same problem with you when I do calibration. I use TSC2046 touch driver, I always get: X1 > X2 > X3 but Y1 < Y2 < Y3.

Then I try to revert Y axis to pass calibration phase (#define D4DTCH_AXIS_ORIENT_Y    D4DTCH_AXIS_ORIENT_INVERTED), when go in the display, I can not touch exactly on the button (play, stop, menu).

Thanks,

Vu Phung

0 项奖励
735 次查看
VuPhung
Contributor I

Hi Martin,

To do calibration ok, I think you just revert X,Y axis as your result You show. Ex:

#if D4DTCH_AXIS_ORIENT_Y == D4DTCH_AXIS_ORIENT_INVERTED

            tmpRes = (unsigned short)(D4DTCH_FULL_SCALE - tmpRes);

#endif

BTW, I have fixed my problem. My problem is that X+/X- & Y+/Y- of touch panel is connected crossly with X+/X- & Y+/Y- of TSC2046. So in the source code, just swap x, y value.

0 项奖励