stm32/modmachine: Get machine.sleep working on F0 MCUs.

pull/3989/merge
Damien George 2018-07-31 17:25:53 +10:00
rodzic 9dfbb6cc16
commit 21dae87710
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -524,6 +524,20 @@ STATIC mp_obj_t machine_sleep(void) {
// reconfigure the system clock after waking up
#if defined(STM32F0)
// Enable HSI48
__HAL_RCC_HSI48_ENABLE();
while (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSI48RDY)) {
}
// Select HSI48 as system clock source
MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_SYSCLKSOURCE_HSI48);
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_HSI48) {
}
#else
// enable HSE
__HAL_RCC_HSE_CONFIG(MICROPY_HW_CLK_HSE_STATE);
while (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY)) {
@ -545,6 +559,8 @@ STATIC mp_obj_t machine_sleep(void) {
#endif
#endif
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_sleep_obj, machine_sleep);