我想要的功能:绿灯亮五次然后蓝灯亮五次然后又绿灯亮五次。。。。。。。。。。一直循环下去,用freeRTOS在指南者开发板上实现。
void LED0_Task(void* parameter)
{
portTickType xLastWakeTime = xTaskGetTickCount();
vTaskSuspend(LED1_Handle);
PB_Out(1) = 1;
LED_GPIO_Config(GPIO_Pin_0);
while (1)
{
LED0_Num++;
printf("led0\n");
PB_Out(0) = 0;
vTaskDelayUntil(&xLastWakeTime, 500);
PB_Out(0) = 1;
vTaskDelayUntil(&xLastWakeTime, 500);
if(LED0_Num == 5)
{
LED0_Num = 0;
vTaskResume(LED1_Handle);
vTaskSuspend(LED0_Handle);
}
}
}
void LED1_Task(void* parameter)
{
PB_Out(0) = 1;
LED_GPIO_Config(GPIO_Pin_1);
while (1)
{
LED1_Num++;
printf("led1\n");
PB_Out(1) = 0;
vTaskDelay(500);
PB_Out(1) = 1;
vTaskDelay(500);
if(LED1_Num == 5)
{
LED1_Num = 0;
vTaskResume(LED0_Handle);
vTaskSuspend(LED1_Handle);
}
}
}
为什么这程序不得???? |