From ba01b11a39f178169fe1517458cbfc9c3f5f9a0f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 May 2012 12:28:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4214 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM0-STM32F051-DISCOVERY/halconf.h | 2 +- demos/ARMCM0-STM32F051-DISCOVERY/main.c | 12 ++++++++++-- demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'demos') diff --git a/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h b/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h index 91d295ccf..c9b3ad25a 100644 --- a/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h +++ b/demos/ARMCM0-STM32F051-DISCOVERY/halconf.h @@ -129,7 +129,7 @@ * @brief Enables the SERIAL subsystem. */ #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL FALSE +#define HAL_USE_SERIAL TRUE #endif /** diff --git a/demos/ARMCM0-STM32F051-DISCOVERY/main.c b/demos/ARMCM0-STM32F051-DISCOVERY/main.c index 11b58a39d..5af0813e9 100644 --- a/demos/ARMCM0-STM32F051-DISCOVERY/main.c +++ b/demos/ARMCM0-STM32F051-DISCOVERY/main.c @@ -69,6 +69,14 @@ int main(void) { halInit(); chSysInit(); + /* + * Activates the serial driver 1 using the driver default configuration. + * PA9 and PA10 are routed to USART1. + */ + sdStart(&SD1, NULL); + palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(1)); /* USART1 TX. */ + palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(1)); /* USART1 RX. */ + /* * Creates the blinker threads. */ @@ -82,8 +90,8 @@ int main(void) { * driver 1. */ while (TRUE) { - /*if (palReadPad(GPIOA, GPIOA_BUTTON)) - TestThread(&SD1);*/ + 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 4b3fa74fd..3ee724511 100644 --- a/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h +++ b/demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h @@ -58,3 +58,11 @@ #define STM32_I2C1SW STM32_I2C1SW_HSI #define STM32_USART1SW STM32_USART1SW_PCLK #define STM32_RTCSEL STM32_RTCSEL_LSI + +/* + * SERIAL driver system settings. + */ +#define STM32_SERIAL_USE_USART1 TRUE +#define STM32_SERIAL_USE_USART2 FALSE +#define STM32_SERIAL_USART1_PRIORITY 3 +#define STM32_SERIAL_USART2_PRIORITY 3 -- cgit v1.2.3