Exemplo n.º 1
0
/*
*********************************************************************************************************
*                                            App_StartTask()
*
* Description : 系统任务初始化
*
* Argument(s) : pdata.
*
* Return(s)   : none.
*********************************************************************************************************
*/
static void App_StartTask(void *pdata)
{
	(void)pdata;

	//创建事件
	App_EventCreate();
	//系统滴答设置
	SysTick_Configure();
	//机器人系统初始化
	RobotSystemInit();
	//创建任务
	App_TaskCreate();
	
	 //挂起任务
	 OSTaskSuspend(4); //超声波避障任务
	 OSTaskSuspend(5); //机器人防跌落(PD:  Prevent Drop)
	 OSTaskSuspend(6); //机器人动作任务挂起和恢复
// 	 OSTaskSuspend(7); //GLWP: Get the Legs and Waist Position//储存膝关节位置信息,用于指导机器人摆臂
// 	 OSTaskSuspend(8); //串口接收任务
// 	 OSTaskSuspend(9); //动作执行任务(RW: Robot Walk)
// 	 OSTaskSuspend(10); //动作步骤任务(RFS: Robot Forward Step)
//	 OSTaskSuspend(11); //动作步骤任务(RBS: Robot Backward Step)
//	 OSTaskSuspend(12); //右臂复位任务(RRA: Reset Right Arm)
//	 OSTaskSuspend(13); //左臂复位任务(RLA: Reset Left Arm)
//	 OSTaskSuspend(14); //右摆臂任务(SRA: Swing Right Arm)
//	 OSTaskSuspend(15); //左摆臂任务(SLA: Swing Left Arm)	
//	 OSTaskSuspend(16); //摆腰任务(SW: Swing Waist)
	 OSTaskSuspend(17); //左右手腕和头部转动任务(SteerWork:Steer control)
//	 OSTaskSuspend(18); //眼睛任务(EE: Eye Expression)
//	 OSTaskSuspend(19); //LED任务(LED:decorative lighting)
//	 OSTaskSuspend(20); //LED任务(LED:decorative lighting)
//挂起自己
	 OSTaskDel(OS_PRIO_SELF);
}
Exemplo n.º 2
0
INT8U suspend_network_tasks()
{
  INT8U err = OS_NO_ERR;

  err = ( OSTaskSuspend( SSS_NIOS_II_SIMPLE_SOCKET_SERVER_TASK_PRIORITY )|
        OSTaskSuspend( TK_NETMAIN_TPRIO )|
        OSTaskSuspend( TK_NETTICK_TPRIO) );
  return( err );
}
Exemplo n.º 3
0
void Startup_Task(void *parg)
{
	Show_Main(0,0,0,0);
	Led_Off(0);
	Led_Off(1);
	OSTaskSuspend(CURSOR_TASK_PRIO);
	OSTaskSuspend(TIMER_TASK_PRIO);
	OSTaskSuspend(ADC_TASK_PRIO);
	OSTaskDel(STARTUP_TASK_PRIO);//刪除自己
}
Exemplo n.º 4
0
static void WSCreateTasks()
{
  INT8U error_code = OS_NO_ERR;
  
  /* Start LED Task. */
  
  error_code = OSTaskCreateExt(LED_task,
                             NULL,
                             (void *)&LEDTaskStk[TASK_STACKSIZE-1],
                             LED_PRIO,
                             LED_PRIO,
                             LEDTaskStk,
                             TASK_STACKSIZE,
                             NULL,
                             0);
  alt_uCOSIIErrorHandler(error_code, 0);
  
  /* Start SSD Task. */
  #ifdef SEG7_NAME
  error_code = OSTaskCreateExt(SSD_task,
                             NULL,
                             (void *)&SSDTaskStk[TASK_STACKSIZE-1],
                             SSD_PRIO,
                             SSD_PRIO,
                             SSDTaskStk,
                             TASK_STACKSIZE,
                             NULL,
                             0);
  alt_uCOSIIErrorHandler(error_code, 0);
  #endif
  
  /* Start Board Control Task. */
  
  error_code = OSTaskCreateExt(board_control_task,
                             NULL,
                             (void *)&BCTaskStk[TASK_STACKSIZE-1],
                             BOARD_PRIO,
                             BOARD_PRIO,
                             BCTaskStk,
                             TASK_STACKSIZE,
                             NULL,
                             0);
  alt_uCOSIIErrorHandler(error_code, 0);
  
  /* Suspend both the LED and SSD tasks on start. */
  
  OSTaskSuspend(LED_PRIO);
  OSTaskSuspend(SSD_PRIO);

  /* The web server task is started by the Interniche stack, as the "main" network servicing task. */
  
}
Exemplo n.º 5
0
/* Handle the commands for each gesture */
static void handleGestureCommands(int gesture_code) {
	INT8U err;

	static int state = PAUSE;
	static int volume = 70;

	char *message = (char *) calloc(LARGE_BUF_SIZE, sizeof(char));

	// Pause
	if ((state == PLAY) && (gesture_code == GCODE_DOWN_LEFT)) {
		OSTaskSuspend(AUDIO_TASK_PRIORITY);
		state = PAUSE;
		snprintf(message, LARGE_BUF_SIZE, "RECOGNIZED DOWN-LEFT: PAUSE");
	// Play
	} else if ((state == PAUSE) && (gesture_code == GCODE_UP_LEFT)) {
		OSTaskResume(AUDIO_TASK_PRIORITY);
		state = PLAY;
		snprintf(message, LARGE_BUF_SIZE, "RECOGNIZED UP-LEFT: PLAY");
	// Volume down
	} else if ((state == PLAY) && (gesture_code == GCODE_DOWN_RIGHT)) {
		volume = decreaseVolume(volume);
		audio_set_headphone_volume(av_dev, volume);
		snprintf(message, LARGE_BUF_SIZE, "RECOGNIZED DOWN-RIGHT: VOL-DOWN");
	// Volume up
	} else if ((state == PLAY) && (gesture_code == GCODE_UP_RIGHT)) {
		volume = increaseVolume(volume);
		audio_set_headphone_volume(av_dev, volume);
		snprintf(message, LARGE_BUF_SIZE, "RECOGNIZED UP-RIGHT: VOL-UP");
	}

	printf("%s\n", message);
	if ((err = OSQPost(lcd_queue, message)) != OS_NO_ERR) {
		printf("Error %d: message not put on LCD queue.\n", err);
	}
}
Exemplo n.º 6
0
//浮点测试任务
void float_task(void *p_arg)
{
	OS_ERR err;
	CPU_SR_ALLOC();
	static float float_num = 0.01;
	//uint32_t temp = &float_num;
	while(1)
	{
		float_num+=0.01f;
		OS_CRITICAL_ENTER();	//进入临界区
		//printf("float_num的值为: %.4f\r\n",float_num);
		OS_CRITICAL_EXIT();		//退出临界区
		if(float_num > 0.901f && float_num < 0.919f)
		{
				OSTaskSuspend((OS_TCB*)&Led0TaskTCB,&err);
				printf("挂起LED任务\n\r");
		}
		if(float_num > 1.991f && float_num < 2.001f)
		{
				OSTaskResume((OS_TCB*)&Led0TaskTCB,&err);
				printf("恢复LED任务\n\r");
				float_num = 0.0f;
		}
		OSTimeDlyHMSM(0,0,0,300,OS_OPT_TIME_HMSM_STRICT,&err); //延时300ms	
	}
}
Exemplo n.º 7
0
/*
 ***************************************************************
 * 名称: start_task 
 * 功能: 启动任务
 * 输入: 1. *pdata:任务参数
 * 输出: NULL 
 * 返回: NULL 
 * 描述: 无 
 ***************************************************************
 */
