初级会员
- 积分
- 159
- 金钱
- 159
- 注册时间
- 2015-1-19
- 在线时间
- 35 小时
|
1金钱
void Time_task(void * p_arg)
{
OS_ERR err;
color_bar_test();
while(1)
{
LED_POWER_On();
OSTimeDlyHMSM(0,0,0,500,OS_OPT_TIME_PERIODIC,&err);//ÑÓʱ500ms
LED_POWER_Off();
OSTimeDlyHMSM(0,0,0,500,OS_OPT_TIME_PERIODIC,&err);//ÑÓʱ500ms
}
}
void Led_task(void * p_arg)
{
OS_ERR err;
while(1)
{
LED_ALARM_On();
OSTimeDlyHMSM(0,0,0,500,OS_OPT_TIME_PERIODIC,&err);//ÑÓʱ500ms
LED_ALARM_Off();
OSTimeDlyHMSM(0,0,0,500,OS_OPT_TIME_PERIODIC,&err);//ÑÓʱ500ms
}
}
[/mw_shl_code][mw_shl_code=applescript,true]OS_ERR err;
CPU_SR_ALLOC();
p_arg = p_arg;
CPU_Init();
#if OS_CFG_STAT_TASK_EN > 0u
OSStatTaskCPUUsageInit(&err); //ͳ¼ÆÈÎÎñ
#endif
#ifdef CPU_CFG_INT_DIS_MEAS_EN //Èç¹ûʹÄÜÁ˲âÁ¿ÖжϹرÕʱ¼ä
CPU_IntDisMeasMaxCurReset();
#endif
#if OS_CFG_SCHED_ROUND_ROBIN_EN //µ±Ê¹ÓÃʱ¼äƬÂÖתµÄʱºò
//ʹÄÜʱ¼äƬÂÖתµ÷¶È¹¦ÄÜ,ʱ¼äƬ³¤¶ÈΪ1¸öϵͳʱÖÓ½ÚÅÄ£¬¼È1*5=5ms
OSSchedRoundRobinCfg(DEF_ENABLED,1,&err);
#endif
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC,ENABLE);
WM_SetCreateFlags(WM_CF_MEMDEV);
GUI_Init();
OS_CRITICAL_ENTER(); //½øÈëÁÙ½çÇø
//´´½¨TIMEÈÎÎñ
OSTaskCreate((OS_TCB * )&TimeTaskTCB,
(CPU_CHAR * )"time task",
(OS_TASK_PTR )Time_task,
(void * )0,
(OS_PRIO )TIME_TASK_PRIO,
(CPU_STK * )&TIME_TASK_STK[0],
(CPU_STK_SIZE)TIME_STK_SIZE/10,
(CPU_STK_SIZE)TIME_STK_SIZE,
(OS_MSG_QTY )0,
(OS_TICK )0,
(void * )0,
(OS_OPT )OS_OPT_TASK_STK_CHK|OS_OPT_TASK_STK_CLR,
(OS_ERR * )&err);
//´´½¨LEDÈÎÎñ
OSTaskCreate((OS_TCB * )&LedTaskTCB,
(CPU_CHAR * )"led task",
(OS_TASK_PTR )Led_task,
(void * )0,
(OS_PRIO )LED_TASK_PRIO,
(CPU_STK * )&LED_TASK_STK[0],
(CPU_STK_SIZE)LED_STK_SIZE/10,
(CPU_STK_SIZE)LED_STK_SIZE,
(OS_MSG_QTY )0,
(OS_TICK )0,
(void * )0,
(OS_OPT )OS_OPT_TASK_STK_CHK|OS_OPT_TASK_STK_CLR,
(OS_ERR * )&err);
OS_TaskSuspend((OS_TCB*)&StartTaskTCB,&err); //¹ÒÆð¿ªÊ¼ÈÎÎñ
OS_CRITICAL_EXIT(); //Í˳öÁÙ½çÇø[/mw_shl_code][mw_shl_code=applescript,true]//ÓÅÏȼ¶·ÖÅä
#define START_TASK_PRIO 3
#define TIME_TASK_PRIO 6
#define LED_TASK_PRIO 5
//ÈÎÎñÕ»·ÖÅä
#define START_STK_SIZE 128
#define TIME_STK_SIZE 128
#define LED_STK_SIZE 64
//ÈÎÎñº¯Êý
void start_task(void *p_arg);
void Time_task(void *p_arg);
void Led_task(void *p_arg);[/mw_shl_code]
高优先级级任务会运行一次,ALARM闪烁一次,colorbartest显示,但是POWER_LED一直不运行。
|
|