File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -784,25 +784,25 @@ void uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
784
784
return ;
785
785
}
786
786
UART_MUTEX_LOCK ();
787
- uint32_t sclk_freq ;
788
- if (uart_get_sclk_freq (UART_SCLK_DEFAULT , & sclk_freq ) == ESP_OK ) {
789
- uart_ll_set_baudrate (UART_LL_GET_HW (uart -> num ), baud_rate , sclk_freq );
787
+ if (uart_set_baudrate (uart -> num , baud_rate ) == ESP_OK ) {
788
+ uart -> _baudrate = baud_rate ;
789
+ } else {
790
+ log_e ("Setting UART%d baud rate to %d has failed." , uart -> num , baud_rate );
790
791
}
791
- uart -> _baudrate = baud_rate ;
792
792
UART_MUTEX_UNLOCK ();
793
793
}
794
794
795
795
uint32_t uartGetBaudRate (uart_t * uart ) {
796
796
uint32_t baud_rate = 0 ;
797
- uint32_t sclk_freq ;
798
797
799
798
if (uart == NULL ) {
800
799
return 0 ;
801
800
}
802
801
803
802
UART_MUTEX_LOCK ();
804
- if (uart_get_sclk_freq (UART_SCLK_DEFAULT , & sclk_freq ) == ESP_OK ) {
805
- baud_rate = uart_ll_get_baudrate (UART_LL_GET_HW (uart -> num ), sclk_freq );
803
+ if (uart_get_baudrate (uart -> num , & baud_rate ) != ESP_OK ) {
804
+ log_e ("Getting UART%d baud rate has failed." , uart -> num );
805
+ baud_rate = (uint32_t ) -1 ; // return value when failed
806
806
}
807
807
UART_MUTEX_UNLOCK ();
808
808
return baud_rate ;
You can’t perform that action at this time.
0 commit comments