void start_task(void *pdata)
{
    OS_CPU_SR cpu_sr = 0;
	
	pdata = pdata; 		  
	
	TaskInit();
	
	OSStatInit();					// 初始化统计任务.这里会延时1秒钟左右	
 	
	OS_ENTER_CRITICAL();			// 进入临界区(无法被中断打断)    
 	
	OSTaskCreate(uart3_task, 
				(void *)0, 
				(OS_STK*)&UART3_TASK_STK[UART3_STK_SIZE-1], 
				UART3_TASK_PRIO);
	
	OSTaskCreate(can1_task, 
				(void *)0, 
				(OS_STK*)&CAN1_TASK_STK[CAN1_STK_SIZE-1], 
				CAN1_TASK_PRIO);	
 
	OSTaskCreate(beep_task, 
				(void *)0, 
				(OS_STK*)&BEEP_TASK_STK[BEEP_STK_SIZE-1], 
				BEEP_TASK_PRIO);
 	
	OSTaskSuspend(START_TASK_PRIO);	// 挂起起始任务.
	
	OS_EXIT_CRITICAL();				// 退出临界区(可以被中断打断)
}	  
Exemplo n.º 8
0
void start_task(void *pdata)
{
	OS_CPU_SR cpu_sr=0;

	pdata=pdata;

	OSStatInit();//初始化统计任务

	OS_ENTER_CRITICAL();//进入临界区,中断无法打断
	
	/**********************bootloader************************************/
	
	OSTaskCreate(led1_task,//指向任务代码的指针
				(void *)0,//任务开始执行时,传递给任务参数的指针
				(OS_STK *)&LED1_TASK_STK[LED1_STK_SIZE-1],//分配给任务堆栈的栈顶指针
				LED1_TASK_PRIO);//分配给任务的优先级
				
	OSTaskCreate(led2_task,//指向任务代码的指针
				(void *)0,//任务开始执行时,传递给任务参数的指针
				(OS_STK *)&LED2_TASK_STK[LED2_STK_SIZE-1],//分配给任务堆栈的栈顶指针
				LED2_TASK_PRIO);//分配给任务的优先级
				
	OSTaskCreate(key_task,//指向任务代码的指针
				(void *)0,//任务开始执行时,传递给任务参数的指针
				(OS_STK *)&KEY_TASK_STK[KEY_STK_SIZE-1],//分配给任务堆栈的栈顶指针
				KEY_TASK_PRIO);//分配给任务的优先级
				
	/********************************************************************/
				
	OSTaskSuspend(START_TASK_PRIO);//挂起开始任务
	OS_EXIT_CRITICAL()//退出临界区 可以被中断打断
}
/************************************************
函数名:     TaskNetWork
函数描述:   LwIP入口函数
入参:		<pvArg>[in/out] 保留参数 入口函数也包括对硬件部分的初始化工作 
返回值:		0,初始化完毕
修改历史:
2011-5-9    徐军    修改   
************************************************/
void TaskNetWork(void * pvArg)
{
//extern void Handler_HTTP(ST_NETCONN *pstConn);
	struct netconn  *__pstConn, *__pstNewConn;
	struct netbuf	*__pstNetbuf;
	BYTE			*__pbData;
	LONG			__lLen;
	BYTE			i = 0, __bIsAdd = TRUE;

	//* 初始化LwIP
	__ilvInitLwIP();
	
	//* 设置LwIP,包括添加配置网络接口、建立接收任务等工作
	__ilvSetLwIP();
	
//	__pstConn = netconn_new(NETCONN_TCP);
//	netconn_bind(__pstConn, NULL, HTTP_PORT);
//	netconn_listen(__pstConn);
	
	while(TRUE)
	{
		Printf("This is the tcp/ip application	\n");
	
		OSTaskSuspend(OS_PRIO_SELF);
	}
}
Exemplo n.º 10
0
void start_task(void *pdata)
{
	OS_CPU_SR cpu_sr = 0;
	pdata = pdata;

	delay_init(168);

	OS_ENTER_CRITICLE();	//进入临界区 无法被中断打断
	OSTaskCreate(	led0Task, 
			(void *)0, 
			(OS_STK *)LED0_TASK_STK[LED0_STK_SIZE-1],
			LED0_TASK_PRIO);//创建LED任务
	// OSTaskCreate(	beepTask, (void *)0, 
	// 		(OS_STK *)BEEP_TASK_STK[BEEP_STK_SIZE-1],
	// 		BEEP_TASK_PRIO);//创建BEEP任务
	//用OSTaskCreateExt改写
	OSTaskCreateExt(	beepTask, (void *)0,
				(OS_STK *)BEEP_TASK_STK[BEEP_STK_SIZE-1],
				BEEP_TASK_PRIO,
				BEEP_TASK_PRIO,//ID设置为跟优先级一样
				(OS_STK *)BEEP_TASK_STK[0],//栈底指针
				BEEP_STK_SIZE,//堆栈大小
				(void *) 0,//额外参数为空
				OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR//使用任务堆栈检查和清零功能

		)
	OSTaskSuspend(START_TASK_PRIO);//挂起起始任务
	OS_EXIT_CRITICLE();		//退出临界区 可以被中断打断

	

}
Exemplo n.º 11
0
void start_task(void *pdata)
{
    INT8U err;//错误码
    INT8U *pname;
    INT8U len;//名字的长度
    char buffer[16];

    OS_CPU_SR cpu_sr = 0;
    pdata = pdata;

    delay_init(168);

    OS_ENTER_CRITICLE();	//进入临界区 无法被中断打断
    OSTaskCreate(	led0Task,
                    (void *)0,
                    (OS_STK *)LED0_TASK_STK[LED0_STK_SIZE-1],
                    LED0_TASK_PRIO);//创建LED任务
    OSTaskCreate(	beepTask, (void *)0,
                    (OS_STK *)BEEP_TASK_STK[BEEP_STK_SIZE-1],
                    BEEP_TASK_PRIO);//创建BEEP任务
    OSTaskCreate(	keyTask, (void *)0,
                    (OS_STK *)KEY_TASK_STK[KEY_STK_SIZE-1],
                    KEY_TASK_PRIO);//创建keytask

    OSTaskSuspend(START_TASK_PRIO);//挂起起始任务
    OS_EXIT_CRITICLE();		//退出临界区 可以被中断打断



}
Exemplo n.º 12
0
//开始任务
void AppStartTask(void *pdata)
{
  OS_CPU_SR cpu_sr=0;
	pdata = pdata; 		  
	msg_test=OSMboxCreate((void*)0);	//创建消息邮箱
	sem_test=OSSemCreate(0);		//创建信号量	
	OSStatInit();					//初始化统计任务.这里会延时1秒钟左右	
 	OS_ENTER_CRITICAL();			//进入临界区(无法被中断打断)    
    OSTaskCreate(AppLEDTask,(void *)0,
                &APP_LED_STK[TASK_STK_SIZE-1],
                APP_LED_TASK_PRIO); //建立LED1任务
    OSTaskCreate(AppMBOXTask,(void *)0,
                &APP_MBOX_STK[TASK_STK_SIZE-1],
                APP_MBOX_TASK_PRIO); //建立邮箱接收显示任务
    OSTaskCreate(AppSEMTask,(void *)0,
                &APP_SEM_STK[TASK_STK_SIZE-1],
                APP_SEM_TASK_PRIO); //建立信号量接收显示任务
    OSTaskCreate(AppWDOGTask,(void *)0,
                &APP_WDOG_STK[TASK_STK_SIZE-1],
                APP_WDOG_TASK_PRIO); //建立看门狗任务
    OSTaskCreate(AppPostTask,(void *)0,
                &APP_POST_STK[TASK_STK_SIZE-1],
                APP_POST_TASK_PRIO); //建立邮箱,信号量投递任务
  UART_printf("uCOSII MBox&Sem DemoTest\r\n");
 	OSTaskSuspend(APP_START_TASK_PRIO);	//挂起起始任务.
	OS_EXIT_CRITICAL();				//退出临界区(可以被中断打断)
}
Exemplo n.º 13
0
INT8U  CTask::Create(bool bRunNow)
{
	INT32U nStackSize = StackSize();
										
	m_nId = s_nNextId ++;

	OSSchedLock();	
	INT8U  errno = OSTaskCreateExt(_callbackFunc, (void*)this, 
					&m_pTaskStack[nStackSize-1],
					m_nPrio,
					m_nId,
					m_pTaskStack,
					nStackSize,
					(void*)NULL,
					OS_TASK_OPT_STK_CHK|OS_TASK_OPT_STK_CLR);
	if (!errno){
		OSTaskNameSet(m_nPrio, (INT8U*)m_aTaskName, &errno);
	}
	
	if (!bRunNow){
		OSTaskSuspend(m_nPrio);
	}
	OSSchedUnlock();

	return errno;
}
Exemplo n.º 14
0
void TaskStart(void *pdata){
	rSUBSRCPND = rSUBSRCPND;
	rSRCPND = rSRCPND;
	rINTPND = rINTPND;
	pdata = pdata;
	
	S3C_StartTimer4();
	
	SwiHandle(1);
	SwiHandle(3);	//Enable Interrupt
	
	rGPBDAT = (15<<5);

	OSStatInit();
	
	OSTaskCreate(Task_UART0TX,(void *)0,&Stk_Task_UART0TX[99],11);
	OSTaskCreate(Task_UART0Rx,(void *)0,&Stk_Task_UART0Rx[99],12);
	OSTaskCreate(Task_LEDMAN,(void *)0,&Stk_Task_LEDMAN[99],13);
	OSTaskCreate(Task_BEEPMAN,(void *)0,&Stk_Task_BEEPMAN[99],14);
	OSTaskCreate(Task_LCDMAN,(void *)0,&Stk_Task_LCDMAN[99],15);
	
	while(1){
		OSTaskSuspend(OSPrioCur);
	}

}
Exemplo n.º 15
0
/*
* This function is called to suspend a task
*/
extern  status_t taskSuspend
    (
    uint8_t tid                   /* task ID of task to suspend */
    )
{
    return OSTaskSuspend(tid);
}
Exemplo n.º 16
0
static void LedFont_Stop(void) {
  INT8U err;

  if (LedFont_ScrollOnce) {
    OSFlagPost(LedFont_Flags, LEDFONT_FLAG_FINISHED_SCROLLING, OS_FLAG_SET, &err); /* clear all button flags */
  }
  OSTaskSuspend(OS_PRIO_SELF); /* put task to sleep */
}
Exemplo n.º 17
0
static void task1(void *pdata)
{
    while(1)
    {
        dprintf("task1,%s\r\n",pdata);
		OSTaskSuspend(OS_PRIO_SELF);
    }
}
Exemplo n.º 18
0
//显示地址等信息
void display_task(void *pdata)
{
	while(1)
	{ 
#if LWIP_DHCP									//当开启DHCP的时候
		if(lwipdev.dhcpstatus != 0) 			//开启DHCP
		{
			show_address(lwipdev.dhcpstatus );	//显示地址信息
			OSTaskSuspend(OS_PRIO_SELF); 		//显示完地址信息后挂起自身任务
		}
#else
		show_address(0); 						//显示静态地址
		OSTaskSuspend(OS_PRIO_SELF); 			//显示完地址信息后挂起自身任务
#endif //LWIP_DHCP
		OSTimeDlyHMSM(0,0,0,100);
	}
}
Exemplo n.º 19
0
Arquivo: bcr.c Projeto: ericzhc/pdale
/******************************************************
  Disable bar code reader
*******************************************************/
void BCR_Disable()
{
	COM_BUFF_INFO RxBuff = GetTaskRxComBuff();

	OSTaskSuspend(TASK_BCR_PRIO);
    *(RxBuff.ptrCurrent) = *(RxBuff.ptrEnd);
	GPS_Enable();
}
Exemplo n.º 20
0
int
do_exit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	OS_ERR err;
	
	OSTaskSuspend(&APPTaskCMDTCB, &err);

	return 0;
}
Exemplo n.º 21
0
/* The audio task is responsible for continuously playing music
 * off the SD card.
 */
