aboutsummaryrefslogtreecommitdiffstats
path: root/demos
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
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')
-rw-r--r--demos/ARMCM0-STM32F051-DISCOVERY/halconf.h2
-rw-r--r--demos/ARMCM0-STM32F051-DISCOVERY/main.c33
-rw-r--r--demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h5
3 files changed, 31 insertions, 9 deletions
diff --git a/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h b/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h
index 3ef53ed1c..91d295ccf 100644
--- a/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h
+++ b/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h
@@ -45,7 +45,7 @@
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
-#define HAL_USE_PAL FALSE
+#define HAL_USE_PAL TRUE
#endif
/**
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);
}
diff --git a/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h b/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h
index a4b019c1f..4b3fa74fd 100644
--- a/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h
+++ b/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h
@@ -52,4 +52,9 @@
#define STM32_ADCSW STM32_ADCSW_HSI14
#define STM32_ADCPRE STM32_ADCPRE_DIV4
#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
+#define STM32_ADCPRE STM32_ADCPRE_DIV4
+#define STM32_ADCSW STM32_ADCSW_HSI14
+#define STM32_CECSW STM32_CECSW_HSI
+#define STM32_I2C1SW STM32_I2C1SW_HSI
+#define STM32_USART1SW STM32_USART1SW_PCLK
#define STM32_RTCSEL STM32_RTCSEL_LSI