2023-01-31 10:50 AM
I have a touch screen application that I am having issues with. The touch screen works. The issue is that if I press and hold the buttons on my screen the image will toggle between touched/not touched. I am sure I must have something configured incorrectly, but I am not sure where to look.
If I slide my finger from one button to another button the screen registers that as a touch as well. When I test using my development board if I slide my finger off of the button and back on no additional touch evens are registered.
Why would my screen lose track of the touched/pressed status?
My touch controller is a ST1633 and I currently have the touch screen to respond via interrupt not polling.
2023-01-31 11:10 AM
show your code
2023-01-31 11:34 AM
I have adjusted my code to see if reading the interrupt pin directly would make a difference. What I found is that the interrupt input itself is pulsing on/off while the screen is touched. I am guessing this is what is causing my issues.
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
/* USER CODE BEGIN F4TouchController_sampleTouch */
uint8_t xCoordLowByte = 0;
uint8_t yCoordLowByte = 0;
uint8_t xyCoordHighByte = 0;
uint8_t input_state = HAL_GPIO_ReadPin(GPIOG, GPIO_PIN_6);
if(1 == input_state)
{
xyCoordHighByte = TS_IO_Read(I2C_ADDR, 0x12);
xCoordLowByte = TS_IO_Read(I2C_ADDR, 0x13);
yCoordLowByte = TS_IO_Read(I2C_ADDR, 0x14);
x = (xyCoordHighByte << 1) & 0xE0;
x <<= 3;
x += xCoordLowByte;
y = (xyCoordHighByte << 5) & 0xE0;
y <<= 3;
y += yCoordLowByte;
return true;
}
return false;
}
2023-02-03 04:46 AM
Hello PBaie.1,
How it's behaving if you run on simulator ? does it still switch between touched/not touched when you hold your press on a button ?
/Osman
2023-02-03 07:21 AM
I did additional testing, and it appears that the output from the touch driver chip is always pulsing when pressed. I was able to make it work by debouncing the off time. I have to wait X time without seeing a pulse in order to determine that the screen was released.