#define GT911_ADDR 0x5D #define GT911_STATUS 0x8009 #define GT911_TOUCH1 0x8010 typedef struct uint8_t track_id; uint16_t x; uint16_t y; uint16_t size; gt911_touch_t;
The GT911 is one of the most popular capacitive touch panel controllers in the embedded world. Found in everything from Raspberry Pi touchscreens and DIY handheld gaming consoles to industrial HMIs and automotive displays, its popularity stems from its robust noise immunity, support for up to 5 simultaneous touches, and low cost. However, for engineers and hobbyists alike, the true power of the GT911 lies hidden within its register map .
int X = ( (regs[0x8012] & 0x0F) << 8 ) | regs[0x8011]; int Y = ( (regs[0x8014] & 0x0F) << 8 ) | regs[0x8013]; Only the lower 12 bits are valid. The upper 4 bits of the high byte are reserved or used for flags. For low-power or simple UI applications, you can poll this register to detect gestures without parsing coordinates.