EVE2-70A-TPR resistive touch setting

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
madhusudan.jadhav
LCD Geek
Posts: 25
Joined: Wed Apr 03, 2019 11:24 am

EVE2-70A-TPR resistive touch setting

Post by madhusudan.jadhav »

Hi there,
i am using matrix orbital EVE2-70A TPR. THE RESISTIVE TOUCH DOESNOT WORK IF I assign touch tag to button after tag_mask =1. it works if i excute reg_calibrate app. but every time we cannot run calibration. whjat is the setting of 70A resistive touch which registers to be set. Please help.

madhusudan.jadhav
LCD Geek
Posts: 25
Joined: Wed Apr 03, 2019 11:24 am

Re: EVE2-70A-TPR resistive touch setting

Post by madhusudan.jadhav »

Hi there,
I am using Matrix orbital EVE2-70A-TPR with infineon xmc4500 using SPI. I tried following code to store the value but the nalso touch is not worknig.
void Calibrate_Manual(uint16_t Width, uint16_t Height, uint16_t V_Offset, uint16_t H_Offset)
{
uint32_t displayX[3], displayY[3];
uint32_t touchX[3], touchY[3];
uint32_t touchValue = 0, storedValue = 0;
int32_t tmp, k;
int32_t TransMatrix[6];
uint8_t count = 0;
uint32_t count1=0;
uint8_t pressed = 0;
char num[2];

// These values determine where your calibration points will be drawn on your display
displayX[0] = (uint32_t) (Width * 0.15) + H_Offset;
displayY[0] = (uint32_t) (Height * 0.15) + V_Offset;

displayX[1] = (uint32_t) (Width * 0.85) + H_Offset;
displayY[1] = (uint32_t) (Height / 2) + V_Offset;

displayX[2] = (uint32_t) (Width / 2) + H_Offset;
displayY[2] = (uint32_t) (Height * 0.85) + V_Offset;

while (count < 3)
{ // count =1;
API_LIB_BeginCoProList();
API_CMD_DLSTART();
API_CLEAR_COLOR_RGB(0, 0, 0);
API_CLEAR(1,1,1);

// Draw Calibration Point on screen
API_COLOR_RGB(255, 0, 0);
API_POINT_SIZE(20 * 16);
API_BEGIN(FTPOINTS);
API_VERTEX2F((uint32_t)(displayX[count]) * 16, (uint32_t)((displayY[count])) * 16);
//API_END();
API_COLOR_RGB(255, 255, 255);
API_CMD_TEXT((Width / 2) + H_Offset, (Height / 3) + V_Offset, 27, OPT_CENTER, "Calibrating");
API_CMD_TEXT((Width / 2) + H_Offset, (Height / 2) + V_Offset, 27, OPT_CENTER, "Please tap the dots");
num[0] = count + 0x31; num[1] = 0; // null terminated string of one character
API_CMD_TEXT(displayX[count], displayY[count], 27, OPT_CENTER, num);
API_END();
API_DISPLAY(); // Tell EVE that this is end of list
API_CMD_SWAP();
API_LIB_EndCoProList(); // Trigger the CoProcessor to start processing commands out of the FIFO
API_LIB_AwaitCoProEmpty(); // wait here until the coprocessor has read and executed every pending command.
// APP_Calibrate();
//count++;
MCU_Delay_500ms();

while (pressed == count )
{
touchValue =EVE_MemRead32(REG_TOUCH_TAG_XY ); // Read for any new touch tag inputs
// SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,touchValue);
if ((touchValue & 0x8000000)==0)
{
touchX[count] = (touchValue >> 16) & 0x03FF; // Raw Touchscreen Y coordinate
touchY[count] = touchValue & 0x03FF; // Raw Touchscreen Y coordinate

//Log("\ndisplay x[%d]: %ld display y[%d]: %ld\n", count, displayX[count], count, displayY[count]);
//Log("touch x[%d]: %ld touch y[%d]: %ld\n", count, touchX[count], count, touchY[count]);

count++;
}
}
pressed = count;

}

k = ((touchX[0] - touchX[2])*(touchY[1] - touchY[2])) - ((touchX[1] - touchX[2])*(touchY[0] - touchY[2]));

tmp = (((displayX[0] - displayX[2]) * (touchY[1] - touchY[2])) - ((displayX[1] - displayX[2])*(touchY[0] - touchY[2])));
TransMatrix[0] = ((int64_t)tmp << 16) / k;

tmp = (((touchX[0] - touchX[2]) * (displayX[1] - displayX[2])) - ((displayX[0] - displayX[2])*(touchX[1] - touchX[2])));
TransMatrix[1] = ((int64_t)tmp << 16) / k;

tmp = ((touchY[0] * (((touchX[2] * displayX[1]) - (touchX[1] * displayX[2])))) + (touchY[1] * (((touchX[0] * displayX[2]) - (touchX[2] * displayX[0])))) + (touchY[2] * (((touchX[1] * displayX[0]) - (touchX[0] * displayX[1])))));
TransMatrix[2] = ((int64_t)tmp << 16) / k;

tmp = (((displayY[0] - displayY[2]) * (touchY[1] - touchY[2])) - ((displayY[1] - displayY[2])*(touchY[0] - touchY[2])));
TransMatrix[3] = ((int64_t)tmp << 16) / k;

tmp = (((touchX[0] - touchX[2]) * (displayY[1] - displayY[2])) - ((displayY[0] - displayY[2])*(touchX[1] - touchX[2])));
TransMatrix[4] = ((int64_t)tmp << 16) / k;

tmp = ((touchY[0] * (((touchX[2] * displayY[1]) - (touchX[1] * displayY[2])))) + (touchY[1] * (((touchX[0] * displayY[2]) - (touchX[2] * displayY[0])))) + (touchY[2] * (((touchX[1] * displayY[0]) - (touchX[0] * displayY[1])))));
TransMatrix[5] = ((int64_t)tmp << 16) / k;

count = 0;
do
{
EVE_MemWrite32(REG_TOUCH_TRANSFORM_A + RAM_REG + (count * 4), TransMatrix[count]); // Write to Eve config registers

uint16_t ValH = TransMatrix[count] >> 16;
uint16_t ValL = TransMatrix[count] & 0xFFFF;
//("TM%d: 0x%04x %04x\n", count, ValH, ValL);
SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,ValL);
SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_BLUE,ValH);
count++;
}while(count < 6);
//count1= EVE_MemRead32(REG_TOUCH_TRANSFORM_A);
//SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,ValL);
}

Post Reply