Goodix GT9271 Touch Screen coordinates inverted...

wwatson

Well-known member
My latest ER-TFTM101-1 touchscreen display uses the Goodix GT9271 CTS controller. I found the "arduino-goodix" library which was designed for the GT911x CTS and modified it to work with the GT9271. After fixing a few bugs it seems to work well except for the x and y coordinates are inverted. X coord starts at 0 on the right side of the screen instead of the left and the Y coord starts at the bottom of the screen instead of the top. Going through the reference manual does not seem to give any real clues as to what register can be used to invert the X/Y origins. Maybe some math trickery using the map function?
Has anybody had any experience with this CTS controller? Any guidance with this is appreciated...
 
For the GT911: register 0x804D bit7 reverses the Y axis, bit6 reverses the X axis. Those bits are marked reserved in the GT9271 manual but might be worth a try...

Otherwise just subtract from the resolution values that you set.
 
For the GT911: register 0x804D bit7 reverses the Y axis, bit6 reverses the X axis. Those bits are marked reserved in the GT9271 manual but might be worth a try...

Otherwise just subtract from the resolution values that you set.
Thank you. Will let you know if it works by setting those bits...
 
Unfortunately setting bits 6 and 7 in 0x804d (0xFD instead of 0x3D) did not change the coordinates. So I did the tricky math and that worked:
Code:
void handleTouch(int8_t contacts, GTPoint *points) {
  Serial.printf("Contacts: %d\n", contacts);
  for (uint8_t i = 0; i < contacts; i++) {
  uint16_t x = (uint16_t)1024-((points[i].x_msb<<8) | points[i].x_lsb);
  uint16_t y = (uint16_t)600-((points[i].y_msb<<8) | points[i].y_lsb);
  uint16_t area = (uint16_t)((points[i].area_msb<<8) | points[i].area_lsb);
    Serial.printf("C%d: #%d %d,%d s:%d\n", i, points[i].trackId,x,y,area);
//                                         (points[i].x_msb<<8) | points[i].x_lsb,
//                                         (points[i].y_msb<<8) | points[i].y_lsb,
//                                         (points[i].area_msb<<8) | points[i].area_lsb);
    yield();
  }
}

So now I can use this GT9271 CTS library with the Ra8876LiteTeensy libraries :)
 
Unfortunately setting bits 6 and 7 in 0x804d (0xFD instead of 0x3D) did not change the coordinates. So I did the tricky math and that worked:
Code:
void handleTouch(int8_t contacts, GTPoint *points) {
  Serial.printf("Contacts: %d\n", contacts);
  for (uint8_t i = 0; i < contacts; i++) {
  uint16_t x = (uint16_t)1024-((points[i].x_msb<<8) | points[i].x_lsb);
  uint16_t y = (uint16_t)600-((points[i].y_msb<<8) | points[i].y_lsb);
  uint16_t area = (uint16_t)((points[i].area_msb<<8) | points[i].area_lsb);
    Serial.printf("C%d: #%d %d,%d s:%d\n", i, points[i].trackId,x,y,area);
//                                         (points[i].x_msb<<8) | points[i].x_lsb,
//                                         (points[i].y_msb<<8) | points[i].y_lsb,
//                                         (points[i].area_msb<<8) | points[i].area_lsb);
    yield();
  }
}

So now I can use this GT9271 CTS library with the Ra8876LiteTeensy libraries :)

Hi, thanks for your work on the ER-TFTM101 8080 library, have just wired it up this evening to a teensy and it works well and is a bit of a game changer for us folks that are using these screens for SDR spectrum displays, the 16 bit interface is going to significantly improve the performance!

Of course the next thing was to scratch around for the capacitive touch screen library and I found this thread , not so surprised to see you have been trail blazing already lol!

Any chance you could upload this touchscreen lib to your git to save me from reinventing the wheel ?

Br Peter EI3JCB
 
Hi, thanks for your work on the ER-TFTM101 8080 library, have just wired it up this evening to a teensy and it works well and is a bit of a game changer for us folks that are using these screens for SDR spectrum displays, the 16 bit interface is going to significantly improve the performance!

Of course the next thing was to scratch around for the capacitive touch screen library and I found this thread , not so surprised to see you have been trail blazing already lol!

Any chance you could upload this touchscreen lib to your git to save me from reinventing the wheel ?

Br Peter EI3JCB

... so a bit more poking around your repo I see you have already uploaded it. Thank you!
 
... so a bit more poking around your repo I see you have already uploaded it. Thank you!
I thought I did :unsure: After a few distractions I am back working on it. I would like it to fall more inline with the way the FT5206 is used in the RA8876LiteTeensy library. I'll start another branch on GitHub for that...
 
I thought I did :unsure: After a few distractions I am back working on it. I would like it to fall more inline with the way the FT5206 is used in the RA8876LiteTeensy library. I'll start another branch on GitHub for that...
Spot on! I have the touch working now as well thanks to your lib, seems to be working exceedingly well to me. I'll keep an eye out for the new branch as well.
 
Back
Top