使用了官方例程的RT-Thread工程,在新增led_blink任务时遇到问题;
#include "led.h"
#include
#include
struct rt_thread led_blink_thread;
static char uart_ble_tx_stack[256] = {0};
static void led_blink_entry(void* paramenter)
{
rt_pin_mode(LED_G, PIN_MODE_OUTPUT);
rt_kprintf("led_blink_entry startup.\r\n");
while(1){
rt_pin_write(LED_G, PIN_LOW);
rt_thread_mdelay(500);
rt_pin_write(LED_G, PIN_HIGH);
rt_thread_mdelay(500);
}
}
int led_blink_init(void)
{
rt_kprintf("led_blink_init enter.\r\n");
rt_thread_init(&led_blink_thread,"led",led_blink_entry,RT_NULL,&uart_ble_tx_stack[0],
sizeof(uart_ble_tx_stack),THREAD_PRIORITY - 1, THREAD_TIMESLICE);
rt_thread_startup(&led_blink_thread);
return 0;
}
主程序调用led_blink_init后,对应的led并没有闪烁,使用list_thread命令可以查看到led任务已创建。
msh >list_thread
thread pri status sp stack size max used left tick error
------ --- ------- ---------- ---------- ------ ---------- ---
led 25 ready 0x00000080 0x00000400 12% 0x0000000a 000
tshell 11 ready 0x00000180 0x00000400 60% 0x00000008 000
tidle 15 ready 0x000000a0 0x00000200 40% 0x00000019 000
main 5 suspend 0x000000e0 0x00000200 46% 0x00000009 000
请问出现这种问题的原因是什么?
另外还想问一下为什么main的状态是suspend?