From 7f814b51977256cc7f04a45b24b1d09398982506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Mon, 15 Nov 2021 23:36:57 +0300 Subject: [PATCH] FuriHal: fix LPUART crash (#820) --- firmware/targets/f6/furi-hal/furi-hal-uart.c | 2 +- firmware/targets/f7/furi-hal/furi-hal-uart.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/targets/f6/furi-hal/furi-hal-uart.c b/firmware/targets/f6/furi-hal/furi-hal-uart.c index ff2d94a7..ff5a056b 100644 --- a/firmware/targets/f6/furi-hal/furi-hal-uart.c +++ b/firmware/targets/f6/furi-hal/furi-hal-uart.c @@ -105,7 +105,7 @@ void furi_hal_uart_set_br(FuriHalUartId ch, uint32_t baud) { // Wait for transfer complete flag while (!LL_LPUART_IsActiveFlag_TC(LPUART1)); LL_LPUART_Disable(LPUART1); - uint32_t uartclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_GetLPUARTClockSource(LL_RCC_LPUART1_CLKSOURCE_PCLK1)); + uint32_t uartclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_LPUART1_CLKSOURCE); if (uartclk/baud > 4095) { LL_LPUART_SetPrescaler(LPUART1, LL_LPUART_PRESCALER_DIV32); LL_LPUART_SetBaudRate(LPUART1, uartclk, LL_LPUART_PRESCALER_DIV32, baud); diff --git a/firmware/targets/f7/furi-hal/furi-hal-uart.c b/firmware/targets/f7/furi-hal/furi-hal-uart.c index ff2d94a7..ff5a056b 100644 --- a/firmware/targets/f7/furi-hal/furi-hal-uart.c +++ b/firmware/targets/f7/furi-hal/furi-hal-uart.c @@ -105,7 +105,7 @@ void furi_hal_uart_set_br(FuriHalUartId ch, uint32_t baud) { // Wait for transfer complete flag while (!LL_LPUART_IsActiveFlag_TC(LPUART1)); LL_LPUART_Disable(LPUART1); - uint32_t uartclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_GetLPUARTClockSource(LL_RCC_LPUART1_CLKSOURCE_PCLK1)); + uint32_t uartclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_LPUART1_CLKSOURCE); if (uartclk/baud > 4095) { LL_LPUART_SetPrescaler(LPUART1, LL_LPUART_PRESCALER_DIV32); LL_LPUART_SetBaudRate(LPUART1, uartclk, LL_LPUART_PRESCALER_DIV32, baud);