TouchGFX custom widget with partial framebuffer - how to?
I am developing a TouchGFX-based firmware and have a trouble with my custom widget when I try to use partial framebuffer strategy.
Currently I am using TouchGFX 4.13 on STM32H743 MCU with LTDC.
The code of my custom widget class is based on this "QRCode widget" example from TouchGFX documentation:
touchgfx::Rect absolute = getAbsoluteRect();
uint16_t* framebuffer = touchgfx::HAL::getInstance()->lockFrameBuffer();
for (int y = invalidatedArea.y; y < invalidatedArea.bottom(); y++)
{
for (int x = invalidatedArea.x; x < invalidatedArea.right(); x++)
{
framebuffer[absolute.x + x + (absolute.y + y) * touchgfx::HAL::DISPLAY_WIDTH]
data->at(x / scale, y / scale) ? 0x0000 : 0xffff;
}
}When I use single or double framebuffer everything works fine.
When I use partial framebuffer without custom widgets everything works fine.
But where I use partial framebuffer with custom widget it is unclear how to determine in draw() method
a) where is current partial framebuffer located in RAM, and
b) which region of screen does it contain.
The lockFrameBuffer() method returns seeming random addressess, sometimes not in RAM section (0x1fff....).
And I did not found in documentation, how to determine the coordinates of the rectangle that is mapped to partial framebuffer.
Is there any working example of using TouchGFX with partial framebuffer and custom widgets?