summaryrefslogtreecommitdiff
path: root/bsp/nxp/lpc/lpc5410x/applications/demo_thread.c
blob: 0d7ce2d2b809e4133292c95b305bcdec06fc18e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */
#include <rtthread.h>
#include "drv_led.h"
#include "drv_uart.h"

static void thread1_entry(void* parameter)
{
    while(1)
    {
            Led_Control(0,1);
            rt_thread_delay(RT_TICK_PER_SECOND);
            Led_Control(0,0);
            rt_thread_delay(RT_TICK_PER_SECOND);
    }
}

static void thread2_entry(void* parameter)
{
    while(1)
    {
            Led_Control(1,1);
            rt_thread_delay(RT_TICK_PER_SECOND);
            Led_Control(1,0);
            rt_thread_delay(RT_TICK_PER_SECOND);
    }
}


int demo_init(void)
{
    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;

}