mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-28 12:10:45 +00:00
esp32c3: Adds support BROWNOUT reset
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
#define BROWNOUT_DET_LVL CONFIG_ESP32_BROWNOUT_DET_LVL
|
||||
#elif defined(CONFIG_ESP32S2_BROWNOUT_DET_LVL)
|
||||
#define BROWNOUT_DET_LVL CONFIG_ESP32S2_BROWNOUT_DET_LVL
|
||||
#elif defined(CONFIG_ESP32S3_BROWNOUT_DET_LVL)
|
||||
#define BROWNOUT_DET_LVL CONFIG_ESP32S3_BROWNOUT_DET_LVL
|
||||
#elif defined(CONFIG_ESP32C3_BROWNOUT_DET_LVL)
|
||||
#define BROWNOUT_DET_LVL CONFIG_ESP32C3_BROWNOUT_DET_LVL
|
||||
#else
|
||||
#define BROWNOUT_DET_LVL 0
|
||||
#endif
|
||||
@@ -45,7 +49,7 @@
|
||||
#define BROWNOUT_RESET_EN false
|
||||
#endif // SOC_BROWNOUT_RESET_SUPPORTED
|
||||
|
||||
|
||||
#ifndef SOC_BROWNOUT_RESET_SUPPORTED
|
||||
static void rtc_brownout_isr_handler(void *arg)
|
||||
{
|
||||
/* Normally RTC ISR clears the interrupt flag after the application-supplied
|
||||
@@ -61,6 +65,7 @@ static void rtc_brownout_isr_handler(void *arg)
|
||||
esp_rom_printf("\r\nBrownout detector was triggered\r\n\r\n");
|
||||
esp_restart_noos();
|
||||
}
|
||||
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
|
||||
|
||||
void esp_brownout_init(void)
|
||||
{
|
||||
@@ -74,7 +79,9 @@ void esp_brownout_init(void)
|
||||
|
||||
brownout_hal_config(&cfg);
|
||||
|
||||
#ifndef SOC_BROWNOUT_RESET_SUPPORTED
|
||||
rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M);
|
||||
|
||||
brownout_hal_intr_enable(true);
|
||||
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user