aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f0_serial.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-01-23 11:33:11 -0500
committerKevin O'Connor <kevin@koconnor.net>2020-01-23 11:39:40 -0500
commitaea15250aecc44f0dc977f95e434bccb8744fde4 (patch)
tree3b52fec2fdd1feba361f96ab7cd82141eb3f1949 /src/stm32/stm32f0_serial.c
parentc8a93cb3bffbb01eaae5afbb46b6f4c7df81ec2d (diff)
downloadkutter-aea15250aecc44f0dc977f95e434bccb8744fde4.tar.gz
kutter-aea15250aecc44f0dc977f95e434bccb8744fde4.tar.xz
kutter-aea15250aecc44f0dc977f95e434bccb8744fde4.zip
stm32: Only declare alternate usart2 on stm32f0
Also, try to improve the structure of the #if/#else/#endif layout in serial.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/stm32f0_serial.c')
-rw-r--r--src/stm32/stm32f0_serial.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/stm32/stm32f0_serial.c b/src/stm32/stm32f0_serial.c
index d478259b..452d66c9 100644
--- a/src/stm32/stm32f0_serial.c
+++ b/src/stm32/stm32f0_serial.c
@@ -13,23 +13,23 @@
// Select the configured serial port
#if CONFIG_SERIAL_PORT == 1
-DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA10,PA9");
-#define GPIO_Rx GPIO('A', 10)
-#define GPIO_Tx GPIO('A', 9)
-#define USARTx USART1
-#define USARTx_IRQn USART1_IRQn
+ DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA10,PA9");
+ #define GPIO_Rx GPIO('A', 10)
+ #define GPIO_Tx GPIO('A', 9)
+ #define USARTx USART1
+ #define USARTx_IRQn USART1_IRQn
#elif CONFIG_SERIAL_PORT == 2
-DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
-#define GPIO_Rx GPIO('A', 3)
-#define GPIO_Tx GPIO('A', 2)
-#define USARTx USART2
-#define USARTx_IRQn USART2_IRQn
-#elif CONFIG_SERIAL_PORT == 102
-DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
-#define GPIO_Rx GPIO('A', 15)
-#define GPIO_Tx GPIO('A', 14)
-#define USARTx USART2
-#define USARTx_IRQn USART2_IRQn
+ #if STM32_SERIAL_USART2_ALT
+ DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
+ #define GPIO_Rx GPIO('A', 15)
+ #define GPIO_Tx GPIO('A', 14)
+ #else
+ DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
+ #define GPIO_Rx GPIO('A', 3)
+ #define GPIO_Tx GPIO('A', 2)
+ #endif
+ #define USARTx USART2
+ #define USARTx_IRQn USART2_IRQn
#endif
#define CR1_FLAGS (USART_CR1_UE | USART_CR1_RE | USART_CR1_TE \