[mw_shl_code=c,true]void AppTask3(void *parg)
{
u8 key;
OS_ERR err;
parg = parg;
LCD_ShowString(10, 50, "TASK3 RUNNING...", 16);
while(1)
{
key = KEY_Scan();
switch(key)
{
case KEY_UP:
{
OS_TaskSuspend((OS_TCB *)&AppTask2TCB, &err);
LCD_Fill(10, 70, TFTLCD_item.width-1, 90, WHITE);
LCD_ShowString(20, 70, "UP:TASK2 SUSPENDING...", 16);
break;
}
case KEY_DOWN:
{
OS_TaskResume((OS_TCB *)&AppTask2TCB, &err);
LCD_Fill(10, 70, TFTLCD_item.width-1, 90, WHITE);
LCD_ShowString(20, 70, "DOWN:TASK2 RESUME TO RUN...", 16);
break;
}
case KEY_LEFT:
{
OSTaskDel((OS_TCB *)&AppTask2TCB, &err);
LCD_Fill(10, 70, TFTLCD_item.width-1, 90, WHITE);
LCD_ShowString(20, 70, "LEFT:TASK2 WAS DELETED!", 16);
break;
}
case KEY_RIGHT:
{
OSTaskCreate((OS_TCB *)&AppTask2TCB, // Create the start task
(CPU_CHAR *)"App Task2",
(OS_TASK_PTR ) AppTask2,
(void *) 0,
(OS_PRIO ) APP_TASK2_PRIO,
(CPU_STK *)&AppTask2Stk[0],
(CPU_STK_SIZE) APP_TASK2_STK_SIZE / 10,
(CPU_STK_SIZE) APP_TASK2_STK_SIZE,
(OS_MSG_QTY ) 0u,
(OS_TICK ) 0u,
(void *) 0,
(OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
(OS_ERR *)&err);
LCD_Fill(10, 70, TFTLCD_item.width-1, 90, WHITE);
LCD_ShowString(20, 70, "RIGHT:TASK2 WAS CREATED AGAIN!", 16);
break;
}
}
OSTimeDlyHMSM(0, 0, 0, 10, OS_OPT_TIME_HMSM_STRICT, &err);
}
}
[/mw_shl_code]
按下UP键后,所有任务都暂停了,而且再按其他键也都没有用?
一周热门 更多>