From 01a811d27f05c73904200aaeaf618ed657b65283 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 May 2012 15:29:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4206 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM0-STM32F051-DISCOVERY/halconf.h | 2 +- demos/ARMCM0-STM32F051-DISCOVERY/main.c | 33 ++++++++++++++++++++++-------- demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h | 5 +++++ 3 files changed, 31 insertions(+), 9 deletions(-) (limited to 'demos') 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 -- cgit v1.2.3