Skip to main content
unsigned_char_array
Lead III
June 25, 2026
Question

feature request get tick rate

  • June 25, 2026
  • 1 reply
  • 28 views

 

You can currently set tick rate using setVsyncInterval().

I want to be able to get the tickrate using getVsyncInterval(). This would make timing things in the gui easier (blinking cursor, animation speed, boot logo, etc.).

 

I made a topic about this earlier, but it got closed.

 

1 reply

Osman SOYKURT
ST Technical Moderator
July 1, 2026

One important nuance first: setVsyncInterval() is a simulator-only API. It controls the simulator's tick pacing, but it is not the source of truth for the tick rate on target. On hardware, the tick cadence is driven by your VSYNC/display-ready signal (via OSWrappers::signalVSync), so a getVsyncInterval() would only reflect the simulator value, not the actual target frame rate.

For the use cases you mention (blinking cursor, animation speed, boot logo), the most portable approach is to define your own timing constant in application code and derive tick counts from it, so the same logic behaves identically in simulator and on target. For example:

// Single source of truth for your project's frame rate
static const float FRAME_RATE_HZ = 40.0f;
static const uint16_t ticksFromMs(uint16_t ms) { return (uint16_t)(ms * FRAME_RATE_HZ / 1000.0f); }


This avoids depending on a simulator-specific value and keeps timing consistent across both environments.

ST Software Developer | TouchGFX
unsigned_char_array
Lead III
July 1, 2026

But resolution is also available: 

 

#include <touchgfx/hal/HAL.hpp>

uint16_t width = touchgfx::HAL::DISPLAY_WIDTH;
uint16_t height = touchgfx::HAL::DISPLAY_HEIGHT;

// or:

touchgfx::HAL& hal = touchgfx::HAL::getInstance();

uint16_t width = hal.getLCD().width();
uint16_t height = hal.getLCD().height();

It would be nice if there was also a frame rate available.

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."