aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-17 17:53:57 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-17 17:53:57 +0000
commit278fc39f993660a8d7ebf4df4a89f6beb10c7f7b (patch)
tree6884853985e1a3c90e95c6361fe1704b118071df
parentbaabff16e61179d497fe986d63e325e83272d4ed (diff)
downloadChibiOS-278fc39f993660a8d7ebf4df4a89f6beb10c7f7b.tar.gz
ChibiOS-278fc39f993660a8d7ebf4df4a89f6beb10c7f7b.tar.bz2
ChibiOS-278fc39f993660a8d7ebf4df4a89f6beb10c7f7b.zip
UART driver tested with STM32L.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3330 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARMCM3-STM32L152-DISCOVERY/main.c4
-rw-r--r--os/hal/platforms/STM32/GPIOv2/pal_lld.h40
-rw-r--r--testhal/STM32L1xx/SPI/main.c6
-rw-r--r--testhal/STM32L1xx/UART/main.c4
4 files changed, 9 insertions, 45 deletions
diff --git a/demos/ARMCM3-STM32L152-DISCOVERY/main.c b/demos/ARMCM3-STM32L152-DISCOVERY/main.c
index a21d12dae..c5b0dd974 100644
--- a/demos/ARMCM3-STM32L152-DISCOVERY/main.c
+++ b/demos/ARMCM3-STM32L152-DISCOVERY/main.c
@@ -63,8 +63,8 @@ int main(void) {
* PA9 and PA10 are routed to USART1.
*/
sdStart(&SD1, NULL);
- palSetPadMode(GPIOA, 9, PAL_MODE_ALT_OUTPUT_PUSHPULL(7));
- palSetPadMode(GPIOA, 10, PAL_MODE_ALT_INPUT(7));
+ palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
+ palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
/*
* If the user button is pressed after the reset then the test suite is
diff --git a/os/hal/platforms/STM32/GPIOv2/pal_lld.h b/os/hal/platforms/STM32/GPIOv2/pal_lld.h
index 4c82141e3..6c799c14c 100644
--- a/os/hal/platforms/STM32/GPIOv2/pal_lld.h
+++ b/os/hal/platforms/STM32/GPIOv2/pal_lld.h
@@ -96,32 +96,6 @@
PAL_STM32_PUDR_PULLDOWN)
/**
- * @brief Alternate input high-Z pad.
- *
- * @param[in] n alternate function selector
- */
-#define PAL_MODE_ALT_INPUT(n) (PAL_STM32_MODE_INPUT | \
- PAL_STM32_ALTERNATE(n))
-
-/**
- * @brief Alternate input pad with weak pull up resistor.
- *
- * @param[in] n alternate function selector
- */
-#define PAL_MODE_ALT_INPUT_PULLUP(n) (PAL_STM32_MODE_INPUT | \
- PAL_STM32_PUDR_PULLUP | \
- PAL_STM32_ALTERNATE(n))
-
-/**
- * @brief Alternate input pad with weak pull down resistor.
- *
- * @param[in] n alternate function selector
- */
-#define PAL_MODE_ALT_INPUT_PULLDOWN(n) (PAL_STM32_MODE_INPUT | \
- PAL_STM32_PUDR_PULLDOWN | \
- PAL_STM32_ALTERNATE(n))
-
-/**
* @brief Analog input mode.
*/
#define PAL_MODE_INPUT_ANALOG PAL_STM32_MODE_ANALOG
@@ -139,21 +113,11 @@
PAL_STM32_OTYPE_OPENDRAIN)
/**
- * @brief Alternate push-pull output.
- *
- * @param[in] n alternate function selector
- */
-#define PAL_MODE_ALT_OUTPUT_PUSHPULL(n) (PAL_STM32_MODE_ALTERNATE | \
- PAL_STM32_OTYPE_PUSHPULL | \
- PAL_STM32_ALTERNATE(n))
-
-/**
- * @brief Alternate push-pull output.
+ * @brief Alternate function.
*
* @param[in] n alternate function selector
*/
-#define PAL_MODE_ALT_OUTPUT_OPENDRAIN(n) (PAL_STM32_MODE_ALTERNATE | \
- PAL_STM32_OTYPE_OPENDRAIN | \
+#define PAL_MODE_ALTERNATE(n) (PAL_STM32_MODE_ALTERNATE | \
PAL_STM32_ALTERNATE(n))
/*===========================================================================*/
diff --git a/testhal/STM32L1xx/SPI/main.c b/testhal/STM32L1xx/SPI/main.c
index 14e97bd20..7a96f0e22 100644
--- a/testhal/STM32L1xx/SPI/main.c
+++ b/testhal/STM32L1xx/SPI/main.c
@@ -110,10 +110,10 @@ int main(void) {
*/
palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL |
PAL_STM32_OSPEED_HIGHEST); /* NSS. */
- palSetPadMode(GPIOB, 13, PAL_MODE_ALT_OUTPUT_PUSHPULL(5) |
+ palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* SCK. */
- palSetPadMode(GPIOB, 14, PAL_MODE_ALT_INPUT(5)); /* MISO. */
- palSetPadMode(GPIOB, 15, PAL_MODE_ALT_OUTPUT_PUSHPULL(5) |
+ palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5)); /* MISO. */
+ palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* MOSI. */
palSetPad(GPIOB, 12);
diff --git a/testhal/STM32L1xx/UART/main.c b/testhal/STM32L1xx/UART/main.c
index 1039b781d..30f4c3326 100644
--- a/testhal/STM32L1xx/UART/main.c
+++ b/testhal/STM32L1xx/UART/main.c
@@ -129,8 +129,8 @@ int main(void) {
* PA9 and PA10 are routed to USART1.
*/
uartStart(&UARTD1, &uart_cfg_1);
- palSetPadMode(GPIOA, 9, PAL_MODE_ALT_OUTPUT_PUSHPULL(7));
- palSetPadMode(GPIOA, 10, PAL_MODE_ALT_INPUT(7));
+ palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
+ palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
/*
* Starts the transmission, it will be handled entirely in background.