Merge branch 'bugfix/add_adc_oneshot_disable_ulp_enum' into 'master'

esp_adc: add adc ulp mode disable enum, and kconfig to enable dac output

Closes IDF-5843 and IDF-5846

See merge request espressif/esp-idf!19683
pull/9620/head
Armando (Dou Yiwen) 2022-08-23 10:46:54 +08:00
commit fec97b6b16
9 zmienionych plików z 28 dodań i 15 usunięć

Wyświetl plik

@ -41,7 +41,19 @@ menu "ADC and ADC Calibration"
This option will allow the ADC calibration component to use Lookup Tables
to correct for non-linear behavior in 11db attenuation. Other attenuations
do not exhibit non-linear behavior hence will not be affected by this option.
endmenu
config ADC_DISABLE_DAC_OUTPUT
depends on SOC_DAC_SUPPORTED
bool "Disable DAC when ADC2 is in use"
default y
help
By default, this is set. The ADC oneshot driver will disable the output of the
corresponding DAC channels:
ESP32: IO25 and IO26
ESP32S2: IO17 and IO18
Disable this option so as to measure the output of DAC by internal ADC, for test usage.
endmenu

Wyświetl plik

@ -44,7 +44,7 @@ TEST_CASE("ADC oneshot high/low test", "[adc_oneshot]")
adc_oneshot_unit_handle_t adc1_handle;
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config1, &adc1_handle));
@ -53,7 +53,7 @@ TEST_CASE("ADC oneshot high/low test", "[adc_oneshot]")
adc_oneshot_unit_handle_t adc2_handle;
adc_oneshot_unit_init_cfg_t init_config2 = {
.unit_id = ADC_UNIT_2,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config2, &adc2_handle));
#endif //#if (SOC_ADC_PERIPH_NUM >= 2)
@ -135,7 +135,7 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel)
adc_oneshot_unit_handle_t adc_handle;
adc_oneshot_unit_init_cfg_t init_config = {
.unit_id = unit_id,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config, &adc_handle));

Wyświetl plik

@ -72,7 +72,7 @@ TEST_CASE("ADC oneshot fast work with ISR", "[adc_oneshot]")
//-------------ADC1 Init---------------//
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config1, &isr_test_ctx.adc_handle));

Wyświetl plik

@ -78,7 +78,7 @@ TEST_CASE("ADC oneshot fast work with ISR and Flash", "[adc_oneshot]")
//-------------ADC1 Init---------------//
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config1, &oneshot_handle));

Wyświetl plik

@ -134,7 +134,7 @@ TEST_CASE("ADC1 oneshot raw average / std_deviation", "[adc_oneshot][ignore][man
adc_oneshot_unit_handle_t adc1_handle;
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config1, &adc1_handle));
@ -254,7 +254,7 @@ static void s_adc_cali_speed(adc_unit_t unit_id, adc_channel_t channel)
adc_oneshot_unit_handle_t adc_handle;
adc_oneshot_unit_init_cfg_t init_config = {
.unit_id = unit_id,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
TEST_ESP_OK(adc_oneshot_new_unit(&init_config, &adc_handle));

Wyświetl plik

@ -25,7 +25,7 @@
#endif
#if SOC_DAC_SUPPORTED
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
// To disable DAC, workarounds, see this function body to know more
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel);
#endif
@ -52,7 +52,7 @@ void adc_oneshot_hal_setup(adc_oneshot_hal_ctx_t *hal, adc_channel_t chan)
adc_ll_amp_disable(); //Currently the LNA is not open, close it by default.
#endif
#if SOC_DAC_SUPPORTED
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
s_disable_dac(hal, chan);
#endif
@ -144,7 +144,7 @@ bool adc_oneshot_hal_convert(adc_oneshot_hal_ctx_t *hal, int *out_raw)
/*---------------------------------------------------------------
Workarounds
---------------------------------------------------------------*/
#if SOC_DAC_SUPPORTED
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel)
{
/**

Wyświetl plik

@ -55,8 +55,9 @@ typedef enum {
} adc_bitwidth_t;
typedef enum {
ADC_ULP_MODE_FSM = 1, ///< ADC is controlled by ULP FSM
ADC_ULP_MODE_RISCV = 2, ///< ADC is controlled by ULP RISCV
ADC_ULP_MODE_DISABLE = 0, ///< ADC ULP mode is disabled
ADC_ULP_MODE_FSM = 1, ///< ADC is controlled by ULP FSM
ADC_ULP_MODE_RISCV = 2, ///< ADC is controlled by ULP RISCV
} adc_ulp_mode_t;
/**

Wyświetl plik

@ -62,7 +62,7 @@ Create an ADC Unit Handle under Normal Oneshot Mode
adc_oneshot_unit_handle_t adc1_handle;
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle));

Wyświetl plik

@ -70,7 +70,7 @@ void app_main(void)
adc_oneshot_unit_handle_t adc2_handle;
adc_oneshot_unit_init_cfg_t init_config2 = {
.unit_id = ADC_UNIT_2,
.ulp_mode = false,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config2, &adc2_handle));