cancel
Showing results for 
Search instead for 
Did you mean: 

framebuffer size +3 ???

WSchr.1
Associate II

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?

1 REPLY 1
WSchr.1
Associate II

ok, got it.

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

The /4 will leave it with no effect.