diff options
Diffstat (limited to 'lib/chibios/demos/STM32/RT-STM32F746G-DISCOVERY/main.c')
-rw-r--r-- | lib/chibios/demos/STM32/RT-STM32F746G-DISCOVERY/main.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lib/chibios/demos/STM32/RT-STM32F746G-DISCOVERY/main.c b/lib/chibios/demos/STM32/RT-STM32F746G-DISCOVERY/main.c new file mode 100644 index 000000000..07de083a2 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F746G-DISCOVERY/main.c | |||
@@ -0,0 +1,81 @@ | |||
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_ARD_D13); | ||
33 | chThdSleepMilliseconds(500); | ||
34 | palClearLine(LINE_ARD_D13); | ||
35 | chThdSleepMilliseconds(500); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Application entry point. | ||
41 | */ | ||
42 | int main(void) { | ||
43 | |||
44 | /* | ||
45 | * System initializations. | ||
46 | * - HAL initialization, this also initializes the configured device drivers | ||
47 | * and performs the board-specific initializations. | ||
48 | * - Kernel initialization, the main() function becomes a thread and the | ||
49 | * RTOS is active. | ||
50 | */ | ||
51 | halInit(); | ||
52 | chSysInit(); | ||
53 | |||
54 | /* | ||
55 | * ARD_D13 is programmed as output (board LED). | ||
56 | */ | ||
57 | palClearLine(LINE_ARD_D13); | ||
58 | palSetLineMode(LINE_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL); | ||
59 | |||
60 | /* | ||
61 | * Activates the serial driver 1 using the driver default configuration. | ||
62 | */ | ||
63 | sdStart(&SD1, NULL); | ||
64 | |||
65 | /* | ||
66 | * Creates the example thread. | ||
67 | */ | ||
68 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL); | ||
69 | |||
70 | /* | ||
71 | * Normal main() thread activity, in this demo it does nothing except | ||
72 | * sleeping in a loop and check the button state. | ||
73 | */ | ||
74 | while (true) { | ||
75 | if (palReadLine(LINE_BUTTON_USER)) { | ||
76 | test_execute((BaseSequentialStream *)&SD1, &rt_test_suite); | ||
77 | test_execute((BaseSequentialStream *)&SD1, &oslib_test_suite); | ||
78 | } | ||
79 | chThdSleepMilliseconds(500); | ||
80 | } | ||
81 | } | ||