aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c')
-rw-r--r--lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c b/lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
new file mode 100644
index 000000000..499bd223b
--- /dev/null
+++ b/lib/chibios-contrib/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
@@ -0,0 +1,88 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#include "ch.h"
18#include "hal.h"
19#include "ch_test.h"
20#include "rt_test_root.h"
21#include "oslib_test_root.h"
22
23static THD_WORKING_AREA(waThread1, 64);
24static THD_FUNCTION(Thread1, arg) {
25
26 (void)arg;
27 chRegSetThreadName("RedBlinker");
28 while (true) {
29 palTogglePad(IOPORT2, 18);
30 chThdSleepMilliseconds(300);
31 }
32}
33
34static THD_WORKING_AREA(waThread2, 64);
35static THD_FUNCTION(Thread2, arg) {
36
37 (void)arg;
38 chRegSetThreadName("GreenBlinker");
39 while (true) {
40 palTogglePad(IOPORT2, 19);
41 chThdSleepMilliseconds(600);
42 }
43}
44
45static THD_WORKING_AREA(waThread3, 64);
46static THD_FUNCTION(Thread3, arg) {
47
48 (void)arg;
49 chRegSetThreadName("BlueBlinker");
50 while (true) {
51 palTogglePad(IOPORT4, 1);
52 chThdSleepMilliseconds(900);
53 }
54}
55
56/*
57 * Application entry point.
58 */
59int main(void) {
60
61 /*
62 * System initializations.
63 * - HAL initialization, this also initializes the configured device drivers
64 * and performs the board-specific initializations.
65 * - Kernel initialization, the main() function becomes a thread and the
66 * RTOS is active.
67 */
68 halInit();
69 chSysInit();
70
71 /*
72 * Activates serial 1 (UART0) using the driver default configuration.
73 */
74 sdStart(&SD1, NULL);
75
76 /*
77 * Creates the blinker threads.
78 */
79 chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
80 chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
81 chThdCreateStatic(waThread3, sizeof(waThread3), NORMALPRIO, Thread3, NULL);
82
83 test_execute((BaseSequentialStream *)&SD1, &rt_test_suite);
84 test_execute((BaseSequentialStream *)&SD1, &oslib_test_suite);
85 while (1) {
86 chThdSleepMilliseconds(500);
87 }
88}