/** * @brief The startup task. The uC/OS-II ticker should only be initialize * once multitasking starts. * @param p_arg Argument passed to 'App_TaskStart()' by 'OSTaskCreate()'. * @retval None */ static void App_TaskStart (void *p_arg) { (void)p_arg; /* Initialize BSP functions. */ BSP_Init(); /* Initialize the SysTick. */ OS_CPU_SysTickInit(); #if (OS_TASK_STAT_EN > 0) /* Determine CPU capacity. */ OSStatInit(); #endif /* Create application events. */ App_EventCreate(); /* Create application tasks. */ App_TaskCreate(); while (DEF_TRUE) { STM_EVAL_LEDToggle(LED4); OSTimeDlyHMSM(0, 0, 0, led_dly_cout); STM_EVAL_LEDToggle(LED6); OSTimeDlyHMSM(0, 0, 0, led_dly_cout); STM_EVAL_LEDToggle(LED5); OSTimeDlyHMSM(0, 0, 0, led_dly_cout); STM_EVAL_LEDToggle(LED3); OSTimeDlyHMSM(0, 0, 0, led_dly_cout); } }
/* ********************************************************************************************************* * 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); }
/* ********************************************************************************************************* * App_TaskStart() * * Description : This is an example of a startup task. As mentioned in the book's text, you MUST * initialize the ticker only once multitasking has started. * * Argument(s) : p_arg is the argument passed to 'App_TaskStart()' by 'OSTaskCreateExt()'. * * Return(s) : none. * * Caller(s) : This is a task. * * Notes : (1) The first line of code is used to prevent a compiler warning because 'p_arg' is not * used. The compiler should not generate any code for this statement. ********************************************************************************************************* */ static void App_TaskStart (void *p_arg) { (void)p_arg; /* See Note #1 */ BSP_Init(); /* Initialize BSP functions */ OS_CPU_SysTickInit(); /* Initialize the SysTick */ #if (OS_TASK_STAT_EN > 0) OSStatInit(); /* Determine CPU capacity */ #endif MEM_Init(); End_Init(); GUI_Init(); TIME_Init(); MENU_Init(); App_EventCreate(); /* Create application events */ App_TaskCreate(); /* Create application tasks */ while (DEF_TRUE) { /* Task body, always written as an infinite loop */ beep(); OSTimeDlyHMSM(0, 0, 0, 50); } }
/* ------------------------------------------------------------------------------------------------------ * App_TaskStart() * * Description : Task start function. * * Argument(s) : none. * */ static void App_TaskStart (void *p_arg) { (void)p_arg; OS_CPU_SysTickInit(SysCtlClockGet() / OS_TICKS_PER_SEC); /* Initialize the SysTick.*/ lwIP_init(); /* Initialise lwIP stack. */ App_EventCreate(); App_TaskCreate(); while(1) { OSTaskSuspend(OS_PRIO_SELF); /* Suspend Start Task.*/ // OSTimeDlyHMSM(0, 0, 0, 2); /* Task delay 2ms.*/ } }