mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-28 12:46:48 +08:00
feat(pm): refactor power management according to IDF
This commit is contained in:
@ -46,7 +46,7 @@ typedef enum {
|
||||
} esp_sleep_source_t;
|
||||
|
||||
/**
|
||||
* @brief Set the chip to deep-sleep mode.
|
||||
* @brief Enter deep-sleep mode.
|
||||
*
|
||||
* The device will automatically wake up after the deep-sleep time set
|
||||
* by the users. Upon waking up, the device boots up from user_init.
|
||||
@ -56,6 +56,9 @@ typedef enum {
|
||||
* @attention 2. system_deep_sleep(0): there is no wake up timer; in order to wake
|
||||
* up, connect a GPIO to pin RST, the chip will wake up by a falling-edge
|
||||
* on pin RST
|
||||
* @attention 3. esp_deep_sleep does not shut down WiFi and higher level protocol
|
||||
* connections gracefully. Make sure esp_wifi_stop are called to close any
|
||||
* connections and deinitialize the peripherals.
|
||||
*
|
||||
* @param time_in_us deep-sleep time, unit: microsecond
|
||||
*
|
||||
@ -63,6 +66,15 @@ typedef enum {
|
||||
*/
|
||||
void esp_deep_sleep(uint32_t time_in_us);
|
||||
|
||||
/**
|
||||
* @brief Set implementation-specific power management configuration
|
||||
* @param config pointer to implementation-specific configuration structure (e.g. esp_pm_config_esp32)
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_ARG if the configuration values are not correct
|
||||
* - ESP_ERR_NOT_SUPPORTED if certain combination of values is not supported.
|
||||
*/
|
||||
esp_err_t esp_pm_configure(const void* config);
|
||||
|
||||
/**
|
||||
* @brief Call this API before esp_deep_sleep and esp_wifi_init to set the activity after the
|
||||
@ -207,9 +219,12 @@ esp_err_t esp_sleep_enable_timer_wakeup(uint32_t time_in_us);
|
||||
/**
|
||||
* @brief Enter light sleep with the configured wakeup options
|
||||
*
|
||||
* @attention esp_deep_sleep does not shut down WiFi and higher level protocol
|
||||
* connections gracefully. Make sure esp_wifi_stop are called to close any
|
||||
* connections and deinitialize the peripherals.
|
||||
* @return
|
||||
* - ESP_OK on success (returned after wakeup)
|
||||
* - ESP_ERR_INVALID_STATE if WiFi or BT is not stopped
|
||||
* - ESP_ERR_INVALID_STATE if WiFi is not stopped
|
||||
*/
|
||||
esp_err_t esp_light_sleep_start(void);
|
||||
|
||||
|
@ -977,6 +977,16 @@ esp_err_t esp_wifi_get_event_mask(uint32_t *mask);
|
||||
*/
|
||||
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
|
||||
|
||||
/**
|
||||
* @brief Operation system start check time and enter sleep
|
||||
*
|
||||
* @note This function is called by system, user should not call this
|
||||
*
|
||||
* @return
|
||||
* - wifi state
|
||||
*/
|
||||
wifi_state_t esp_wifi_get_state(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -184,12 +184,31 @@ typedef struct {
|
||||
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */
|
||||
} wifi_fast_scan_threshold_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_STATE_DEINIT=0,
|
||||
WIFI_STATE_INIT,
|
||||
WIFI_STATE_START
|
||||
}wifi_state_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_PS_NONE, /**< No power save */
|
||||
WIFI_PS_MAX_MODEM, /**< Maximum modem power saving. In this mode, station close cpu and RF in DTIM period */
|
||||
WIFI_PS_MIN_MODEM, /**< Minimum modem power saving. In this mode, station close RF in DTIM period */
|
||||
WIFI_PS_MIN_MODEM, /**< Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period */
|
||||
WIFI_PS_MAX_MODEM, /**< Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval
|
||||
parameter in wifi_sta_config_t.
|
||||
Attention: Using this option may cause ping failures. Not recommended */
|
||||
} wifi_ps_type_t;
|
||||
|
||||
/**
|
||||
* @brief Power management config for ESP8266
|
||||
*
|
||||
* Pass a pointer to this structure as an argument to esp_pm_configure function.
|
||||
*/
|
||||
typedef struct {
|
||||
int max_freq_mhz; /*!< Not used in ESP8266 */
|
||||
int min_freq_mhz; /*!< Not used in ESP8266 */
|
||||
bool light_sleep_enable; /*!< Enter light sleep when no locks are taken */
|
||||
} esp_pm_config_esp8266_t;
|
||||
|
||||
#define WIFI_PS_MODEM WIFI_PS_MIN_MODEM /**< @deprecated Use WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM instead */
|
||||
|
||||
#define WIFI_PROTOCOL_11B 1
|
||||
|
@ -175,6 +175,22 @@ esp_err_t esp_wifi_internal_set_log_mod(uint32_t submodule);
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_mod);
|
||||
|
||||
/**
|
||||
* @brief Receive broadcast/multicast packet or not when WiFi in power save.
|
||||
*
|
||||
* @param enable receive broadcast/multicast packet when set to true.
|
||||
*/
|
||||
void esp_wifi_set_pm_recv_multi_data(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Receive broadcast/multicast packet or not when WiFi in power save
|
||||
*
|
||||
* @return
|
||||
* - true: receive broadcast/multicast packet or not when WiFi in power save
|
||||
* - false: drop broadcast/multicast packet or not when WiFi in power save
|
||||
*/
|
||||
bool esp_wifi_get_pm_recv_multi_data(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user