Page 1 of 1

Arduino Touchscreen Calibration

Posted: Tue May 10, 2022 12:58 pm
by prestonpressure
I am using an EVE4 Capacitive touch, 7" screen. Is there an Arduino example program showing how to do the touchscreen calibration? I cannot get the touch function to work at all, and maybe this is the problem.
I see in the Programming Guide, page 158 that I need to use:

cmd_dlstart();
cmd(CLEAR(1,1,1));
cmd_text(80, 30, 27, OPT_CENTER, "Please tap on the dot");
cmd_calibrate();

But does this go in the Setup? Do the calibration values get stored?

Also, is the calibration procedure necessary if the program only uses Send_CMD(TAG(1)); to tag buttons? (Which are NOT working at all for me!)

Re: Arduino Touchscreen Calibration

Posted: Wed May 11, 2022 10:02 am
by prestonpressure
I was able to resolve this problem. Here is what works with the EVE-Demo-Arduino and the added lines for calibration:

void setup() //run once, setup
{
GlobalInit(); //EVE display interface initialization
FT81x_Init(); //Reset and initialize the EVE
wr8(REG_PWM_DUTY + RAM_REG,128); //Set the backlight to full brightness

wr16(REG_TOUCH_CONFIG + RAM_REG, 0x5d0); //Capacitive touch screen on
Calibrate();
}

void Calibrate(void)
{
Send_CMD(CMD_DLSTART);
Send_CMD(CLEAR(1, 1, 1));
Cmd_Text(DWIDTH / 2, DHEIGHT / 2, 27, OPT_CENTER, "Please tap on the dot");
Send_CMD(CMD_CALIBRATE);
}

Note that this is for a capacitive screen. It may or may not be the same for the resistive screen. It is also for EVE3 and EVE4, not EVE2.