jojo
New Member
Posts: 1
|
Post by jojo on Feb 8, 2016 22:48:39 GMT -8
I have a Gameduino2 with a Arduino Mega 2560.
I want to use the Display without calibration. I did the calibratrion manually and then read the REG_TOUCH_TRANSFORM_A until REG_TOUCH_TRANSFORM_F. But each time I read the registers they have diffrent value. For a automatically calibration I need the same value.
This is my code:
ft_uint32_t TransMatrix[6];
FT_GPU_CoCmd_Dlstart(phost);
FT_API_Write_CoCmd(CLEAR_COLOR_RGB(64,64,64));
FT_API_Write_CoCmd(CLEAR(1,1,1));
FT_API_Write_CoCmd(COLOR_RGB(0xff,0xff,0xff));
/* Draw number at 0,0 location */
//FT_API_Write_CoCmd(COLOR_A(30));
FT_GPU_CoCmd_Text_P(phost,(FT_DispWidth/2), (FT_DispHeight/2), 27, OPT_CENTER, PSTR("Please Tap on the dot"));
FT_GPU_CoCmd_Calibrate(phost,0);
/* Wait till coprocessor completes the operation */
FT_GPU_HAL_WaitCmdfifo_empty(phost);
. . . . .
/* Print the configured values */
FT_GPU_HAL_RdMem(phost,REG_TOUCH_TRANSFORM_A,(ft_uint8_t *)TransMatrix,4*6);//read all the 6 coefficients
Do you know this behavior and how I can change it?
|
|
|
Post by jamesbowman on Feb 10, 2016 7:57:14 GMT -8
Hi jojo.. you should use the GD2 library instead of the FTDI sample driver! Here is the same code as you posted: GD.ClearColorRGB(64, 64, 64); GD.Clear(); GD.cmd_text(240, 100, 30, OPT_CENTERX, "please tap on the dot"); GD.cmd_calibrate(); GD.finish();
and here is how to display the results of the calibration: GD.cmd_dlstart(); GD.flush();
for (int i = 0; i < 24; i++) Serial.println(GD.rd(REG_TOUCH_TRANSFORM_A + i), HEX); Anyway, regarding touch calibration, the touch calibration values are 6 32-bit numbers (so 24 bytes) and are very sensitive to tiny differences in the touch location. So calibrating twice produces slightly different touch calibration values. The Gameduino2 library does something similar for the Due platform. The calibration values are held in the array "canned_calibration": github.com/jamesbowman/gd2-lib/blob/master/GD2.cpp#L175-L180These values should work on your Gameduino 2, but of course you will need to change the code to use something like Ft_Gpu_Hal_WrMem().
|
|