Hi,
I have a dedicated question to the TI software developers who have developed the example software for GRLIB demo with Kentec320*240 display.
On the source code of the driver "touch.c", there are arrays of parameter to convert the ADC-value to LCD-X/Y-coordinates
//*****************************************************************************
//
// Touchscreen calibration parameters. Screen orientation is a build time
// selection.
//
//*****************************************************************************
const int32_t g_pi32TouchParameters[7] =
{
#ifdef PORTRAIT
3840, // M0
318720, // M1
-297763200, // M2
328576, // M3
-8896, // M4
-164591232, // M5
3100080, // M6
#endif
#ifdef LANDSCAPE
328192, // M0
-4352, // M1
-178717056, // M2
1488, // M3
-314592, // M4
1012670064, // M5
3055164, // M6
#endif
#ifdef PORTRAIT_FLIP
1728, // M0
-321696, // M1
1034304336, // M2
-325440, // M3
1600, // M4
1161009600, // M5
3098070, // M6
#endif
#ifdef LANDSCAPE_FLIP
-326400, // M0
-1024, // M1
1155718720, // M2
3768, // M3
312024, // M4
-299081088, // M5
3013754, // M6
#endif
};
But I want to connect a LCD with 480*320 pixel resolution and 4-wire touch to the microcontroller.
So I have the question, how are the parameters calculated to get the coordiantes of the touched position on the LCD.
The conversion is done be following code:
i32X = g_i16TouchX;
i32Y = g_i16TouchY;
i32Temp = (((i32X * g_pi32TouchParameters[0]) +
(i32Y * g_pi32TouchParameters[1]) + g_pi32TouchParameters[2]) /
g_pi32TouchParameters[6]);
i32Y = (((i32X * g_pi32TouchParameters[3]) +
(i32Y * g_pi32TouchParameters[4]) + g_pi32TouchParameters[5]) /
g_pi32TouchParameters[6]);
i32X = i32Temp;
where g_i16TouchX and g_i16TouchY are the ADC values.
It's very cryptic how it is programmed. Maybe a developer or a user can get an answer to this important question.
with regards...