2023-01-03 05:58:29 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hal/brownout_ll.h"
|
|
|
|
#include "hal/brownout_hal.h"
|
|
|
|
|
|
|
|
void brownout_hal_config(const brownout_hal_config_t *cfg)
|
|
|
|
{
|
2023-04-13 06:54:14 -04:00
|
|
|
// If brownout software control is enabled, hw ana reset should be disabled, because it always has the highest priority.
|
|
|
|
brownout_ll_ana_reset_enable(false);
|
2023-01-03 05:58:29 -05:00
|
|
|
brownout_ll_set_intr_wait_cycles(2);
|
2024-08-06 01:15:30 -04:00
|
|
|
brownout_ll_enable_flash_suspend(cfg->flash_power_down);
|
2023-01-03 05:58:29 -05:00
|
|
|
brownout_ll_enable_rf_power_down(cfg->rf_power_down);
|
2023-11-22 05:35:56 -05:00
|
|
|
brownout_ll_clear_count();
|
2024-08-06 01:15:30 -04:00
|
|
|
brownout_ll_reset_config(cfg->reset_enabled, 0x3ff, BROWNOUT_RESET_LEVEL_SYSTEM);
|
2023-01-03 05:58:29 -05:00
|
|
|
brownout_ll_set_threshold(cfg->threshold);
|
|
|
|
brownout_ll_bod_enable(cfg->enabled);
|
|
|
|
}
|