2025-08-21 10:30 PM
hi ,
currently working on touchGFX(without RTOS)+stm32h723zgt6+ltdc display .
First Screen1 is coming with touchGFX but touch x,y coordinates not changing the screen2.
touchGFX screen1 interaction made as follows .
i do not attached any touch sensor ! instead of touch sensor i made manual touch x ,y coordinates input by following code . due to manual matrix key button for future use .
touch.c as follows
#include "Touch_Sensor.h"
bool touch_values(uint32_t *touch_x, uint32_t *touch_y)
{
if(gate)
{
*touch_x=tempx;
*touch_y=tempy;
return true;
}
return false;
}
touch.h as follows
#ifndef TOUCH_SENSOR_H_
#define TOUCH_SENSOR_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "stdint.h"
#include "stdbool.h"
extern volatile uint32_t tempx;
extern volatile uint32_t tempy;
extern volatile uint32_t gate;
extern bool touch_values(uint32_t *touch_x, uint32_t *touch_y);
#ifdef __cplusplus
}
#endif
#endif /* TOUCH_SENSOR_H_ */
STM32touchController.CPP as follows
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);
*
*/
uint32_t m; uint32_t n;
if(touch_values(&m, &n))
{
x=m;
y=n;
return true;
}
return false;
}
main.c
volatile uint32_t tempx=0; //// declared in glopal
volatile uint32_t tempy=0; //// declared in glopal
volatile uint32_t gate=0; //// declared in glopal
MX_TouchGFX_Process();
/* USER CODE BEGIN 3 */
if(gate==1){tempx=234; tempy=136; gate=0; }
if(gate==2){tempx=0; tempy=0; gate=0;}
i am trying to give x, y coordinates manually but no screen change .