diff options
Diffstat (limited to 'lib/chibios-contrib/demos/KINETIS/RT-TEENSY3/main.c')
-rw-r--r-- | lib/chibios-contrib/demos/KINETIS/RT-TEENSY3/main.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/chibios-contrib/demos/KINETIS/RT-TEENSY3/main.c b/lib/chibios-contrib/demos/KINETIS/RT-TEENSY3/main.c new file mode 100644 index 000000000..95ba51731 --- /dev/null +++ b/lib/chibios-contrib/demos/KINETIS/RT-TEENSY3/main.c | |||
@@ -0,0 +1,69 @@ | |||
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 | |||
23 | /* | ||
24 | * LED blinker thread. | ||
25 | */ | ||
26 | static THD_WORKING_AREA(waThread1, 64); | ||
27 | static THD_FUNCTION(Thread1, arg) { | ||
28 | |||
29 | (void)arg; | ||
30 | chRegSetThreadName("LEDBlinker"); | ||
31 | while (true) { | ||
32 | palTogglePad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); | ||
33 | chThdSleepMilliseconds(500); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * Application entry point. | ||
39 | */ | ||
40 | int main(void) { | ||
41 | |||
42 | /* | ||
43 | * System initializations. | ||
44 | * - HAL initialization, this also initializes the configured device drivers | ||
45 | * and performs the board-specific initializations. | ||
46 | * - Kernel initialization, the main() function becomes a thread and the | ||
47 | * RTOS is active. | ||
48 | */ | ||
49 | halInit(); | ||
50 | chSysInit(); | ||
51 | |||
52 | /* | ||
53 | * Activates serial 1 (UART0) using the driver default configuration. | ||
54 | */ | ||
55 | sdStart(&SD1, NULL); | ||
56 | |||
57 | /* | ||
58 | * Creates the blinker thread. | ||
59 | */ | ||
60 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); | ||
61 | |||
62 | test_execute((BaseSequentialStream *)&SD1, &rt_test_suite); | ||
63 | test_execute((BaseSequentialStream *)&SD1, &oslib_test_suite); | ||
64 | while (true) { | ||
65 | chThdSleepMilliseconds(1000); | ||
66 | } | ||
67 | |||
68 | return 0; | ||
69 | } | ||