1 /*
2 * Copyright (c) 2006-2021, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 */
9 #include <rtthread.h>
10 #include "drv_led.h"
11 #include "drv_uart.h"
12
thread1_entry(void * parameter)13 static void thread1_entry(void* parameter)
14 {
15 while(1)
16 {
17 Led_Control(0,1);
18 rt_thread_delay(RT_TICK_PER_SECOND);
19 Led_Control(0,0);
20 rt_thread_delay(RT_TICK_PER_SECOND);
21 }
22 }
23
thread2_entry(void * parameter)24 static void thread2_entry(void* parameter)
25 {
26 while(1)
27 {
28 Led_Control(1,1);
29 rt_thread_delay(RT_TICK_PER_SECOND);
30 Led_Control(1,0);
31 rt_thread_delay(RT_TICK_PER_SECOND);
32 }
33 }
34
35
demo_init(void)36 int demo_init(void)
37 {
38 rt_thread_t thread1 = RT_NULL;
39 rt_thread_t thread2 = RT_NULL;
40
41
42 rt_led_hw_init();
43
44
45 thread1 = rt_thread_create("t1",thread1_entry, RT_NULL,512,10,5);
46 if (thread1 != RT_NULL)
47 rt_thread_startup(thread1);
48
49 thread2 = rt_thread_create("t2",thread2_entry, RT_NULL,512,10,5);
50 if (thread2 != RT_NULL)
51 rt_thread_startup(thread2);
52
53
54 return 0;
55
56 }
57