eGUI - how to use Screen_OnMain() function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eGUI - how to use Screen_OnMain() function

Jump to solution
643 Views
Maciek
Contributor V

Hi,

How often is the Screen_OnMain() function called when the 'Screen' is active ?

Does it run on a separate thread ? Can it block ? Or should be used more like ISR (fast, non-blocking) ?

What is it's purpose (typical example application of this function) ?

Can other functions from this family (OnInit(), OnActivate() etc.) block, or should they be used more like ISR ?

Regards

Maciek

0 Kudos
1 Solution
457 Views
LuisCasado
NXP Employee
NXP Employee

Hello,


Screen_OnMain() is called every time D4D_Poll() is called if the screen is the active one. D4D_Poll will be called in the main application loop periodically or in a separared task in MQX enviroment.  Yo can control the frequency of calling OnMain() depending on the number of task in the main bare metal loop, use a timer to call D4D_Poll() every X milliseconds and use delay(x) to block the D4D task in MQX.

You shouldn't block any D4D screen functions or object callback functions ro you will block your application in bare metal application. But you shuldn't block in MQX neither.

You can use OnMain() to refresh any object on the active screen, modify objects content, etc. For example you want to update the content of a graph object, other task or interrupt code is taking ADC samples that you want to show in the graph, inside OnMain() you have to read the new sampled values from buffer and sent to the graph object.

In general, you will use OnMain() to refresh paramenters, data in the objects in your screen and the code related with the functionlity of your screen.

I hope this helps.

Regards,

Luis

View solution in original post

0 Kudos
1 Reply
458 Views
LuisCasado
NXP Employee
NXP Employee

Hello,


Screen_OnMain() is called every time D4D_Poll() is called if the screen is the active one. D4D_Poll will be called in the main application loop periodically or in a separared task in MQX enviroment.  Yo can control the frequency of calling OnMain() depending on the number of task in the main bare metal loop, use a timer to call D4D_Poll() every X milliseconds and use delay(x) to block the D4D task in MQX.

You shouldn't block any D4D screen functions or object callback functions ro you will block your application in bare metal application. But you shuldn't block in MQX neither.

You can use OnMain() to refresh any object on the active screen, modify objects content, etc. For example you want to update the content of a graph object, other task or interrupt code is taking ADC samples that you want to show in the graph, inside OnMain() you have to read the new sampled values from buffer and sent to the graph object.

In general, you will use OnMain() to refresh paramenters, data in the objects in your screen and the code related with the functionlity of your screen.

I hope this helps.

Regards,

Luis

0 Kudos