mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
feat(openthread): use apb_freq_max mode for esp_openthread_sleep pm lock
This commit is contained in:
@@ -19,10 +19,12 @@ esp_err_t esp_openthread_sleep_init(void)
|
|||||||
{
|
{
|
||||||
esp_err_t err = ESP_OK;
|
esp_err_t err = ESP_OK;
|
||||||
|
|
||||||
err = esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "ieee802154", &s_pm_lock);
|
// Here we use APB_MAX because modem requires MODEM_REQUIRED_MIN_APB_CLK_FREQ.
|
||||||
|
// No need for CPU_MAX to reduce current consumption during Rx window.
|
||||||
|
err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "ot_sleep", &s_pm_lock);
|
||||||
if (err == ESP_OK) {
|
if (err == ESP_OK) {
|
||||||
esp_pm_lock_acquire(s_pm_lock);
|
esp_pm_lock_acquire(s_pm_lock);
|
||||||
ESP_LOGI(TAG, "Enable ieee802154 light sleep, the wake up source is ESP timer");
|
ESP_LOGI(TAG, "Enable OpenThread light sleep, the wake up source is ESP timer");
|
||||||
} else {
|
} else {
|
||||||
if (s_pm_lock != NULL) {
|
if (s_pm_lock != NULL) {
|
||||||
esp_pm_lock_delete(s_pm_lock);
|
esp_pm_lock_delete(s_pm_lock);
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "esp_openthread_netif_glue.h"
|
#include "esp_openthread_netif_glue.h"
|
||||||
#include "esp_ot_sleepy_device_config.h"
|
#include "esp_ot_sleepy_device_config.h"
|
||||||
#include "esp_vfs_eventfd.h"
|
#include "esp_vfs_eventfd.h"
|
||||||
|
#include "esp_private/esp_clk.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "openthread/logging.h"
|
#include "openthread/logging.h"
|
||||||
@@ -192,7 +193,7 @@ static esp_err_t ot_power_save_init(void)
|
|||||||
|
|
||||||
esp_pm_config_t pm_config = {
|
esp_pm_config_t pm_config = {
|
||||||
.max_freq_mhz = cur_cpu_freq_mhz,
|
.max_freq_mhz = cur_cpu_freq_mhz,
|
||||||
.min_freq_mhz = cur_cpu_freq_mhz,
|
.min_freq_mhz = esp_clk_xtal_freq() / MHZ,
|
||||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||||
.light_sleep_enable = true
|
.light_sleep_enable = true
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user