Skip to content

Commit

Permalink
FuriHal: remove clock startup time tracking from clean builds (#2764)
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Jun 13, 2023
1 parent 4900e8b commit 392bd3c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions firmware/targets/f7/furi_hal/furi_hal_clock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <furi_hal_clock.h>
#include <furi_hal_resources.h>
#include <furi_hal_rtc.h>
#include <furi.h>

#include <stm32wbxx_ll_pwr.h>
Expand Down Expand Up @@ -143,7 +142,10 @@ void furi_hal_clock_switch_to_hsi() {
}

void furi_hal_clock_switch_to_pll() {
#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t clock_start_time = DWT->CYCCNT;
#endif

LL_RCC_HSE_Enable();
LL_RCC_PLL_Enable();
LL_RCC_PLLSAI1_Enable();
Expand All @@ -166,11 +168,12 @@ void furi_hal_clock_switch_to_pll() {
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
;

#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t total = DWT->CYCCNT - clock_start_time;
if(total > (20 * 0x148)) {
furi_hal_rtc_set_flag(FuriHalRtcFlagLegacySleep);
furi_crash("Slow HSE/PLL startup");
}
#endif
}

void furi_hal_clock_suspend_tick() {
Expand Down

0 comments on commit 392bd3c

Please sign in to comment.