mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-31 15:41:02 +08:00
feat(lib): refactor gpio wakeup api in force sleep mode
This commit is contained in:
@ -162,9 +162,10 @@ void esp_wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
|
||||
* - if wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by GPIO.
|
||||
* - if wifi_fpm_set_sleep_type is set to be MODEM_SLEEP_T, ESP8266 can wake up by wifi_fpm_do_wakeup.
|
||||
*
|
||||
* @return 0, setting succeed;
|
||||
* @return -1, fail to sleep, sleep status error;
|
||||
* @return -2, fail to sleep, force sleep function is not enabled.
|
||||
* @return ESP_OK, setting succeed;
|
||||
* @return ESP_ERR_WIFI_FPM_MODE, fail to sleep, force sleep function is not enabled.
|
||||
* @return ESP_ERR_WIFI_PM_MODE_OPEN, fail to sleep, Please call esp_wifi_set_ps(WIFI_PS_NONE) first.
|
||||
* @return ESP_ERR_WIFI_MODE, fail to sleep, Please call esp_wifi_set_mode(WIFI_MODE_NULL) first.
|
||||
*/
|
||||
esp_err_t esp_wifi_fpm_do_sleep(uint32_t sleep_time_in_us);
|
||||
|
||||
@ -188,6 +189,34 @@ void esp_wifi_fpm_set_sleep_type(wifi_sleep_type_t type);
|
||||
*/
|
||||
wifi_sleep_type_t esp_wifi_fpm_get_sleep_type(void);
|
||||
|
||||
/**
|
||||
* @brief Set a GPIO to wake the ESP8266 up from light-sleep mode
|
||||
* ESP8266 will be wakened from Light-sleep, when the GPIO is in low-level.
|
||||
*
|
||||
* If the ESP8266 enters light-sleep automatically(esp_wifi_set_sleep_type(LIGHT_SLEEP_T);),
|
||||
* after being waken up by GPIO, when the chip attempts to sleep again, it will check the status of the GPIO:
|
||||
* Note:
|
||||
* • If the GPIO is still in the wakeup status, the EP8266 will enter modem-sleep mode instead;
|
||||
* • If the GPIO is NOT in the wakeup status, the ESP8266 will enter light-sleep mode
|
||||
*
|
||||
* @param uint32_t gpio_num: GPIO number, range: [0, 15].
|
||||
* gpio_int_type_t intr_status: status of GPIO interrupt to trigger the wakeup process.
|
||||
* - if esp_wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by GPIO.
|
||||
* - if esp_wifi_fpm_set_sleep_type is set to be MODEM_SLEEP_T, ESP8266 can wake up by esp_wifi_fpm_do_wakeup.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void esp_wifi_enable_gpio_wakeup(uint32_t gpio_num, gpio_int_type_t intr_status);
|
||||
|
||||
/**
|
||||
* @brief Disable the function that the GPIO can wake the ESP8266 up from light-sleep mode.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void esp_wifi_disable_gpio_wakeup(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -86,6 +86,8 @@ extern "C" {
|
||||
#define ESP_ERR_WIFI_WAKE_FAIL (ESP_ERR_WIFI_BASE + 13) /*!< WiFi is in sleep state(RF closed) and wakeup fail */
|
||||
#define ESP_ERR_WIFI_WOULD_BLOCK (ESP_ERR_WIFI_BASE + 14) /*!< The caller would block */
|
||||
#define ESP_ERR_WIFI_NOT_CONNECT (ESP_ERR_WIFI_BASE + 15) /*!< Station still in disconnect status */
|
||||
#define ESP_ERR_WIFI_PM_MODE_OPEN (ESP_ERR_WIFI_BASE + 18) /*!< Wifi is in min/max modem sleep mode */
|
||||
#define ESP_ERR_WIFI_FPM_MODE (ESP_ERR_WIFI_BASE + 19) /*!< Have not enable fpm mode */
|
||||
|
||||
#define ESP_WIFI_PARAM_USE_NVS 0
|
||||
|
||||
|
Reference in New Issue
Block a user