Code: Select all
void pm_auto_light_sleep_init(void)
{
#if CONFIG_PM_ENABLE
// Configure dynamic frequency scaling:
// maximum and minimum frequencies are set in sdkconfig,
// automatic light sleep is enabled if tickless idle support is enabled.
esp_pm_config_esp32_t pm_config = {
.max_freq_mhz = CONFIG_EXAMPLE_MAX_CPU_FREQ_MHZ, /* 最大CPU时钟频率 */
.min_freq_mhz = CONFIG_EXAMPLE_MIN_CPU_FREQ_MHZ, /* 没有频率锁定时使用的最小CPU频率 */
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
.light_sleep_enable = true /* 如果启用了无滴答空闲支持,则会启用自动浅睡眠 */
#endif
};
ESP_ERROR_CHECK( esp_pm_configure(&pm_config) );
deb_print(DBG_SOCK, "pm init\n");
#endif // CONFIG_PM_ENABLE
return;
}