cancel
Showing results for 
Search instead for 
Did you mean: 

Using Custom widget with partial framebuffer to draw QR code

Rfrik.1
Associate

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?

1 REPLY 1
MM..1
Chief II