创建线程任务1,实现对LED的翻转操作,其中还加入了rt_kprintf打印功能,main.c的具体代码如下:#include "board.h"
#include "rtthread.h"
struct rt_thread led0_thread;
rt_uint8_t rt_led0_thread_stack[1024];
void task1(void *parameter);
int main()
{
rt_kprintf("The Project is ES32F0654 RT-Thread Demo.........\r\n");
rt_thread_init(&led0_thread,"led0",
task1,RT_NULL,&rt_led0_thread_stack[0],
sizeof(rt_led0_thread_stack),3,20);
rt_thread_startup(&led0_thread);
}
void task1(void *parameter)
{
while(1)
{
LED1_TOGGLE;
LED2_TOGGLE;
rt_thread_delay(500);
rt_kprintf("LED0_Thread running.........\r\n");
}
}
|