You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
764 B

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include"drv_common.h"
#define LED_PIN GET_PIN(C,13)
/* 线程 1 的入口函数 */
void RUN_LED(void *parameter)
{
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(LED_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
}
/* 线程示例 */
void thread_RUN_LED(void)
{
/* 初始化线程 1,名称是 thread1,入口是 thread1_entry*/
rt_thread_t tid;
tid = rt_thread_create("led", RUN_LED, RT_NULL, 512, 3, 10);
if (tid != RT_NULL)
{
rt_thread_startup(tid);
}
else
{
rt_kprintf("Failed to create led thread!\n");
}
// return 0;
}