diff --git a/lib/stm32/common/usart_common_all.c b/lib/stm32/common/usart_common_all.c index 4e42f2a9..5c411779 100644 --- a/lib/stm32/common/usart_common_all.c +++ b/lib/stm32/common/usart_common_all.c @@ -50,13 +50,12 @@ void usart_set_baudrate(uint32_t usart, uint32_t baud) { uint32_t clock = rcc_apb1_frequency; -#if defined STM32F2 || defined STM32F4 - if ((usart == USART1) || - (usart == USART6)) { - clock = rcc_apb2_frequency; - } -#else - if (usart == USART1) { +#if defined USART1 + if ((usart == USART1) +#if defined USART6 + || (usart == USART6) +#endif + ) { clock = rcc_apb2_frequency; } #endif