Merge branch 'feature/esp32c3_support_brownout_v4.2' into 'release/v4.2'

esp32c3: Adds support BROWNOUT reset (v4.2)

See merge request espressif/esp-idf!14963
This commit is contained in:
Zim Kalinowski 2021-09-23 15:16:23 +00:00
commit 6501045d80
2 changed files with 5 additions and 1 deletions

View File

@ -40,7 +40,7 @@
#define BROWNOUT_RESET_EN false #define BROWNOUT_RESET_EN false
#endif // SOC_BROWNOUT_RESET_SUPPORTED #endif // SOC_BROWNOUT_RESET_SUPPORTED
#ifndef SOC_BROWNOUT_RESET_SUPPORTED
static void rtc_brownout_isr_handler(void *arg) static void rtc_brownout_isr_handler(void *arg)
{ {
/* Normally RTC ISR clears the interrupt flag after the application-supplied /* Normally RTC ISR clears the interrupt flag after the application-supplied
@ -56,6 +56,7 @@ static void rtc_brownout_isr_handler(void *arg)
ets_printf("\r\nBrownout detector was triggered\r\n\r\n"); ets_printf("\r\nBrownout detector was triggered\r\n\r\n");
esp_restart_noos(); esp_restart_noos();
} }
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
void esp_brownout_init(void) void esp_brownout_init(void)
{ {
@ -69,9 +70,11 @@ void esp_brownout_init(void)
brownout_hal_config(&cfg); brownout_hal_config(&cfg);
#ifndef SOC_BROWNOUT_RESET_SUPPORTED
ESP_ERROR_CHECK( rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M) ); ESP_ERROR_CHECK( rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M) );
brownout_hal_intr_enable(true); brownout_hal_intr_enable(true);
#endif // not SOC_BROWNOUT_RESET_SUPPORTED
} }
void esp_brownout_disable(void) void esp_brownout_disable(void)

View File

@ -31,6 +31,7 @@ void brownout_hal_config(const brownout_hal_config_t *cfg)
.rst_wait = 0x3ff, .rst_wait = 0x3ff,
.rst_ena = cfg->reset_enabled, .rst_ena = cfg->reset_enabled,
.ena = cfg->enabled, .ena = cfg->enabled,
.rst_sel = 1,
}; };
RTCCNTL.brown_out = brown_out_reg; RTCCNTL.brown_out = brown_out_reg;
} }