2022-10-04 08:56 AM
I am developing a TouchGFX-based firmware. The partial framebuffer is used since we have limited memory (stm32wb). I have an issue with my custom widget that it is used to draw QR code.
Currently I am using TouchGFX 4.18 on STM32WB55 MCU.
I used this code
void QRCodeWidget::draw(const touchgfx::Rect& invalidatedArea) const
{
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::FRAME_BUFFER_WIDTH] = 0xFFFF;
}
}
HAL::getInstance()->unlockFrameBuffer();
I had no display; the screen did not change and I had a hard fault.
Any suggestions?
2022-10-04 11:55 AM
Try read and use PixelDataWidget | TouchGFX Documentation