cancel
Showing results for 
Search instead for 
Did you mean: 

Explanation of data flow in TouchGFX?

NS.16
Associate II

Hi Sir,

I am new to embedded world and i have a stm32f429i-disco with touchgfx software.Actually i created a project using touchgfx and generated code using that software.But when i am going to change some code in that generated code file, i can't understand how the code flow is working.Because all touchgfx and stm32 tutorials are teach us to changes in SCREENVIEW,PRESENTER and MODEL only.But i want to know how the main() is communicating with MVP code.There is Only one task name GUITASK is created by the touchgfx , in that function of that task i can't map to guitask to MVP files. Can any one Help me to understand the code flow.Please help me guys, i am always online you can feel me to ping on snagaraj4896@gmail.com.I am always waiting for your reply guys.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @NS.16​,

It's true that TouchGFX applications follow the MVP pattern (Model, View, Presenter). The GUI Task is running an event loop that is driven by an external event (VSYNC from LCD or Hardware Timer..). When that event is received by TouchGFX HAL, the application is "ticked".

One of the elements of the application being ticked is the Model (The M of MVP). Here, the model can check for the presence of data from other peripheral tasks through e.g. OS Message queues. The Model then communicates these values to the active view through the ModelListener interface which all Presenters inherit from (They implement the functions they are interested in). Only one View/Presenter pair can be active at any point in time.

You can find more information about this flow in this article:

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication/

There are also examples in there on how to get data from a peripheral task displayed in your UI,.

Hope that helps.

/Martin

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

Hi @NS.16​,

It's true that TouchGFX applications follow the MVP pattern (Model, View, Presenter). The GUI Task is running an event loop that is driven by an external event (VSYNC from LCD or Hardware Timer..). When that event is received by TouchGFX HAL, the application is "ticked".

One of the elements of the application being ticked is the Model (The M of MVP). Here, the model can check for the presence of data from other peripheral tasks through e.g. OS Message queues. The Model then communicates these values to the active view through the ModelListener interface which all Presenters inherit from (They implement the functions they are interested in). Only one View/Presenter pair can be active at any point in time.

You can find more information about this flow in this article:

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication/

There are also examples in there on how to get data from a peripheral task displayed in your UI,.

Hope that helps.

/Martin

Thank you sir.

Peter BENSCH
ST Employee

Maybe this thread should be updated because the URL mentioned by Martin has moved.

Take a look at the following URL, where you can find highly interesting information about the backend communication:

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication/

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks, Peter! I updated the post.

GOmon.1
Associate III

Now that link is outdated 

Could you please post the latest link. and maybe someone could just stop moving stuff around as it is hard enough to learn this let alone links going dead.

mikez33308
Associate II

Save yourself from many complications handling the HAL abstractions from the TouchGFX layer, and use FreeRTOS queues and tasks to handle the data flow. (Personal opinion)

Functional example Model.cpp

mikez33308_0-1716470133504.png