cancel
Showing results for 
Search instead for 
Did you mean: 

Single framebuffer

prathima
Associate II

Hello..

How to use single frame buffer in STM32L4R9AI-EVAL board

12 REPLIES 12
Martin KJELDSEN
Chief III

Have you checked the Application template from the TouchGFX designer? It should be single framebuffer. Usually, all DSI ATs we have are single framebuffer because of the GRAM on the display.

prathima
Associate II

HELLO...

Bydefault the designer using singel frame buffer?

I want to access that frame buffer means i want to write some data into that frame buffer...How can i do that?

and Can i make the whole frame buffer empty means i want to write all pixel values are zeros...can i do that?how can i?

Thank you...

prathima
Associate II

HELLO...

Bydefault the designer using singel frame buffer?

I want to access that frame buffer means i want to write some data into that frame buffer...How can i do that?

and Can i make the whole frame buffer empty means i want to write all pixel values are zeros...can i do that?how can i?

Thank you...

gfxfloro
Senior

You can access the framebuffer like this:

uint16_t* fb;
fb = (uint16_t*) touchgfx::HAL::getInstance()->lockFrameBuffer();

lockFrameBuffer() returns a 16-bit pointer to the used framebuffer.

That way you can also set all pixels to zero.

Don't forget to call:

touchgfx::HAL::getInstance()->unlockFrameBuffer();

after finishing your write operation otherwise the display freezes

prathima
Associate II

how can set all pixels to zero.......in this case

thank you

prathima
Associate II

and where i have to write this process in screenview.cpp or else some where

gfxfloro
Senior

You put it whereever it makes sense for your application, if you want to set black pixels e.g. on entering the screen, you put it there. Setting the pixels black is just writing the values.

You treat your framebuffer as an array, so

fb[0] = 0x0000U

sets the first pixel to black. Repeat for your screen width and height.

 Edit: of course by doing this you let the MCU do all the work. Setting whole areas to one color is a good job for DMA2D.

Look up the blitOp functions for this

prathima
Associate II

my display is of 390x390x3=framebuffer size

if am writing like this:

1. uint16_t* fb;

2.  fb = (uint16_t*)touchgfx::HAL::getInstance()->lockFrameBuffer();

3.  fb[456300] = { 0X000 };  

4.  touchgfx::HAL::getInstance()->unlockFrameBuffer();

Am not getting it...

actually i have a widget called box in my screen...

i want to make it black(all pixels zero)...by writing zeros into frame buffer...but am not getting it and also at line 4 am getting error that exception thrown what it means?why am getting it?

If you want a framebuffer with only 0x00s, you can also use TouchGFX Designer, add a black box widget, and change the color according to you needs

box1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255)); white
box1.invalidate();
box1.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0)); black
box1.invalidate();

This way you use TouchGFX to fill the framebuffer. If the box covering the whole screen is black, then TouchGFX will fill the framebuffer with zeros. On the other hand if the box is white, then TouchGFX will fill the framebuffer with 0xff.

/Alexandre