cancel
Showing results for 
Search instead for 
Did you mean: 

buttons continuously registering touch events.

PBaie.1
Associate II

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.

4 REPLIES 4
MM..1
Chief II

show your code

PBaie.1
Associate II

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;

}

Osman SOYKURT
ST Employee

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

Osman SOYKURT
ST Software Developer | TouchGFX
PBaie.1
Associate II

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.