feat(esp8266): Add reset reason function

The function can be disable.
This commit is contained in:
Dong Heng
2018-12-07 11:02:32 +08:00
parent b0f7ff508d
commit 0f728b64de
9 changed files with 266 additions and 2 deletions

View File

@@ -28,6 +28,24 @@ typedef enum {
ESP_MAC_WIFI_SOFTAP,
} esp_mac_type_t;
/**
* @brief Reset reasons
*/
typedef enum {
ESP_RST_UNKNOWN = 0, //!< Reset reason can not be determined
ESP_RST_POWERON, //!< Reset due to power-on event
ESP_RST_EXT, //!< Reset by external pin (not applicable for ESP8266)
ESP_RST_SW, //!< Software reset via esp_restart
ESP_RST_PANIC, //!< Software reset due to exception/panic
ESP_RST_INT_WDT, //!< Reset (software or hardware) due to interrupt watchdog
ESP_RST_TASK_WDT, //!< Reset due to task watchdog
ESP_RST_WDT, //!< Reset due to other watchdogs
ESP_RST_DEEPSLEEP, //!< Reset after exiting deep sleep mode
ESP_RST_BROWNOUT, //!< Brownout reset (software or hardware)
ESP_RST_SDIO, //!< Reset over SDIO
} esp_reset_reason_t;
/**
* @brief Set base MAC address with the MAC address which is stored in EFUSE or
* external storage e.g. flash and EEPROM.
@@ -123,6 +141,12 @@ void system_restore(void) __attribute__ ((noreturn));
*/
void esp_restart(void) __attribute__ ((noreturn));
/**
* @brief Get reason of last reset
* @return See description of esp_reset_reason_t for explanation of each value.
*/
esp_reset_reason_t esp_reset_reason(void);
/**
* @brief Get the size of available heap.
*