mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
Merge branch 'ofw-dev' into dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <furi_hal_clock.h>
|
#include <furi_hal_clock.h>
|
||||||
#include <furi_hal_resources.h>
|
#include <furi_hal_resources.h>
|
||||||
|
#include <furi_hal_rtc.h>
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
|
|
||||||
#include <stm32wbxx_ll_pwr.h>
|
#include <stm32wbxx_ll_pwr.h>
|
||||||
@@ -48,6 +49,10 @@ void furi_hal_clock_init() {
|
|||||||
LL_RCC_LSI1_Enable();
|
LL_RCC_LSI1_Enable();
|
||||||
while(!LS_CLOCK_IS_READY())
|
while(!LS_CLOCK_IS_READY())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* RF wakeup */
|
||||||
|
LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE);
|
||||||
|
|
||||||
LL_EXTI_EnableIT_0_31(
|
LL_EXTI_EnableIT_0_31(
|
||||||
LL_EXTI_LINE_18); /* Why? Because that's why. See RM0434, Table 61. CPU1 vector table. */
|
LL_EXTI_LINE_18); /* Why? Because that's why. See RM0434, Table 61. CPU1 vector table. */
|
||||||
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_18);
|
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_18);
|
||||||
@@ -111,7 +116,7 @@ void furi_hal_clock_init() {
|
|||||||
|
|
||||||
LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_PLLSAI1);
|
LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_PLLSAI1);
|
||||||
LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0
|
LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0
|
||||||
LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSE);
|
LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSI);
|
||||||
LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1);
|
LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1);
|
||||||
LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE);
|
LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE);
|
||||||
|
|
||||||
@@ -124,8 +129,8 @@ void furi_hal_clock_switch_to_hsi() {
|
|||||||
while(!LL_RCC_HSI_IsReady())
|
while(!LL_RCC_HSI_IsReady())
|
||||||
;
|
;
|
||||||
|
|
||||||
LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSI);
|
|
||||||
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI);
|
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI);
|
||||||
|
furi_assert(LL_RCC_GetSMPSClockSource() == LL_RCC_SMPS_CLKSOURCE_HSI);
|
||||||
|
|
||||||
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI)
|
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI)
|
||||||
;
|
;
|
||||||
@@ -138,6 +143,7 @@ void furi_hal_clock_switch_to_hsi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void furi_hal_clock_switch_to_pll() {
|
void furi_hal_clock_switch_to_pll() {
|
||||||
|
uint32_t clock_start_time = DWT->CYCCNT;
|
||||||
LL_RCC_HSE_Enable();
|
LL_RCC_HSE_Enable();
|
||||||
LL_RCC_PLL_Enable();
|
LL_RCC_PLL_Enable();
|
||||||
LL_RCC_PLLSAI1_Enable();
|
LL_RCC_PLLSAI1_Enable();
|
||||||
@@ -156,10 +162,15 @@ void furi_hal_clock_switch_to_pll() {
|
|||||||
;
|
;
|
||||||
|
|
||||||
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||||
LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSE);
|
|
||||||
|
|
||||||
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
uint32_t total = DWT->CYCCNT - clock_start_time;
|
||||||
|
if(total > (20 * 0x148)) {
|
||||||
|
furi_hal_rtc_set_flag(FuriHalRtcFlagLegacySleep);
|
||||||
|
furi_crash("Slow HSE/PLL startup");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void furi_hal_clock_suspend_tick() {
|
void furi_hal_clock_suspend_tick() {
|
||||||
|
|||||||
@@ -84,17 +84,6 @@ class Main(App):
|
|||||||
if exists(sdk_folder := join(obj_directory, foldertype)):
|
if exists(sdk_folder := join(obj_directory, foldertype)):
|
||||||
self.note_dist_component(foldertype, "dir", sdk_folder)
|
self.note_dist_component(foldertype, "dir", sdk_folder)
|
||||||
|
|
||||||
# TODO: remove this after everyone migrates to new uFBT
|
|
||||||
self.create_zip_stub("lib")
|
|
||||||
|
|
||||||
def create_zip_stub(self, foldertype):
|
|
||||||
with zipfile.ZipFile(
|
|
||||||
self.get_dist_path(self.get_dist_file_name(foldertype, "zip")),
|
|
||||||
"w",
|
|
||||||
zipfile.ZIP_DEFLATED,
|
|
||||||
) as _:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def copy(self) -> int:
|
def copy(self) -> int:
|
||||||
self._dist_components: dict[str, str] = dict()
|
self._dist_components: dict[str, str] = dict()
|
||||||
self.projects: dict[str, ProjectDir] = dict(
|
self.projects: dict[str, ProjectDir] = dict(
|
||||||
|
|||||||
Reference in New Issue
Block a user