cancel
Showing results for 
Search instead for 
Did you mean: 

Touch GFX and touch api issue

TomJJJ
Associate II

Hi,

i'm trying to use a touchgfx with a capacitive touch. I have wrote a simple demo example. During the simulation i can switch an on / off a switch button just clicking with the mouse on it.

In my hw integration i'm using the sampleTouch to give the coords to the library. I have checked the coords and they are right but i didn't see any effect on the screen element. it seems that the touch event is not properly caught by the library.

Thank you

BR

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
    /**
     * By default sampleTouch returns false,
     * return true if a touch has been detected, otherwise false.
     *
     * Coordinates are passed to the caller by reference by x and y.
     *
     * This function is called by the TouchGFX framework.
     * By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
     *
     */
		 
	 key_Data_t key_Data;
	 
	 if (cb_pop(&key_Data_CircBuff,(void*)  &key_Data))
	 {
		 x = (int32_t) key_Data.x;
		 y = (int32_t) key_Data.y;
		 return true;
	 }
	
	 return false;
}

4 REPLIES 4
Alexandre RENOUX
Principal

Hello,

So you confirm that when debugging, every time you touch your screen, your if statement is true and the program executes what's inside the if, meaning the retrieval of the coordinates and these coordinates are correct, right ?

Because in this case, the touch should be caught by TouchGFX for sure.

What board are you using ? I guess that you are using a custom display.

/Alexandre

TomJJJ
Associate II

Hi,

Yes. every time i pass the right coordinates to the library and they are the button area.

I'm using a custom board with a custom TFT.

I don't know if the reason is the implementation in touchgfx designer. But with the simulator that button works fine.

Thank you.

Hi,

Yes. every time i pass the right coordinates to the library and they are the button area.

I'm using a custom board with a custom TFT.

I don't know if the reason is the implementation in touchgfx designer. But with the simulator that button works fine.

Thank you.

Ok,

i have just found the issue. Anyway, It is a strange behavior. I have rotated the image from touchgfx because i'm using a portrait tft in landscape mode. I notice that i have to pass the coord x to y and y to x to get the library working. So the library rotates the image but doesn't invert the coordinates.