lwevent functionality in a task

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

lwevent functionality in a task

612 次查看
norbertoj
Contributor III

Hi!!!!

I have som problems with _lewent_wait. I have a task that do two things, First, configure some buttons (Enable, Disable in SW, in a uint8 variable) for request of other task (control task),; second, detect an event (pressed or released) and report it to control task. My problem is that if I use _lewent wait_ticks, the code blocks in only waiting an event, and doesn't read the messages of control task. Is there other way with the library of lwevent?

Sincerely,

Norberto Jiménez

0 项奖励
回复
2 回复数

507 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Norberto:

Yes, waiting on event bit is a blocking call.  Any task can set or clear bits event field,  or interrupt service routine can also set or clear bits. once the condition specified to unblock  is being met, the task state will change from blocked to ready, and the scheduler will be called to see whether a context switch should be done.

Please refer to the following demo for lwevent usage.

C:\Freescale\Freescale_MQX_4_2\mqx\examples\lwevent

Regards

Daniel

0 项奖励
回复

507 次查看
norbertoj
Contributor III

Hi Daniel.

I have my task waiting for an event bit(_lwevent_wait_ticks() ) from a function that check if a button is pressed. I have another task that send a message (Create from _lwmsgq_init() ) in order to configure some characteristics of the button. I don't know if there is a way to unlock the task without use _lwevent_set(), like _task_ready(). Or , Is better assigned another event bit, and get the mask event bits?

Regards,

Norberto.

0 项奖励
回复