void audio_task(void *pdata) {
	int err = 0;

	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_ACTIVE_CTRL, 0x00);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_LEFT_LINE_IN, 0x97);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_RIGHT_LINE_IN, 0x97);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_LEFT_HEADPHONE_OUT, 0x79);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_RIGHT_HEADPHONE_OUT, 0x79);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_ANALOG_AUDIO_PATH_CTRL, 0x12);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_DIGITAL_AUDIO_PATH_CTRL, 0x05);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_POWER_DOWN_CTRL, 0x07);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_AUDIO_DIGITAL_INTERFACE, 0x42);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_SAMPLING_CTRL, 0x22);
	err += alt_up_av_config_write_audio_cfg_register(av_dev, AUDIO_REG_ACTIVE_CTRL, 0x01);
	err += audio_set_headphone_volume(av_dev, DEFAULT_VOLUME);

	if(err < 0)
		printf("Audio Configuration Failed\n");

	alt_up_audio_reset_audio_core(audio_dev);
	alt_up_audio_disable_read_interrupt(audio_dev);
	alt_up_audio_disable_write_interrupt(audio_dev);

	char fileName[10] = {"class.wav\0"};
	if (file_fopen(&readFile, &efsl.myFs, fileName, 'r') != 0)
		printf("Error:\tCould not open file\n");

	int readSize = 0;
	euint32 currentSize = 44;

	euint8 buf[AUDIO_BUF_SIZE];
	int i;

	/* The task is suspended so that it can be played by another task. */
	OSTaskSuspend(AUDIO_TASK_PRIORITY);
	while(1) {
		if (currentSize < readFile.FileSize) {
			int fifospace = alt_up_audio_write_fifo_space(audio_dev, ALT_UP_AUDIO_LEFT);
			if (fifospace > WORD_COUNT) {
				readSize = file_fread(&readFile, currentSize, AUDIO_BUF_SIZE, buf);
				currentSize += readSize;
				i = 0;
				while(i < AUDIO_BUF_SIZE) {
					IOWR_ALT_UP_AUDIO_LEFTDATA(audio_dev->base, (buf[i+1]<<8)|buf[i]);
					IOWR_ALT_UP_AUDIO_RIGHTDATA(audio_dev->base, (buf[i+3]<<8)|buf[i+2]);

					i+=4;
				}
			}
		} else {
			currentSize = 44;
		}
	}

	file_fclose(&readFile);
}
Exemplo n.º 22
0
//开始任务
void start_task(void *pdata)
{
    OS_CPU_SR cpu_sr=0;
	pdata = pdata; 
  	OS_ENTER_CRITICAL();			//进入临界区(无法被中断打断)    
 	OSTaskCreate(led0_task,(void *)0,(OS_STK*)&LED0_TASK_STK[LED0_STK_SIZE-1],LED0_TASK_PRIO);						   
 	OSTaskCreate(led1_task,(void *)0,(OS_STK*)&LED1_TASK_STK[LED1_STK_SIZE-1],LED1_TASK_PRIO);	 				   
	OSTaskSuspend(START_TASK_PRIO);	//挂起起始任务.
	OS_EXIT_CRITICAL();				//退出临界区(可以被中断打断)
}
Exemplo n.º 23
0
void board_control_task(void *pdata)
{
  INT8U error_code = OS_NO_ERR;
  board_control_mbox = OSMboxCreate((void *)NULL);

  struct http_form_data* board_control_mbox_contents;
  
  while(1)
  {
      board_control_mbox_contents = (void*)OSMboxPend(board_control_mbox, 0, &error_code);
      
      if (board_control_mbox_contents->LED_ON)
      {
        OSTaskResume(LED_PRIO);
      }
      else
      {
        /* Suspend the task and clear the LED. */
        OSTaskSuspend(LED_PRIO);
        IOWR_ALTERA_AVALON_PIO_DATA( LEDG_BASE, 0 );
      }
      
      if (board_control_mbox_contents->SSD_ON)
      {
        OSTaskResume(SSD_PRIO);
      }
      else
      {
        /* Suspend the task and set SSD to all zeros. */
        OSTaskSuspend(SSD_PRIO);
		#ifdef SEG7_NAME
        //sevenseg_set_hex(0); 
		#endif
      }  

      /* Always dump text to the LCD... */
	  #ifdef LCD_NAME
      lcd_output_text( board_control_mbox_contents->LCD_TEXT );
      usleep(500*1000);
	  #endif
  }
}
Exemplo n.º 24
0
//开始任务
void TaskStart(void * pdata)
{
  pdata = pdata; 
  OS_ENTER_CRITICAL();   
  OSTaskCreate(TaskLed , (void * )0, (OS_STK *)&TASK_LED_STK[LED_STK_SIZE-1], LED_TASK_Prio);
  OSTaskCreate(TaskLed1, (void * )0, (OS_STK *)&TASK_LED1_STK[LED1_STK_SIZE-1], LED1_TASK_Prio);
    OSTaskCreate(TaskLed2, (void * )0, (OS_STK *)&TASK_LED2_STK[LED2_STK_SIZE-1], LED2_TASK_Prio);
    
  OSTaskSuspend(START_TASK_Prio); //suspend but not delete
  OS_EXIT_CRITICAL();
static void SweepRobot_RGBLEDTestSingleProc(int *ledState, GUI_COLOR color, char *strText, char *strMultiEdit1, char *strMultiEdit2)
{
    Text_Set_Color(hWin_SWRB_RGB_LED, ID_MAIN_TEXT_RGB_LED, color);
    Text_Set_Text(hWin_SWRB_RGB_LED, ID_MAIN_TEXT_RGB_LED, strText);
    OSTaskSuspend(gSwrbTestRuningTaskPrio);
    if(*ledState) {
        MultiEdit_Add_Text(hWin_SWRB_MAIN, ID_MAIN_MULTIEDIT_MAIN,  strMultiEdit1);
    } else {
        MultiEdit_Add_Text(hWin_SWRB_MAIN, ID_MAIN_MULTIEDIT_MAIN,  strMultiEdit2);
    }
}
Exemplo n.º 26
0
void start_task(void *pdata)
{
	OS_CPU_SR cpu_sr = 0;

//	GUI_Delay(1000);
	OS_ENTER_CRITICAL();
	OSTaskCreate(emwin_demo_task,(void *)0,&EMWIN_TASK_STK[EMWIN_STK_SIZE-1],EMWIN_DEMO_TASK_PRIO);
	OSTaskCreate(touch_task,(void *)0,&TOUCH_TASK_STK[TOUCH_STK_SIZE-1],TOUCH_TASK_PRIO);
	OSTaskCreate(led_task,(void *)0,(OS_STK*)&LED_TASK_STK[LED_STK_SIZE-1],LED_TASK_PRIO);
	OSTaskSuspend(START_TASK_PRIO);	//挂起起始任务.
	OS_EXIT_CRITICAL();
}
Exemplo n.º 27
0
void StopAllTasks ( void )
{
	int i;

	for (i = 0x00; i < N_TASKS; i ++)
	{
		if (sRunning[i])
		{
			OSTaskSuspend(i + 1);
			sRunning[i] = 0x00;
		}
	}
}
Exemplo n.º 28
0
//任务3
//按键检测  
 void TaskKey(void *pdata)
 {	u8  key=0;
    while(1){
	  key=KEY_Scan();
	  if(key==1) 
	  {
		OSTaskSuspend(LED_TASK_Prio);
		OSTaskSuspend(LCD_TASK_Prio);
	  }
	  else if(key==2)
	  {
	    OSTaskResume(LED_TASK_Prio);
		OSTaskResume(LCD_TASK_Prio);	
	  }				
	  else if(key==3)
	  {
	    OSTaskDelReq(LED_TASK_Prio);
		OSTaskDelReq(LCD_TASK_Prio);
	  }
	  OSTimeDlyHMSM(0,0,0,20);		 
	}
 }
Exemplo n.º 29
0
//start任务
void start_task(void *pdata)
{
	OS_CPU_SR cpu_sr;
	pdata = pdata ;
	
	OSStatInit();  			//初始化统计任务
	OS_ENTER_CRITICAL();  	//关中断
	OSTaskCreate(led_task,(void*)0,(OS_STK*)&LED_TASK_STK[LED_STK_SIZE-1],LED_TASK_PRIO); 	//创建LED任务
	OSTaskCreate(key_task,(void*)0,(OS_STK*)&KEY_TASK_STK[KEY_STK_SIZE-1],KEY_TASK_PRIO); 	//创建KEY任务
	OSTaskCreate(display_task,(void*)0,(OS_STK*)&DISPLAY_TASK_STK[DISPLAY_STK_SIZE-1],DISPLAY_TASK_PRIO); //显示任务
	OSTaskSuspend(OS_PRIO_SELF); //挂起start_task任务
	OS_EXIT_CRITICAL();  //开中断
}
Exemplo n.º 30
0
//开始任务
void TaskStart(void * pdata)
{
	pdata = pdata; 
	OS_ENTER_CRITICAL();   
	OSTaskCreate(TaskLed, (void * )0, (OS_STK *)&TASK_LED_STK[LED_STK_SIZE-1], LED_TASK_Prio);
	OSTaskCreate(TaskLed1, (void * )0, (OS_STK *)&TASK_LED1_STK[LED1_STK_SIZE-1], LED1_TASK_Prio);
    OSTaskCreate(TaskLed2, (void * )0, (OS_STK *)&TASK_LED2_STK[LED2_STK_SIZE-1], LED2_TASK_Prio);
 //   OSTaskCreate(TaskLed3, (void * )0, (OS_STK *)&TASK_LED3_STK[LED2_STK_SIZE-1], LED3_TASK_Prio);
// 	OSTaskCreate(TaskLCD, (void * )0, (OS_STK *)&TASK_LCD_STK[LCD_STK_SIZE-1], LCD_TASK_Prio);
//  	OSTaskCreate(TaskKey, (void * )0, (OS_STK *)&TASK_KEY_STK[KEY_STK_SIZE-1], KEY_TASK_Prio);
// 	OSTaskCreate(TaskTouch, (void * )0, (OS_STK *)&TASK_TOUCH_STK[TOUCH_STK_SIZE-1], TOUCH_TASK_Prio);
 	OSTaskSuspend(START_TASK_Prio);	//suspend but not delete
	OS_EXIT_CRITICAL();
}