cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set the Model::Tick() cycle in TouchGFX?

PKunK.1
Associate III

There is a Model::tick() timer function in TouchGFX.

I wonder if it is possible to set the calling period of this function.

In my program now it is repeated every 0.285msec.

I want to change this to be called every 15msec, so please give me advice on where to look.

3 REPLIES 3
HP
Senior III

this question is somewhat similar to this: https://community.st.com/s/question/0D53W00000evnIvSAI/what-is-my-refresh-rate-frame-per-seconds-and-can-i-modify-it

You could just encapsulate the part of the code you want to 'limit' with the same approach I outline in the other thread.

basically

  1. check if enough time has passed since last time
  2. if enough time has passed, do something and update the time you last did something
Romain DIELEMAN
ST Employee

Hi,

This is something to set outside in CubeMX or in code. Are you using an OS or running on bare metal ? The tick source of the TouchGFX application is set in the "Driver" section in the TouchGFX additionnal software settings in CubeMX. The next steps I am not sure but you can have a look at that for now :grinning_face_with_sweat:. Are you using a custom board or one of the ST development kits. Did you start your project with one of the application template available in TouchGFX Designer

/Romain

I am developing at stm32f469i_Discovery.

It changed from a 4-inch LCD to a 5-inch ILI9806E LCD, and raised the driver to Video mode, with the Model::tick() cycle being changed.

 

And Touch IC changed to GT911.

 

The Model::tick() function still has no change in the period.

In the STM32TouchController.cpp function,

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
  if (bsp_ts_initialized)
  {
    TS_StateTypeDef state;
    mCount++;
    if(mCount >4000)
    {
      mCount =0;
      BSP_TS_GetState(&state);
      if (state.touchDetected)
      {
        x = state.touchX;
        y = state.touchY;
        return true;
      }
    }
  }
  return false;
}

 

This change made the cycle faster.

 

I don't know why the cycle changes.