mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'bugfix/remove_esp_adc_wno_flag_v5.0' into 'release/v5.0'
esp_adc: remove wno flag (v5.0) See merge request espressif/esp-idf!19957
This commit is contained in:
@@ -31,4 +31,3 @@ idf_component_register(SRCS ${srcs}
|
|||||||
INCLUDE_DIRS ${includes}
|
INCLUDE_DIRS ${includes}
|
||||||
PRIV_REQUIRES driver efuse
|
PRIV_REQUIRES driver efuse
|
||||||
LDFRAGMENTS linker.lf)
|
LDFRAGMENTS linker.lf)
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -174,7 +174,7 @@ static void calc_first_step_coefficients(const adc_calib_info_t *parsed_data, ca
|
|||||||
{
|
{
|
||||||
ctx->chars_first_step.coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
|
ctx->chars_first_step.coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
|
||||||
ctx->chars_first_step.coeff_b = 0;
|
ctx->chars_first_step.coeff_b = 0;
|
||||||
ESP_LOGV(TAG, "Calib V1, Cal Voltage = %d, Digi out = %d, Coef_a = %d\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, ctx->chars_first_step.coeff_a);
|
ESP_LOGV(TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32", Coef_a = %"PRId32"\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, ctx->chars_first_step.coeff_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calc_second_step_coefficients(const adc_cali_curve_fitting_config_t *config, cali_chars_curve_fitting_t *ctx)
|
static void calc_second_step_coefficients(const adc_cali_curve_fitting_config_t *config, cali_chars_curve_fitting_t *ctx)
|
||||||
@@ -224,7 +224,7 @@ static int32_t get_reading_error(uint64_t v_cali_1, const cali_chars_second_step
|
|||||||
|
|
||||||
term[i] = term[i] / (*param->coeff)[atten][i][1];
|
term[i] = term[i] / (*param->coeff)[atten][i][1];
|
||||||
error += (int32_t)term[i] * (*param->sign)[atten][i];
|
error += (int32_t)term[i] * (*param->sign)[atten][i];
|
||||||
ESP_LOGV(TAG, "term%d is %llu, error is %d", i, term[i], error);
|
ESP_LOGV(TAG, "term%d is %llu, error is %"PRId32, i, term[i], error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@@ -107,7 +107,7 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a
|
|||||||
|
|
||||||
adc_power_acquire();
|
adc_power_acquire();
|
||||||
|
|
||||||
ESP_LOGD(TAG, "new adc unit%d is created", unit->unit_id);
|
ESP_LOGD(TAG, "new adc unit%"PRId32" is created", unit->unit_id);
|
||||||
*ret_unit = unit;
|
*ret_unit = unit;
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
@@ -193,13 +193,13 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
|||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||||
bool success_free = s_adc_unit_free(handle->unit_id);
|
bool success_free = s_adc_unit_free(handle->unit_id);
|
||||||
ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%d isn't in use", handle->unit_id + 1);
|
ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%"PRId32" isn't in use", handle->unit_id + 1);
|
||||||
|
|
||||||
_lock_acquire(&s_ctx.mutex);
|
_lock_acquire(&s_ctx.mutex);
|
||||||
s_ctx.units[handle->unit_id] = NULL;
|
s_ctx.units[handle->unit_id] = NULL;
|
||||||
_lock_release(&s_ctx.mutex);
|
_lock_release(&s_ctx.mutex);
|
||||||
|
|
||||||
ESP_LOGD(TAG, "adc unit%d is deleted", handle->unit_id);
|
ESP_LOGD(TAG, "adc unit%"PRId32" is deleted", handle->unit_id);
|
||||||
free(handle);
|
free(handle);
|
||||||
|
|
||||||
adc_power_release();
|
adc_power_release();
|
||||||
|
@@ -101,7 +101,7 @@ static esp_err_t prepare_calib_data_for(int version_num, adc_unit_t adc_num, adc
|
|||||||
*/
|
*/
|
||||||
static void calculate_characterization_coefficients(const adc_calib_parsed_info_t *parsed_data, esp_adc_cal_characteristics_t *chars)
|
static void calculate_characterization_coefficients(const adc_calib_parsed_info_t *parsed_data, esp_adc_cal_characteristics_t *chars)
|
||||||
{
|
{
|
||||||
ESP_LOGD(LOG_TAG, "Calib V1, Cal Voltage = %d, Digi out = %d\n", parsed_data->efuse_data.ver1.voltage, parsed_data->efuse_data.ver1.digi);
|
ESP_LOGD(LOG_TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32, parsed_data->efuse_data.ver1.voltage, parsed_data->efuse_data.ver1.digi);
|
||||||
|
|
||||||
chars->coeff_a = coeff_a_scaling * parsed_data->efuse_data.ver1.voltage / parsed_data->efuse_data.ver1.digi;
|
chars->coeff_a = coeff_a_scaling * parsed_data->efuse_data.ver1.voltage / parsed_data->efuse_data.ver1.digi;
|
||||||
chars->coeff_b = 0;
|
chars->coeff_b = 0;
|
||||||
@@ -147,7 +147,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
||||||
ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
|
ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32, adc_num, atten, chars->coeff_a, chars->coeff_b);
|
||||||
|
|
||||||
// Initialize remaining fields
|
// Initialize remaining fields
|
||||||
chars->adc_num = adc_num;
|
chars->adc_num = adc_num;
|
||||||
|
@@ -178,7 +178,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
|
|||||||
assert(res);
|
assert(res);
|
||||||
res = calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
res = calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
||||||
assert(res);
|
assert(res);
|
||||||
ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
|
ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32"\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
|
||||||
|
|
||||||
// Initialize remaining fields
|
// Initialize remaining fields
|
||||||
chars->adc_num = adc_num;
|
chars->adc_num = adc_num;
|
||||||
|
@@ -121,7 +121,7 @@ static void calculate_characterization_coefficients(const adc_calib_info_t *pars
|
|||||||
{
|
{
|
||||||
chars->coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
|
chars->coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
|
||||||
chars->coeff_b = 0;
|
chars->coeff_b = 0;
|
||||||
ESP_LOGV(LOG_TAG, "Calib V1, Cal Voltage = %d, Digi out = %d, Coef_a = %d\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, chars->coeff_a);
|
ESP_LOGV(LOG_TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32", Coef_a = %"PRId32"\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, chars->coeff_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
|
esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "inttypes.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
|
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
|
||||||
@@ -85,7 +86,7 @@ int32_t esp_adc_cal_get_reading_error(const esp_adc_error_calc_param_t *param, u
|
|||||||
|
|
||||||
term[i] = term[i] / (*param->coeff)[atten][i][1];
|
term[i] = term[i] / (*param->coeff)[atten][i][1];
|
||||||
error += (int32_t)term[i] * (*param->sign)[atten][i];
|
error += (int32_t)term[i] * (*param->sign)[atten][i];
|
||||||
ESP_LOGV(TAG, "term%d is %llu, error is %d", i, term[i], error);
|
ESP_LOGV(TAG, "term%d is %llu, error is %"PRId32, i, term[i], error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@@ -114,7 +114,7 @@ esp_err_t adc_cali_create_scheme_line_fitting(const adc_cali_line_fitting_config
|
|||||||
assert(success);
|
assert(success);
|
||||||
success = calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
success = calculate_characterization_coefficients(&efuse_parsed_data, chars);
|
||||||
assert(success);
|
assert(success);
|
||||||
ESP_LOGD(TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", config->unit_id, config->atten, chars->coeff_a, chars->coeff_b);
|
ESP_LOGD(TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32"\n", config->unit_id, config->atten, chars->coeff_a, chars->coeff_b);
|
||||||
chars->unit_id = config->unit_id;
|
chars->unit_id = config->unit_id;
|
||||||
chars->atten = config->atten;
|
chars->atten = config->atten;
|
||||||
|
|
||||||
|
@@ -10,4 +10,3 @@ set(srcs "test_app_main.c"
|
|||||||
# the component can be registered as WHOLE_ARCHIVE
|
# the component can be registered as WHOLE_ARCHIVE
|
||||||
idf_component_register(SRCS ${srcs}
|
idf_component_register(SRCS ${srcs}
|
||||||
WHOLE_ARCHIVE)
|
WHOLE_ARCHIVE)
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -216,11 +216,11 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel)
|
|||||||
|
|
||||||
//Compare
|
//Compare
|
||||||
int32_t raw_diff = raw_expected - raw_after_sleep;
|
int32_t raw_diff = raw_expected - raw_after_sleep;
|
||||||
ESP_LOGI(TAG, "ADC%d Chan%d: raw difference: %d", unit_id + 1, channel, raw_diff);
|
ESP_LOGI(TAG, "ADC%d Chan%d: raw difference: %"PRId32, unit_id + 1, channel, raw_diff);
|
||||||
|
|
||||||
if (do_calibration) {
|
if (do_calibration) {
|
||||||
int32_t cali_diff = cali_expected - cali_after_sleep;
|
int32_t cali_diff = cali_expected - cali_after_sleep;
|
||||||
ESP_LOGI(TAG, "ADC%d Chan%d: cali difference: %d", unit_id + 1, channel, cali_diff);
|
ESP_LOGI(TAG, "ADC%d Chan%d: cali difference: %"PRId32, unit_id + 1, channel, cali_diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test Calibration registers
|
//Test Calibration registers
|
||||||
|
@@ -222,7 +222,7 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]")
|
|||||||
uint32_t overhead_us = 50;
|
uint32_t overhead_us = 50;
|
||||||
#endif
|
#endif
|
||||||
uint32_t wait_time_us = (1000 * 1000 / ADC_TEST_FREQ_HZ * ADC_TEST_PKG_SIZE / SOC_ADC_DIGI_RESULT_BYTES) + overhead_us;
|
uint32_t wait_time_us = (1000 * 1000 / ADC_TEST_FREQ_HZ * ADC_TEST_PKG_SIZE / SOC_ADC_DIGI_RESULT_BYTES) + overhead_us;
|
||||||
printf("period is %d us\n", wait_time_us);
|
printf("period is %"PRId32" us\n", wait_time_us);
|
||||||
|
|
||||||
//ADC IO tile low
|
//ADC IO tile low
|
||||||
test_adc_set_io_level(ADC_UNIT_1, ADC1_TEST_CHAN0, 0);
|
test_adc_set_io_level(ADC_UNIT_1, ADC1_TEST_CHAN0, 0);
|
||||||
|
Reference in New Issue
Block a user