diff options
Diffstat (limited to 'demos/ARMCM0-STM32F051-DISCOVERY')
-rw-r--r-- | demos/ARMCM0-STM32F051-DISCOVERY/halconf.h | 2 | ||||
-rw-r--r-- | demos/ARMCM0-STM32F051-DISCOVERY/main.c | 12 | ||||
-rw-r--r-- | demos/ARMCM0-STM32F051-DISCOVERY/mcuconf.h | 8 |
3 files changed, 19 insertions, 3 deletions
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 @@ -70,6 +70,14 @@ int main(void) { 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.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
@@ -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
|