Parcourir la source

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
Zim Kalinowski il y a 4 ans
Parent
commit
6501045d80

+ 4 - 1
components/esp_common/src/brownout.c

@@ -40,7 +40,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
@@ -56,6 +56,7 @@ static void rtc_brownout_isr_handler(void *arg)
     ets_printf("\r\nBrownout detector was triggered\r\n\r\n");
     esp_restart_noos();
 }
+#endif // not SOC_BROWNOUT_RESET_SUPPORTED
 
 void esp_brownout_init(void)
 {
@@ -69,9 +70,11 @@ void esp_brownout_init(void)
 
     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) );
 
     brownout_hal_intr_enable(true);
+#endif // not SOC_BROWNOUT_RESET_SUPPORTED
 }
 
 void esp_brownout_disable(void)

+ 1 - 0
components/soc/src/esp32s2/brownout_hal.c

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