您好,我还是有一点疑问,当程序执行到osal_set_event的时候,这个时候的events=SYS_EVENT_MSG,那么在主循环中events = (tasksArr[idx])( idx, events );会执行对应的al_ProcessEvent函数;uint16 Hal_ProcessEvent( uint8 task_id, uint16 events )
{
uint8 *msgPtr;
(void)task_id; // Intentionally unreferenced parameter
if ( events & SYS_EVENT_MSG )// SYS_EVENT_MSG=0x8000
{
msgPtr = osal_msg_receive(Hal_TaskID);
while (msgPtr)
{
/* Do something here - for now, just deallocate the msg and move on */
/* De-allocate */
osal_msg_deallocate( msgPtr );
/* Next */
msgPtr = osal_msg_receive( Hal_TaskID );
}
return events ^ SYS_EVENT_MSG;
}
那么为什么会按照楼主的流程图那样执行SampleApp_HandleKeys()函数呢? |