deep_sleep: on S2 disable the brown out detector before deep sleeping

On S2 the brown out detector would occasionally trigger erroneously during deep sleep.

Disable it before sleeping to circumvent this issue.

Closes https://github.com/espressif/esp-idf/issues/6179
This commit is contained in:
Marius Vikhammer
2021-02-09 19:30:43 +08:00
parent 8e187e7157
commit c6ed522d60
6 changed files with 56 additions and 2 deletions

View File

@@ -85,3 +85,18 @@ void esp_brownout_init(void)
brownout_hal_intr_enable(true);
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
}
void esp_brownout_disable(void)
{
brownout_hal_config_t cfg = {
.enabled = false,
};
brownout_hal_config(&cfg);
#ifndef SOC_BROWNOUT_RESET_SUPPORTED
brownout_hal_intr_enable(false);
rtc_isr_deregister(rtc_brownout_isr_handler, NULL);
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
}