关于多任务无法执行
int rt_application_init(){
/* init led1 thread */
rt_thread_init(&thread_led1,
"led1",
rt_thread_entry_led1,
RT_NULL,
&thread_led1_stack,
sizeof(thread_led1_stack),10,10);
rt_thread_startup(&thread_led1);
/* init led2 thread */
rt_thread_init(&thread_led2,
"led2",
rt_thread_entry_led2,
RT_NULL,
&thread_led2_stack,
sizeof(thread_led2_stack),10,10);
rt_thread_startup(&thread_led2);
rt_thread_init(&Touch,
"Touch",
TaskTouch,
RT_NULL,
&Touch_stack,
sizeof(Touch_stack),10,10);
rt_thread_startup(&Touch);
return 0;
}
char thread_led1_stack;
struct rt_thread thread_led1;
static void rt_thread_entry_led1(void* parameter)
{
/* init led configuration */
rt_hw_led_init();
while (1)
{
/* led on */
rt_kprintf("led1 on\r\n");
rt_hw_led_on(0);
rt_thread_delay(50); /* sleep 0.5 second and switch to other thread */
/* led off */
rt_kprintf("led1 off\r\n");
rt_hw_led_off(0);
rt_thread_delay(50);
}
}
char thread_led2_stack;
struct rt_thread thread_led2;
void rt_thread_entry_led2(void* parameter)
{
unsigned int count=0;
while (1)
{
/* led on */
rt_kprintf("led2 on,count : %d\r\n",count);
count++;
rt_hw_led_on(1);
rt_thread_delay(RT_TICK_PER_SECOND);
/* led off */
rt_kprintf("led2 off\r\n");
rt_hw_led_off(1);
rt_thread_delay(RT_TICK_PER_SECOND);
}
}
char Touch_stack;
struct rt_thread Touch;
void TaskTouch(void *parameter)
{
LCD_ShowString(10,160,"Touch Panel:");
while(1)
{
//GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource1); //触摸中断线映射
//if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下
//{
// Pen_Int_Set(0);//关闭中断
Convert_Pos();
// Pen_Point.Key_Sta=Key_Up;
if(Pen_Point.X0>216&&Pen_Point.Y0>304)Load_Drow_Dialog();//清除
else if(Pen_Point.Y0>180)
{
Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0);//画图
GPIO_SetBits(GPIOC,GPIO_Pin_1);
}
// Pen_Int_Set(1);//开启中断
// }
rt_thread_delay(200);
}
}
只进入TASKTouch任务,而且进入一次之后就进入空闲任务,不会对LED进行操作,不知道问题出在哪,求大神请教! 没有心跳。finsh>>list_thread()
finsh>>list_timer()
页:
[1]