mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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:
commit
6501045d80
@ -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)
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user