diff options
Diffstat (limited to 'demos/rt/RT-STM32F303-DISCOVERY/main.c')
-rw-r--r-- | demos/rt/RT-STM32F303-DISCOVERY/main.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/demos/rt/RT-STM32F303-DISCOVERY/main.c b/demos/rt/RT-STM32F303-DISCOVERY/main.c index 72b3994bc..b3e7c37f6 100644 --- a/demos/rt/RT-STM32F303-DISCOVERY/main.c +++ b/demos/rt/RT-STM32F303-DISCOVERY/main.c @@ -18,12 +18,11 @@ #include "hal.h"
#include "test.h"
-#if 0
/*
- * This is a periodic thread that does absolutely nothing except flashing LEDs.
+ * Flasher thread #1.
*/
-static WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_WORKING_AREA(waThread1, 128);
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
@@ -54,31 +53,40 @@ static msg_t Thread1(void *arg) { palClearPad(GPIOE, GPIOE_LED4_BLUE);
}
}
-#endif
-static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+/*
+ * Flasher thread #2.
+ */
+static THD_WORKING_AREA(waThread2, 128);
+static THD_FUNCTION(Thread2, arg) {
(void)arg;
- chRegSetThreadName("blinker1");
+ chRegSetThreadName("blinker");
while (true) {
palSetPad(GPIOE, GPIOE_LED3_RED);
- chThdSleepMilliseconds(250);
+ chThdSleepMilliseconds(125);
palClearPad(GPIOE, GPIOE_LED3_RED);
- chThdSleepMilliseconds(250);
- }
-}
-
-static THD_WORKING_AREA(waThread2, 128);
-static msg_t Thread2(void *arg) {
-
- (void)arg;
- chRegSetThreadName("blinker2");
- while (true) {
+ palSetPad(GPIOE, GPIOE_LED5_ORANGE);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED5_ORANGE);
+ palSetPad(GPIOE, GPIOE_LED7_GREEN);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED7_GREEN);
+ palSetPad(GPIOE, GPIOE_LED9_BLUE);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED9_BLUE);
+ palSetPad(GPIOE, GPIOE_LED10_RED);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED10_RED);
+ palSetPad(GPIOE, GPIOE_LED8_ORANGE);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED8_ORANGE);
+ palSetPad(GPIOE, GPIOE_LED6_GREEN);
+ chThdSleepMilliseconds(125);
+ palClearPad(GPIOE, GPIOE_LED6_GREEN);
palSetPad(GPIOE, GPIOE_LED4_BLUE);
- chThdSleepMilliseconds(500);
+ chThdSleepMilliseconds(125);
palClearPad(GPIOE, GPIOE_LED4_BLUE);
- chThdSleepMilliseconds(500);
}
}
@@ -109,7 +117,7 @@ int main(void) { * Creates the example thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL);
- chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO+2, Thread2, NULL);
+ chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO+1, Thread2, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
|