drivers: kscan: gt911: ignore touch events if TOUCH_STATUS mask is clear

Ignore touch events from GT911 IC when TOUCH_STATUS_MSK bit is not set
in status register. This resolves an error where the GT911 driver would
report a touch event end directly after a touch occured, as the touch
status register would be 0x0, which the driver incorrectly interpreted
as a touch release.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2023-03-13 17:07:55 -05:00 committed by Carles Cufí
commit f9fbd8a287

View file

@ -96,6 +96,10 @@ static int gt911_process(const struct device *dev)
return 0; return 0;
} }
if (!(status & TOUCH_STATUS_MSK)) {
/* Status bit not set, ignore this event */
return 0;
}
/* need to clear the status */ /* need to clear the status */
uint8_t clear_buffer[3] = {(uint8_t)REG_STATUS, (uint8_t)(REG_STATUS >> 8), 0}; uint8_t clear_buffer[3] = {(uint8_t)REG_STATUS, (uint8_t)(REG_STATUS >> 8), 0};