diff options
Diffstat (limited to 'src/stm32/serial.c')
-rw-r--r-- | src/stm32/serial.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/stm32/serial.c b/src/stm32/serial.c index 0e57a986..b0cb1f55 100644 --- a/src/stm32/serial.c +++ b/src/stm32/serial.c @@ -13,35 +13,29 @@ // 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", "PA14,PA15"); -#define GPIO_Rx GPIO('A', 14) -#define GPIO_Tx GPIO('A', 15) -#define USARTx USART2b -#define USARTx_IRQn USART2_IRQn -#elif CONFIG_SERIAL_PORT == 103 -DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD9,PD8"); -#define GPIO_Rx GPIO('D', 9) -#define GPIO_Tx GPIO('D', 8) -#define USARTx USART3 -#define USARTx_IRQn USART3_IRQn -#else -DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10"); -#define GPIO_Rx GPIO('B', 11) -#define GPIO_Tx GPIO('B', 10) -#define USARTx USART3 -#define USARTx_IRQn USART3_IRQn + 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 == 3 + #if STM32_SERIAL_USART3_ALT + DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD9,PD8"); + #define GPIO_Rx GPIO('D', 9) + #define GPIO_Tx GPIO('D', 8) + #else + DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10"); + #define GPIO_Rx GPIO('B', 11) + #define GPIO_Tx GPIO('B', 10) + #endif + #define USARTx USART3 + #define USARTx_IRQn USART3_IRQn #endif #define CR1_FLAGS (USART_CR1_UE | USART_CR1_RE | USART_CR1_TE \ |