Hi David,
Sorry for the delay in replying,
We did a further test with a code snippet based on your earlier test and we could see the correct coordinates.
This was with BT817, we will check with BT815 too.
The code used was:
int i2c_addr()
{
return 0x38; // does not matter for my test
}
int setup()
{
setWAKE(0);
delay_ms(5);
setWAKE(1);
delay_ms(300);
}
void loop()
{
report_touch(0, 400, 300);
delay_ms(5); // also tried without those delays and with id 1 as well
//report_touch(0, 200, 100);
//delay_ms(5);
}
The application code used was:
uint32_t CoordX = 0;
uint32_t CoordY = 0;
uint32_t Coord = 0;
while(1)
{
EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
EVE_CMD_TEXT(10, 320, 28, EVE_OPT_FORMAT, "X is %d", CoordX);
EVE_CMD_TEXT(10, 340, 28, EVE_OPT_FORMAT, "Y is %d", CoordY);
EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();
Coord = HAL_MemRead32(EVE_REG_CTOUCH_TOUCH0_XY);
CoordY = (Coord & 0xFFFF);
CoordX = ((Coord >>16) & 0xFFFF);
}
Loading the custom code was similar to your description. We loaded it to the co-processor buffer after we had set up the display registers and displayed the first blank screen.
Could you advise if you see the same result if using the touch code and the application code above?
Here is the output:
X is 400
Y is 300
I'm afraid we don't have an ILI2511 available to do detailed debugging. However, as a first pass we think a custom touch code listing similar to this may work based on the datasheet:
If you are able to try it could you let us know how it reacts (and if possible to capture a logic analyser waveform of the I2C when pen-down and pen-up occur) and we can try to work towards getting it running on ILI2511.
void i2c_addr()
{
return 0x41;
}
int setup()
{
setWAKE(0);
delay_ms(150);
setWAKE(1);
delay_ms(500);
}
void loop()
{
while (getINT() == 1) // wait for INT to go low
;
i2c_startread(0x10);
int statusbyte = i2c_read8();
if (statusbyte != 0)
{
int x0 = i2c_read16be();
int y0 = i2c_read16be();
int Pressure0 = i2c_read8();
if ((x0 & 0x8000) == 0x8000)
report_touch(0, (x0 & 0xfff), (y0 & 0xfff));
int x1 = i2c_read16be();
int y1 = i2c_read16be();
int Pressure1 = i2c_read8();
if ((x1 & 0x8000) == 0x8000)
report_touch(1, (x1 & 0xfff), (y1 & 0xfff));
int x2 = i2c_read16be();
int y2 = i2c_read16be();
int Pressure2 = i2c_read8();
if ((x2 & 0x8000) == 0x8000)
report_touch(2, (x2 & 0xfff), (y2 & 0xfff));
int x3 = i2c_read16be();
int y3 = i2c_read16be();
int Pressure3 = i2c_read8();
if ((x3 & 0x8000) == 0x8000)
report_touch(3, (x3 & 0xfff), (y3 & 0xfff));
int x4 = i2c_read16be();
int y4 = i2c_read16be();
int Pressure4 = i2c_read8();
if ((x4 & 0x8000) == 0x8000)
report_touch(4, (x4 & 0xfff), (y4 & 0xfff));
}
i2c_stop();
while (getINT() == 0); // wait for INT to go high
}
Best Regards, BRT Community