aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM0-STM32F051-DISCOVERY/main.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-18 15:29:20 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-18 15:29:20 +0000
commit01a811d27f05c73904200aaeaf618ed657b65283 (patch)
treeb323e7d1c278130c57ab26ff9cc3c708adefc751 /demos/ARMCM0-STM32F051-DISCOVERY/main.c
parentc4a3d44d53f667cc73abf655542b2974a9b0bb93 (diff)
downloadChibiOS-01a811d27f05c73904200aaeaf618ed657b65283.tar.gz
ChibiOS-01a811d27f05c73904200aaeaf618ed657b65283.tar.bz2
ChibiOS-01a811d27f05c73904200aaeaf618ed657b65283.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4206 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM0-STM32F051-DISCOVERY/main.c')
-rw-r--r--demos/ARMCM0-STM32F051-DISCOVERY/main.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/demos/ARMCM0-STM32F051-DISCOVERY/main.c b/demos/ARMCM0-STM32F051-DISCOVERY/main.c
index 714528555..11b58a39d 100644
--- a/demos/ARMCM0-STM32F051-DISCOVERY/main.c
+++ b/demos/ARMCM0-STM32F051-DISCOVERY/main.c
@@ -23,18 +23,34 @@
#include "test.h"
/*
- * This is a periodic thread that does absolutely nothing except increasing
- * a seconds counter.
+ * Blue LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
- static uint32_t seconds_counter;
(void)arg;
- chRegSetThreadName("counter");
+ chRegSetThreadName("blinker1");
while (TRUE) {
- chThdSleepMilliseconds(1000);
- seconds_counter++;
+ palClearPad(GPIOC, GPIOC_LED4);
+ chThdSleepMilliseconds(500);
+ palSetPad(GPIOC, GPIOC_LED4);
+ chThdSleepMilliseconds(500);
+ }
+}
+
+/*
+ * Green LED blinker thread, times are in milliseconds.
+ */
+static WORKING_AREA(waThread2, 128);
+static msg_t Thread2(void *arg) {
+
+ (void)arg;
+ chRegSetThreadName("blinker2");
+ while (TRUE) {
+ palClearPad(GPIOC, GPIOC_LED3);
+ chThdSleepMilliseconds(250);
+ palSetPad(GPIOC, GPIOC_LED3);
+ chThdSleepMilliseconds(250);
}
}
@@ -54,9 +70,10 @@ int main(void) {
chSysInit();
/*
- * Creates the example thread.
+ * Creates the blinker threads.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+ chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
@@ -65,7 +82,7 @@ int main(void) {
* driver 1.
*/
while (TRUE) {
-/* if (palReadPad(GPIOA, GPIOA_BUTTON))
+ /*if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);*/
chThdSleepMilliseconds(500);
}