2019-03-07 02:04 AM
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.
Solved! Go to Solution.
2019-03-07 06:05 AM
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:
There are also examples in there on how to get data from a peripheral task displayed in your UI,.
Hope that helps.
/Martin
2019-03-07 06:05 AM
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:
There are also examples in there on how to get data from a peripheral task displayed in your UI,.
Hope that helps.
/Martin
2019-03-07 08:57 PM
Thank you sir.
2020-05-12 06:20 AM
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:
Good luck!
/Peter
2020-05-12 06:47 AM
Thanks, Peter! I updated the post.
2024-01-02 10:55 PM
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.
2024-05-23 06:17 AM
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