1 /*
2 * Copyright (c) 2006-2018, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 *
9 */
10
11 /**
12 * @addtogroup k64
13 */
14 /*@{*/
15
16 #include <stdint.h>
17 #include <stdio.h>
18
19 #include "MK64F12.h"
20 #include <board.h>
21 #include <rtthread.h>
22
23 #include "led.h"
24
rt_init_thread_entry(void * parameter)25 void rt_init_thread_entry(void* parameter)
26 {
27 #ifdef RT_USING_COMPONENTS_INIT
28 /* initialization RT-Thread Components */
29 rt_components_init();
30 #endif
31 }
32
33 float f_var1;
34 float f_var2;
35 float f_var3;
36 float f_var4;
37
38 rt_align(RT_ALIGN_SIZE)
39 static char thread_led1_stack[1024];
40 struct rt_thread thread_led1;
rt_thread_entry_led1(void * parameter)41 static void rt_thread_entry_led1(void* parameter)
42 {
43 int n = 0;
44 rt_hw_led_init();
45
46 while (1)
47 {
48 //rt_kprintf("LED\t%d\tis shining\r\n",n);
49
50 rt_hw_led_on(n);
51 rt_thread_delay(RT_TICK_PER_SECOND/2);
52 rt_hw_led_off(n);
53 rt_thread_delay(RT_TICK_PER_SECOND/2);
54
55 n++;
56
57 if (n == LED_MAX)
58 n = 0;
59 }
60 }
61
rt_application_init()62 int rt_application_init()
63 {
64 rt_thread_t init_thread;
65
66 init_thread = rt_thread_create("init",
67 rt_init_thread_entry, RT_NULL,
68 2048, RT_THREAD_PRIORITY_MAX/3, 20);
69
70 if (init_thread != RT_NULL)
71 rt_thread_startup(init_thread);
72
73 //------- init led1 thread
74 rt_thread_init(&thread_led1,
75 "led_demo",
76 rt_thread_entry_led1,
77 RT_NULL,
78 &thread_led1_stack[0],
79 sizeof(thread_led1_stack),11,5);
80 rt_thread_startup(&thread_led1);
81
82 return 0;
83 }
84
85 /*@}*/
86