File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -711,16 +711,11 @@ uint32_t uart_get_source_freq(pyb_uart_obj_t *self) {
711
711
}
712
712
713
713
uint32_t uart_get_baudrate (pyb_uart_obj_t * self ) {
714
- // This formula assumes UART_OVERSAMPLING_16
715
- uint32_t source_freq = uart_get_source_freq (self );
716
- #if defined(LPUART1 )
717
- if (self -> uart_id == PYB_LPUART_1 ) {
718
- return source_freq / (self -> uartx -> BRR >> 8 );
719
- } else
720
- #endif
721
- {
722
- return source_freq / self -> uartx -> BRR ;
723
- }
714
+ return LL_USART_GetBaudRate (self -> uartx , uart_get_source_freq (self ),
715
+ #if defined(STM32H7 ) || defined (STM32WB )
716
+ self -> uartx -> PRESC ,
717
+ #endif
718
+ LL_USART_OVERSAMPLING_16 );
724
719
}
725
720
726
721
void uart_set_baudrate (pyb_uart_obj_t * self , uint32_t baudrate ) {
You can’t perform that action at this time.
0 commit comments