Skip to main content
WSchr.1
Associate II
September 14, 2020
Question

framebuffer size +3 ???

  • September 14, 2020
  • 1 reply
  • 633 views

I am working on a project with TouchGFX on STM32H7 with 240x320 RGB Display. Framebuffer is in internal RAM.

I calculated the RGB565 framebuffer size to 240x320x2 bytes and allocated this amount in the linker file with "TouchGFX_Framebuffer" atttribute.

So far everything works fine, but I found a source line in TouchGFXGeneratedHAL.cpp, that makes me wonder:

  uint32_t frameBuf[(240 * 320 * 2 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");

What ist +3 used for?

Do I have to allocate 3 more bytes?

This topic has been closed for replies.

1 reply

WSchr.1
WSchr.1Author
Associate II
September 14, 2020

ok, got it.

I think it is to prevent rounding errors (with integers ?!?)

The /4 will leave it with no effect.