Skip to main content
Jack li1
Associate III
February 19, 2019
Question

The widgets for STM32L4r9

  • February 19, 2019
  • 5 replies
  • 911 views

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

This topic has been closed for replies.

5 replies

Martin KJELDSEN
Principal III
February 19, 2019

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
Jack li1Author
Associate III
February 22, 2019

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

Jack li1
Jack li1Author
Associate III
February 19, 2019

:D

Martin KJELDSEN
Principal III
February 22, 2019

Does it work when your framebuffer is 16bpp?

Jack li1
Jack li1Author
Associate III
February 23, 2019

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