eGUI - how to use Screen_OnMain() function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

eGUI - how to use Screen_OnMain() function

跳至解决方案
1,146 次查看
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 项奖励
回复
1 解答
960 次查看
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 项奖励
回复
1 回复
961 次查看
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 项奖励
回复