mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 09:37:00 +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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -71,21 +71,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver was not installed by esp_wifi_init */
|
||||
#define ESP_ERR_WIFI_NOT_STARTED (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver was not started by esp_wifi_start */
|
||||
#define ESP_ERR_WIFI_NOT_STOPPED (ESP_ERR_WIFI_BASE + 3) /*!< WiFi driver was not stopped by esp_wifi_stop */
|
||||
#define ESP_ERR_WIFI_IF (ESP_ERR_WIFI_BASE + 4) /*!< WiFi interface error */
|
||||
#define ESP_ERR_WIFI_MODE (ESP_ERR_WIFI_BASE + 5) /*!< WiFi mode error */
|
||||
#define ESP_ERR_WIFI_STATE (ESP_ERR_WIFI_BASE + 6) /*!< WiFi internal state error */
|
||||
#define ESP_ERR_WIFI_CONN (ESP_ERR_WIFI_BASE + 7) /*!< WiFi internal control block of station or soft-AP error */
|
||||
#define ESP_ERR_WIFI_NVS (ESP_ERR_WIFI_BASE + 8) /*!< WiFi internal NVS module error */
|
||||
#define ESP_ERR_WIFI_MAC (ESP_ERR_WIFI_BASE + 9) /*!< MAC address is invalid */
|
||||
#define ESP_ERR_WIFI_SSID (ESP_ERR_WIFI_BASE + 10) /*!< SSID is invalid */
|
||||
#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 11) /*!< Password is invalid */
|
||||
#define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 12) /*!< Timeout error */
|
||||
#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_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver was not installed by esp_wifi_init */
|
||||
#define ESP_ERR_WIFI_NOT_STARTED (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver was not started by esp_wifi_start */
|
||||
#define ESP_ERR_WIFI_NOT_STOPPED (ESP_ERR_WIFI_BASE + 3) /*!< WiFi driver was not stopped by esp_wifi_stop */
|
||||
#define ESP_ERR_WIFI_IF (ESP_ERR_WIFI_BASE + 4) /*!< WiFi interface error */
|
||||
#define ESP_ERR_WIFI_MODE (ESP_ERR_WIFI_BASE + 5) /*!< WiFi mode error */
|
||||
#define ESP_ERR_WIFI_STATE (ESP_ERR_WIFI_BASE + 6) /*!< WiFi internal state error */
|
||||
#define ESP_ERR_WIFI_CONN (ESP_ERR_WIFI_BASE + 7) /*!< WiFi internal control block of station or soft-AP error */
|
||||
#define ESP_ERR_WIFI_NVS (ESP_ERR_WIFI_BASE + 8) /*!< WiFi internal NVS module error */
|
||||
#define ESP_ERR_WIFI_MAC (ESP_ERR_WIFI_BASE + 9) /*!< MAC address is invalid */
|
||||
#define ESP_ERR_WIFI_SSID (ESP_ERR_WIFI_BASE + 10) /*!< SSID is invalid */
|
||||
#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 11) /*!< Password is invalid */
|
||||
#define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 12) /*!< Timeout error */
|
||||
#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