mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
refactor(adc): move some ADC soc_caps to adc_ll.h
This commit is contained in:
@@ -149,7 +149,7 @@ TEST_CASE("ADC oneshot stress test that get zero even if convent done", "[adc_on
|
||||
};
|
||||
|
||||
adc_oneshot_chan_cfg_t config = {
|
||||
.bitwidth = SOC_ADC_RTC_MAX_BITWIDTH,
|
||||
.bitwidth = ADC_LL_RTC_MAX_BITWIDTH,
|
||||
.atten = atten,
|
||||
};
|
||||
|
||||
@@ -194,14 +194,14 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel)
|
||||
|
||||
//-------------ADC Channel Config---------------//
|
||||
adc_oneshot_chan_cfg_t config = {
|
||||
.bitwidth = SOC_ADC_RTC_MAX_BITWIDTH,
|
||||
.bitwidth = ADC_LL_RTC_MAX_BITWIDTH,
|
||||
};
|
||||
|
||||
//-------------ADC Calibration Init---------------//
|
||||
bool do_calibration = false;
|
||||
adc_cali_handle_t cali_handle[TEST_ATTEN_NUMS] = {};
|
||||
for (int i = 0; i < TEST_ATTEN_NUMS; i++) {
|
||||
do_calibration = test_adc_calibration_init(unit_id, channel, g_test_atten[i], SOC_ADC_RTC_MAX_BITWIDTH, &cali_handle[i]);
|
||||
do_calibration = test_adc_calibration_init(unit_id, channel, g_test_atten[i], ADC_LL_RTC_MAX_BITWIDTH, &cali_handle[i]);
|
||||
}
|
||||
if (!do_calibration) {
|
||||
ESP_LOGW(TAG, "No efuse bits burnt, only test the regi2c analog register values");
|
||||
@@ -345,7 +345,7 @@ TEST_CASE("ADC continuous monitor init_deinit", "[adc]")
|
||||
adc_continuous_config_t dig_cfg = {
|
||||
.pattern_num = 1,
|
||||
.adc_pattern = adc_pattern,
|
||||
.sample_freq_hz = SOC_ADC_SAMPLE_FREQ_THRES_LOW,
|
||||
.sample_freq_hz = ADC_LL_SAMPLE_FREQ_THRES_LOW,
|
||||
.conv_mode = ADC_CONV_SINGLE_UNIT_1,
|
||||
.format = TEST_ADC_FORMAT_TYPE,
|
||||
};
|
||||
@@ -445,7 +445,7 @@ TEST_CASE("ADC continuous monitor functionary", "[adc]")
|
||||
adc_continuous_config_t dig_cfg = {
|
||||
.pattern_num = 2,
|
||||
.adc_pattern = adc_pattern,
|
||||
.sample_freq_hz = SOC_ADC_SAMPLE_FREQ_THRES_LOW,
|
||||
.sample_freq_hz = ADC_LL_SAMPLE_FREQ_THRES_LOW,
|
||||
.conv_mode = ADC_CONV_SINGLE_UNIT_1,
|
||||
.format = TEST_ADC_FORMAT_TYPE,
|
||||
};
|
||||
@@ -492,12 +492,12 @@ TEST_CASE("ADC continuous monitor functionary", "[adc]")
|
||||
switch (pull_mode) {
|
||||
case GPIO_PULLUP_ONLY:
|
||||
#if !CONFIG_IDF_TARGET_ESP32S2
|
||||
TEST_ASSERT_UINT32_WITHIN(SOC_ADC_SAMPLE_FREQ_THRES_LOW * 0.1, SOC_ADC_SAMPLE_FREQ_THRES_LOW, m1h_cnt);
|
||||
TEST_ASSERT_UINT32_WITHIN(ADC_LL_SAMPLE_FREQ_THRES_LOW * 0.1, ADC_LL_SAMPLE_FREQ_THRES_LOW, m1h_cnt);
|
||||
TEST_ASSERT_EQUAL(0, m1l_cnt); //low limit should NOT triggrted when pull_up
|
||||
#endif
|
||||
break;
|
||||
case GPIO_PULLDOWN_ONLY:
|
||||
TEST_ASSERT_UINT32_WITHIN(SOC_ADC_SAMPLE_FREQ_THRES_LOW * 0.1, SOC_ADC_SAMPLE_FREQ_THRES_LOW, m1l_cnt);
|
||||
TEST_ASSERT_UINT32_WITHIN(ADC_LL_SAMPLE_FREQ_THRES_LOW * 0.1, ADC_LL_SAMPLE_FREQ_THRES_LOW, m1l_cnt);
|
||||
TEST_ASSERT_EQUAL(0, m1h_cnt);
|
||||
break;
|
||||
case GPIO_PULLUP_PULLDOWN:
|
||||
|
||||
@@ -314,13 +314,13 @@ TEST_CASE("ADC filter exhausted allocation", "[adc_continuous]")
|
||||
};
|
||||
TEST_ESP_OK(adc_continuous_new_handle(&adc_config, &handle));
|
||||
|
||||
adc_iir_filter_handle_t filter_hdl[SOC_ADC_DIGI_IIR_FILTER_NUM + 1] = {};
|
||||
adc_iir_filter_handle_t filter_hdl[ADC_LL_DIGI_IIR_FILTER_NUM + 1] = {};
|
||||
adc_continuous_iir_filter_config_t filter_config = {
|
||||
.unit = ADC_UNIT_1,
|
||||
.channel = ADC_CHANNEL_0,
|
||||
.coeff = ADC_DIGI_IIR_FILTER_COEFF_2,
|
||||
};
|
||||
for (int i = 0; i < SOC_ADC_DIGI_IIR_FILTER_NUM; i++) {
|
||||
for (int i = 0; i < ADC_LL_DIGI_IIR_FILTER_NUM; i++) {
|
||||
#if SOC_ADC_DIG_IIR_FILTER_UNIT_BINDED
|
||||
//On these chips, the unit and the filter_id should be the same
|
||||
filter_config.unit = i;
|
||||
@@ -329,9 +329,9 @@ TEST_CASE("ADC filter exhausted allocation", "[adc_continuous]")
|
||||
}
|
||||
|
||||
filter_config.unit = ADC_UNIT_1;
|
||||
TEST_ASSERT(adc_new_continuous_iir_filter(handle, &filter_config, &filter_hdl[SOC_ADC_DIGI_IIR_FILTER_NUM]) == ESP_ERR_NOT_FOUND);
|
||||
TEST_ASSERT(adc_new_continuous_iir_filter(handle, &filter_config, &filter_hdl[ADC_LL_DIGI_IIR_FILTER_NUM]) == ESP_ERR_NOT_FOUND);
|
||||
|
||||
for (int i = 0; i < SOC_ADC_DIGI_IIR_FILTER_NUM; i++) {
|
||||
for (int i = 0; i < ADC_LL_DIGI_IIR_FILTER_NUM; i++) {
|
||||
TEST_ESP_OK(adc_del_continuous_iir_filter(filter_hdl[i]));
|
||||
}
|
||||
|
||||
|
||||
@@ -384,9 +384,9 @@ static void test_adc_continuous_sample_freq(uint32_t sample_freq_hz)
|
||||
TEST_CASE("ADC continuous sample frequency test", "[adc_continuous][performance]")
|
||||
{
|
||||
// Test minimum frequency
|
||||
test_adc_continuous_sample_freq(SOC_ADC_SAMPLE_FREQ_THRES_LOW);
|
||||
test_adc_continuous_sample_freq(ADC_LL_SAMPLE_FREQ_THRES_LOW);
|
||||
// Test maximum frequency
|
||||
test_adc_continuous_sample_freq(SOC_ADC_SAMPLE_FREQ_THRES_HIGH);
|
||||
test_adc_continuous_sample_freq(ADC_LL_SAMPLE_FREQ_THRES_HIGH);
|
||||
}
|
||||
|
||||
#endif //#if SOC_ADC_DMA_SUPPORTED
|
||||
@@ -411,7 +411,7 @@ static float test_adc_oneshot_std(adc_atten_t atten, bool is_performance_test)
|
||||
|
||||
//-------------ADC Channel Config---------------//
|
||||
adc_oneshot_chan_cfg_t config = {
|
||||
.bitwidth = SOC_ADC_RTC_MAX_BITWIDTH,
|
||||
.bitwidth = ADC_LL_RTC_MAX_BITWIDTH,
|
||||
};
|
||||
|
||||
//-------------ADC Calibration Init---------------//
|
||||
@@ -427,7 +427,7 @@ static float test_adc_oneshot_std(adc_atten_t atten, bool is_performance_test)
|
||||
TEST_ESP_OK(adc_oneshot_config_channel(adc1_handle, channel, &config));
|
||||
ESP_LOGI("TEST_ADC", "Test with atten: %d", atten);
|
||||
|
||||
s_reset_array(ADC_TEST_RAW_BUCKET_SIZE(SOC_ADC_RTC_MAX_BITWIDTH));
|
||||
s_reset_array(ADC_TEST_RAW_BUCKET_SIZE(ADC_LL_RTC_MAX_BITWIDTH));
|
||||
|
||||
if (is_performance_test) {
|
||||
test_adc_set_io_middle(ADC_UNIT_1, TEST_STD_ADC1_CHANNEL0);
|
||||
@@ -511,7 +511,7 @@ static void s_adc_cali_speed(adc_unit_t unit_id, adc_channel_t channel)
|
||||
bool do_calibration = false;
|
||||
adc_cali_handle_t cali_handle[TEST_ATTEN_NUMS] = {};
|
||||
for (int i = 0; i < TEST_ATTEN_NUMS; i++) {
|
||||
do_calibration = test_adc_calibration_init(unit_id, channel, g_test_atten[i], SOC_ADC_RTC_MAX_BITWIDTH, &cali_handle[i]);
|
||||
do_calibration = test_adc_calibration_init(unit_id, channel, g_test_atten[i], ADC_LL_RTC_MAX_BITWIDTH, &cali_handle[i]);
|
||||
}
|
||||
|
||||
if (!do_calibration) {
|
||||
@@ -532,7 +532,7 @@ static void s_adc_cali_speed(adc_unit_t unit_id, adc_channel_t channel)
|
||||
|
||||
//-------------ADC Channel Config---------------//
|
||||
adc_oneshot_chan_cfg_t config = {
|
||||
.bitwidth = SOC_ADC_RTC_MAX_BITWIDTH,
|
||||
.bitwidth = ADC_LL_RTC_MAX_BITWIDTH,
|
||||
};
|
||||
|
||||
//atten0 ~ atten3
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "unity.h"
|
||||
#include "esp_log.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/adc_ll.h"
|
||||
#include "esp_private/adc_private.h"
|
||||
#include "esp_adc/adc_cali.h"
|
||||
#include "esp_adc/adc_cali_scheme.h"
|
||||
|
||||
Reference in New Issue
Block a user