Skip to main content
prathima
Associate III
February 20, 2020
Question

Frame buffers

  • February 20, 2020
  • 13 replies
  • 3845 views

Hello....

Am currently working on STM32L4R9AI-EVAL board and i have so many doubts about frame buffering....

1.when we have to use single frame buffer,when we use double frame buffer,and partial frame buffers and rendering time is less for single buffer or double.....

2.Can we access the frame buffer,if it is yes and how to do that i need a procedure to do that because i don't know anything about it....

3.Do the touchgfx supports vertical swipe and how to enable it...

Thank you in advance

This topic has been closed for replies.

13 replies

Martin KJELDSEN
Principal III
February 20, 2020

Hi,

The L4R9AI-EVAL has a display with GRAM, so only one TouchGFX framebuffer is necessary. Partial framebuffers is for low cost solution MCUs like G0 that have little internal memory and when the project does not wish to rely on external SDRAM to fit a full framebuffer.

Yes, you can access the framebuffer and do anything you want to the content there. Use

HAL::getInstance()->lockFrameBuffer();

Signature:

/**
 * @fn virtual uint16_t* HAL::lockFrameBuffer();
 *
 * @brief Waits for the frame buffer to become available for use.
 *
 * Waits for the frame buffer to become available for use (i.e. not used by DMA
 * transfers).
 *
 * @note Function blocks until frame buffer is available. Client code MUST call
 * unlockFrameBuffer() when frame buffer operation has completed.
 *
 * @return A pointer to the beginning of the currently used frame buffer.
 */
 virtual uint16_t* lockFrameBuffer();

Yes, TouchGFX supports vertical swipe.

/**
 * @typedef enum GestureType
 *
 * @brief The gesture event types.
 */
 typedef enum
 {
 SWIPE_HORIZONTAL, ///< An enum constant representing a horizontal swipe
 SWIPE_VERTICAL ///< An enum constant representing a vertical swipe
 } GestureType;

If you override the following method in your view, you'll get an event for either horizontal or vertical swipe:

/**
 * @fn virtual void Drawable::handleGestureEvent(const GestureEvent& evt)
 *
 * @brief Defines the event handler interface for GestureEvents.
 *
 * Defines the event handler interface for GestureEvents. The default implementation
 * ignores the event. The event is only received if the drawable is touchable.
 *
 * @param evt The GestureEvent received from the HAL.
 */
 virtual void handleGestureEvent(const GestureEvent& evt) { }

/Martin

prathima
prathimaAuthor
Associate III
February 21, 2020

This is good information...martin

1.But i have a project which will be running fine ....initially where this project data will store either in single buffer or double buffer if it is stores in any of those how do we find it is storing in single or double buffer means in the program in which file can we find....

2.the same project lets say, i want to store in a single buffer directly(manually with using the respective instructions) how do we write that(means processor)....and how do e confirm that it is storing in single buffer..

3.I have a project with horizontal swipe but i want to so do vertical swiping...

means whenever i swipe vertically the pages should go either from top to bottom or vice versa just like horizontal swipe(left to right and vice versa)....

4.in case i want to do the the swiping rather than vertical and horizontal like my display is of round 390 x 390 resolution i want to do swiping in some angle 15 degrees like that can we do that...

Thank you in advance:) .....

prathima
prathimaAuthor
Associate III
February 21, 2020

1.one more thing you said to use lockframebuffer() function and can you tell me in which program file i can use that...

and what will happens if we write that instruction....

thank you ...

prathima
prathimaAuthor
Associate III
February 21, 2020

hello Martin....

i want do scrolling but in a arc manner...not vertically means vertically only but some with arc(angle)

thank you

prathima
prathimaAuthor
Associate III
February 21, 2020

like....in the image0690X00000DC1XbQAL.png

Romain DIELEMAN
ST Employee
February 21, 2020

Hi prathima, what you wish to do in that image is what is done in Tutorial 4 using a scrollWheel and modifying its Y value. You can compare the result and see the code here. Hope this helps,

/Romain

prathima
prathimaAuthor
Associate III
February 21, 2020

yeah,,,but is this location y location

y=y + getheight ( )/2-390/2;

your talking about romain Dieleman

Romain DIELEMAN
ST Employee
February 21, 2020

I meant X value my bad. But just do the same code as in the tutorial and you will get this nice arc.

prathima
prathimaAuthor
Associate III
February 21, 2020

yes ..i got it:) thank you so much...

And what about the vertical swipe... Suppose i have a swipe container which is having 3 screen in between i want do horizontal swipe...

lets say....

screen1:analog clock

screen2:digital clock

Screen3:one imge

and these screens are side by side same way i have two more screen

one is upside(animation screen) of analog screen and one more is down side analog screen...

so my requirement is i want to do horizontal swipe i will get digital screen ..but in the case vertical swipe i can get animation screen(upside)

and same way down side screen....

how do i do the entire things..

thank you so much

Romain DIELEMAN
ST Employee
February 21, 2020

The swipeContainer does not handle vertical swiping. You can implement yours if you look at the available code but it might be a bit complicated. Another terrible solution I used once was to go in the Config tab and change the display Orientation.

0690X00000DC5jqQAD.png

Then I did my GUI sideways to simulate the board being hold sideways. You can then use the swipe container as a fake vertical swipe but it is annoying to adapt and rotate all your images/text/animations...

0690X00000DC5jWQAT.png

This was fine enough for a simple project, i would not recommend it for a huge and complex project.

prathima
prathimaAuthor
Associate III
February 23, 2020

that is okay..

but the thing is in my project i want to do vertical swipe and horizontal swipe no...that is what i want

prathima
prathimaAuthor
Associate III
February 23, 2020

and i asked about the frame buffer implementation...in above can you please look at it once and provide the solution for that,,,

thank you so much

prathima
prathimaAuthor
Associate III
February 25, 2020

Hello...

In L4R9AI-EVAL ,i want to access the frame buffer and i want to access the touch from there ,can i do that,if yes how do i do that...is there any example code....

thank you