cancel
Showing results for 
Search instead for 
Did you mean: 

The widgets for STM32L4r9

Jack li1
Associate III

Hi,how can i change color depth for QRCode widgets.My application template is STM32L4r9-Discovery which has a 24-bit screen ,but the QRCode widgets is 12-bit color depth.so i guess could i change QRCode widgets's color depth to 24-bit that i can use this widgets on my application template.

Thanks!

Best wishes

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi,

The QR widget works on a 16-bit framebuffer pointer. You can modify this to work on an 8-bit pointer (Using reinterpret_cast) and write to the framebuffer in increments of three.

uint8_t* buf = reinterpret_cast<uint8_t*>(HAL::getInstance()->lockFrameBuffer());

Best regards,

Martin

Jack li1
Associate III

:D

0690X000006Dgo8QAC.jpgHi ,@Martin KJELDSEN​ 

Thanks !!I have downloaded hex into my application template,but it can't run.The following this picture is screen is not running.The code is as follows.

uint8_t *framebuffer = reinterpret_cast<uint8_t*>(touchgfx::HAL::getInstance()->lockFrameBuffer());
 
    for (int y = invalidatedArea.y; y < invalidatedArea.bottom(); y++)
    {
      for (int x = invalidatedArea.x; x < invalidatedArea.right(); x++)
      {
        for (int i = 0; i < 3; i++)
        {
          framebuffer[x * 3 + i + y * 3 * 390] = code->at(x / scale, y / scale) ? 0x00 : 0xff;
        }
      }
    }
 
    touchgfx::HAL::getInstance()->unlockFrameBuffer();

Could you help me to see what's wrong ,and how can i solve it.(Ps:I add a box widgets which is blue in middle screen )

Thank you very much!!!

Jack li

Martin KJELDSEN
Chief III

Does it work when your framebuffer is 16bpp?

When i use stm32f429-disco which framebuffer is 16 bpp,it works properly .