rt-thread/bsp/lpc5410x/applications/demo_thread.c

57 lines
1.1 KiB
C
Raw Normal View History

/*
2021-03-17 02:26:35 +08:00
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
2014-12-16 19:54:29 +08:00
#include <rtthread.h>
#include "drv_led.h"
#include "drv_uart.h"
2021-03-17 02:26:35 +08:00
static void thread1_entry(void* parameter)
2014-12-16 19:54:29 +08:00
{
while(1)
{
2021-03-17 02:26:35 +08:00
Led_Control(0,1);
rt_thread_delay(RT_TICK_PER_SECOND);
Led_Control(0,0);
rt_thread_delay(RT_TICK_PER_SECOND);
2014-12-16 19:54:29 +08:00
}
}
2021-03-17 02:26:35 +08:00
static void thread2_entry(void* parameter)
2014-12-16 19:54:29 +08:00
{
while(1)
{
2021-03-17 02:26:35 +08:00
Led_Control(1,1);
rt_thread_delay(RT_TICK_PER_SECOND);
Led_Control(1,0);
rt_thread_delay(RT_TICK_PER_SECOND);
}
2014-12-16 19:54:29 +08:00
}
int demo_init(void)
{
2021-03-17 02:26:35 +08:00
rt_thread_t thread1 = RT_NULL;
rt_thread_t thread2 = RT_NULL;
rt_led_hw_init();
thread1 = rt_thread_create("t1",thread1_entry, RT_NULL,512,10,5);
if (thread1 != RT_NULL)
rt_thread_startup(thread1);
thread2 = rt_thread_create("t2",thread2_entry, RT_NULL,512,10,5);
if (thread2 != RT_NULL)
rt_thread_startup(thread2);
return 0;
2014-12-16 19:54:29 +08:00
}