Tool/software:
STM32F746 using TSC2046 touch
I am getting repeatable, but skewed data across 5" resistive screen. tsc2046 is setup as 12 bit Differential PD1 =0 PD0 =0
Raw data without touch is 2047, 2047
Average readings from corners
TL = 1175,1950
TR = 1640, 1806
BL = 1180,1606
BR = 1959, 1175
Center 1600,1620
These numbers are repeatable, but why are they skewed? Is this normal? How can I calibrate screen?
From code below I wait for PENIRQ line to go low before reading. Z, X, Y
I tried several screens, same results.
//8. Get touch screen data TS_TOUCH_DATA_Def TSC2046_GetTouchData(void) { TS_TOUCH_DATA_Def myTsData; uint16_t temp16x=0, temp16y=0; //Is screen pressed if(HAL_GPIO_ReadPin(PEN_INT_GPIO_Port, PEN_INT_Pin) == GPIO_PIN_RESET) { if(TSC2046_getRaw_Z()<2000) { myTsData.isPressed = true; //Read touch data for(uint8_t i=0; i<10; i++) { localRawTouch = TSC2046_GetRawTouch(); temp16x += localRawTouch.x_touch; temp16y += localRawTouch.y_touch; } localRawTouch.x_touch = temp16x*0.1; localRawTouch.y_touch = temp16y*0.1; } } else myTsData.isPressed = false; //X_Touch value myTsData.X = myTS_Calibrate.Scale_X*localRawTouch.x_touch + myTS_Calibrate.Bias_X; //Y_Touch value myTsData.Y = myTS_Calibrate.Scale_Y*localRawTouch.y_touch + myTS_Calibrate.Bias_Y; if (myTsData.isPressed == true) { printf("cal_x %u \n", myTsData.X); printf("cal_y %u \n", myTsData.Y); } return myTsData; }
