diff options
Diffstat (limited to 'lib/chibios/demos/STM32/RT-STM32H755ZI-NUCLEO144/main.c')
-rw-r--r-- | lib/chibios/demos/STM32/RT-STM32H755ZI-NUCLEO144/main.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/chibios/demos/STM32/RT-STM32H755ZI-NUCLEO144/main.c b/lib/chibios/demos/STM32/RT-STM32H755ZI-NUCLEO144/main.c new file mode 100644 index 000000000..d11773864 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32H755ZI-NUCLEO144/main.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 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 "rt_test_root.h" | ||
20 | #include "oslib_test_root.h" | ||
21 | |||
22 | /* | ||
23 | * This is a periodic thread that does absolutely nothing except flashing | ||
24 | * a LED. | ||
25 | */ | ||
26 | static THD_WORKING_AREA(waThread1, 128); | ||
27 | static THD_FUNCTION(Thread1, arg) { | ||
28 | |||
29 | (void)arg; | ||
30 | chRegSetThreadName("blinker"); | ||
31 | while (true) { | ||
32 | palSetLine(LINE_LED1); | ||
33 | chThdSleepMilliseconds(50); | ||
34 | palSetLine(LINE_LED2); | ||
35 | chThdSleepMilliseconds(50); | ||
36 | palSetLine(LINE_LED3); | ||
37 | chThdSleepMilliseconds(200); | ||
38 | palClearLine(LINE_LED1); | ||
39 | chThdSleepMilliseconds(50); | ||
40 | palClearLine(LINE_LED2); | ||
41 | chThdSleepMilliseconds(50); | ||
42 | palClearLine(LINE_LED3); | ||
43 | chThdSleepMilliseconds(200); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Application entry point. | ||
49 | */ | ||
50 | int main(void) { | ||
51 | |||
52 | /* | ||
53 | * System initializations. | ||
54 | * - HAL initialization, this also initializes the configured device drivers | ||
55 | * and performs the board-specific initializations. | ||
56 | * - Kernel initialization, the main() function becomes a thread and the | ||
57 | * RTOS is active. | ||
58 | */ | ||
59 | halInit(); | ||
60 | chSysInit(); | ||
61 | |||
62 | /* | ||
63 | * Activates the serial driver 1 using the driver default configuration. | ||
64 | */ | ||
65 | sdStart(&SD3, NULL); | ||
66 | |||
67 | /* | ||
68 | * Creates the example thread. | ||
69 | */ | ||
70 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL); | ||
71 | |||
72 | /* | ||
73 | * Normal main() thread activity, in this demo it does nothing except | ||
74 | * sleeping in a loop and check the button state. | ||
75 | */ | ||
76 | while (1) { | ||
77 | if (palReadLine(LINE_BUTTON)) { | ||
78 | test_execute((BaseSequentialStream *)&SD3, &rt_test_suite); | ||
79 | test_execute((BaseSequentialStream *)&SD3, &oslib_test_suite); | ||
80 | } | ||
81 | chThdSleepMilliseconds(500); | ||
82 | } | ||
83 | } | ||