使用了官方例程的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;
}
主程序調(diào)用led_blink_init后,對應的led并沒有閃爍,使用list_thread命令可以查看到led任務已創(chuàng)建。
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
請問出現(xiàn)這種問題的原因是什么?
另外還想問一下為什么main的狀態(tài)是suspend?