aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-13 11:24:38 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-13 11:24:38 +0000
commit1a2e19d5d6161df4c7b385bc03ed761e0e27e825 (patch)
treedee4b5a33495ffd6f8a8bea55632b32d0ca78edf /demos
parenta86b48c578db236dddea8f141db7607741d48e57 (diff)
downloadChibiOS-1a2e19d5d6161df4c7b385bc03ed761e0e27e825.tar.gz
ChibiOS-1a2e19d5d6161df4c7b385bc03ed761e0e27e825.tar.bz2
ChibiOS-1a2e19d5d6161df4c7b385bc03ed761e0e27e825.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6299 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r--demos/rt/RT-STM32F051-DISCOVERY/main.c4
-rw-r--r--demos/rt/RT-STM32F303-DISCOVERY/main.c52
-rw-r--r--demos/rt/RT-STM32F407-DISCOVERY/main.c2
3 files changed, 33 insertions, 25 deletions
diff --git a/demos/rt/RT-STM32F051-DISCOVERY/main.c b/demos/rt/RT-STM32F051-DISCOVERY/main.c
index ea6ed9f39..cc7753756 100644
--- a/demos/rt/RT-STM32F051-DISCOVERY/main.c
+++ b/demos/rt/RT-STM32F051-DISCOVERY/main.c
@@ -22,7 +22,7 @@
* Blue LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker1");
@@ -38,7 +38,7 @@ static msg_t Thread1(void *arg) {
* Green LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread2, 128);
-static msg_t Thread2(void *arg) {
+static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("blinker2");
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
diff --git a/demos/rt/RT-STM32F407-DISCOVERY/main.c b/demos/rt/RT-STM32F407-DISCOVERY/main.c
index be7c848c2..ceb144e98 100644
--- a/demos/rt/RT-STM32F407-DISCOVERY/main.c
+++ b/demos/rt/RT-STM32F407-DISCOVERY/main.c
@@ -23,7 +23,7 @@
* a LED.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");