From 38cc4a273258b361825c891e19c2a6ff2e5e681d Mon Sep 17 00:00:00 2001 From: Armando Date: Tue, 23 Aug 2022 17:47:04 +0800 Subject: [PATCH 1/2] adc: use esp_check in adc_legacy.c --- components/driver/deprecated/adc_legacy.c | 65 +++++++++-------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/components/driver/deprecated/adc_legacy.c b/components/driver/deprecated/adc_legacy.c index 67d586efc5..238a9a1926 100644 --- a/components/driver/deprecated/adc_legacy.c +++ b/components/driver/deprecated/adc_legacy.c @@ -13,6 +13,7 @@ #include "freertos/semphr.h" #include "freertos/timers.h" #include "esp_log.h" +#include "esp_check.h" #include "esp_pm.h" #include "soc/rtc.h" #include "driver/rtc_io.h" @@ -36,26 +37,11 @@ #include "esp_efuse_rtc_calib.h" #endif -#define ADC_CHECK_RET(fun_ret) ({ \ - if (fun_ret != ESP_OK) { \ - ESP_LOGE(ADC_TAG,"%s:%d\n",__FUNCTION__,__LINE__); \ - return ESP_FAIL; \ - } \ -}) static const char *ADC_TAG = "ADC"; -#define ADC_CHECK(a, str, ret_val) ({ \ - if (!(a)) { \ - ESP_LOGE(ADC_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ - return (ret_val); \ - } \ -}) - #define ADC_GET_IO_NUM(periph, channel) (adc_channel_io_map[periph][channel]) -#define ADC_CHANNEL_CHECK(periph, channel) ADC_CHECK(channel < SOC_ADC_CHANNEL_NUM(periph), "ADC"#periph" channel error", ESP_ERR_INVALID_ARG) - //////////////////////// Locks /////////////////////////////////////////// extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished. @@ -121,7 +107,7 @@ static esp_err_t adc_hal_convert(adc_unit_t adc_n, int channel, int *out_raw); ---------------------------------------------------------------*/ esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num) { - ADC_CHANNEL_CHECK(ADC_UNIT_1, channel); + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(ADC_UNIT_1), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); int io = ADC_GET_IO_NUM(ADC_UNIT_1, channel); if (io < 0) { @@ -136,7 +122,7 @@ esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num) #if (SOC_ADC_PERIPH_NUM >= 2) esp_err_t adc2_pad_get_io_num(adc2_channel_t channel, gpio_num_t *gpio_num) { - ADC_CHANNEL_CHECK(ADC_UNIT_2, channel); + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(ADC_UNIT_2), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); int io = ADC_GET_IO_NUM(ADC_UNIT_2, channel); if (io < 0) { @@ -183,25 +169,24 @@ static void adc_rtc_chan_init(adc_unit_t adc_unit) esp_err_t adc_common_gpio_init(adc_unit_t adc_unit, adc_channel_t channel) { + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(adc_unit), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); + gpio_num_t gpio_num = 0; //If called with `ADC_UNIT_BOTH (ADC_UNIT_1 | ADC_UNIT_2)`, both if blocks will be run if (adc_unit == ADC_UNIT_1) { - ADC_CHANNEL_CHECK(ADC_UNIT_1, channel); gpio_num = ADC_GET_IO_NUM(ADC_UNIT_1, channel); - ADC_CHECK_RET(rtc_gpio_init(gpio_num)); - ADC_CHECK_RET(rtc_gpio_set_direction(gpio_num, RTC_GPIO_MODE_DISABLED)); - ADC_CHECK_RET(rtc_gpio_pulldown_dis(gpio_num)); - ADC_CHECK_RET(rtc_gpio_pullup_dis(gpio_num)); - } - if (adc_unit == ADC_UNIT_2) { - ADC_CHANNEL_CHECK(ADC_UNIT_2, channel); + + } else if (adc_unit == ADC_UNIT_2) { gpio_num = ADC_GET_IO_NUM(ADC_UNIT_2, channel); - ADC_CHECK_RET(rtc_gpio_init(gpio_num)); - ADC_CHECK_RET(rtc_gpio_set_direction(gpio_num, RTC_GPIO_MODE_DISABLED)); - ADC_CHECK_RET(rtc_gpio_pulldown_dis(gpio_num)); - ADC_CHECK_RET(rtc_gpio_pullup_dis(gpio_num)); + } else { + return ESP_ERR_INVALID_ARG; } + ESP_RETURN_ON_ERROR(rtc_gpio_init(gpio_num), ADC_TAG, "rtc_gpio_init fail"); + ESP_RETURN_ON_ERROR(rtc_gpio_set_direction(gpio_num, RTC_GPIO_MODE_DISABLED), ADC_TAG, "rtc_gpio_set_direction fail"); + ESP_RETURN_ON_ERROR(rtc_gpio_pulldown_dis(gpio_num), ADC_TAG, "rtc_gpio_pulldown_dis fail"); + ESP_RETURN_ON_ERROR(rtc_gpio_pullup_dis(gpio_num), ADC_TAG, "rtc_gpio_pullup_dis fail"); + return ESP_OK; } @@ -223,7 +208,7 @@ esp_err_t adc_set_data_inv(adc_unit_t adc_unit, bool inv_en) esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit) { - ADC_CHECK(width_bit < ADC_WIDTH_MAX, "unsupported bit width", ESP_ERR_INVALID_ARG); + ESP_RETURN_ON_FALSE(width_bit < ADC_WIDTH_MAX, ESP_ERR_INVALID_ARG, ADC_TAG, "unsupported bit width"); adc_bitwidth_t bitwidth = 0; #if CONFIG_IDF_TARGET_ESP32 if ((uint32_t)width_bit == (uint32_t)ADC_BITWIDTH_DEFAULT) { @@ -287,8 +272,8 @@ esp_err_t adc_rtc_reset(void) *------------------------------------------------------------------------------------*/ esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten) { - ADC_CHANNEL_CHECK(ADC_UNIT_1, channel); - ADC_CHECK(atten < SOC_ADC_ATTEN_NUM, "ADC Atten Err", ESP_ERR_INVALID_ARG); + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(ADC_UNIT_1), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); + ESP_RETURN_ON_FALSE(atten < SOC_ADC_ATTEN_NUM, ESP_ERR_INVALID_ARG, ADC_TAG, "ADC Atten Err"); adc_common_gpio_init(ADC_UNIT_1, channel); SARADC1_ENTER(); @@ -305,7 +290,7 @@ esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten) esp_err_t adc1_config_width(adc_bits_width_t width_bit) { - ADC_CHECK(width_bit < ADC_WIDTH_MAX, "unsupported bit width", ESP_ERR_INVALID_ARG); + ESP_RETURN_ON_FALSE(width_bit < ADC_WIDTH_MAX, ESP_ERR_INVALID_ARG, ADC_TAG, "unsupported bit width"); adc_bitwidth_t bitwidth = 0; #if CONFIG_IDF_TARGET_ESP32 if ((uint32_t)width_bit == (uint32_t)ADC_BITWIDTH_DEFAULT) { @@ -375,7 +360,7 @@ esp_err_t adc1_rtc_mode_acquire(void) esp_err_t adc1_lock_release(void) { - ADC_CHECK((uint32_t *)adc1_dma_lock != NULL, "adc1 lock release called before acquire", ESP_ERR_INVALID_STATE ); + ESP_RETURN_ON_FALSE((uint32_t *)adc1_dma_lock != NULL, ESP_ERR_INVALID_STATE, ADC_TAG, "adc1 lock release called before acquire"); /* Use locks to avoid digtal and RTC controller conflicts. for adc1, block until acquire the lock. */ adc_power_release(); @@ -386,7 +371,7 @@ esp_err_t adc1_lock_release(void) int adc1_get_raw(adc1_channel_t channel) { int adc_value; - ADC_CHANNEL_CHECK(ADC_UNIT_1, channel); + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(ADC_UNIT_1), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); adc1_rtc_mode_acquire(); #if SOC_ADC_CALIBRATION_V1_SUPPORTED @@ -440,8 +425,8 @@ void adc1_ulp_enable(void) ---------------------------------------------------------------*/ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten) { - ADC_CHANNEL_CHECK(ADC_UNIT_2, channel); - ADC_CHECK(atten <= SOC_ADC_ATTEN_NUM, "ADC2 Atten Err", ESP_ERR_INVALID_ARG); + ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(ADC_UNIT_2), ESP_ERR_INVALID_ARG, ADC_TAG, "invalid channel"); + ESP_RETURN_ON_FALSE(atten <= SOC_ADC_ATTEN_NUM, ESP_ERR_INVALID_ARG, ADC_TAG, "ADC2 Atten Err"); adc_common_gpio_init(ADC_UNIT_2, channel); @@ -513,9 +498,9 @@ esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int * int adc_value = 0; adc_bitwidth_t bitwidth = 0; - ADC_CHECK(raw_out != NULL, "ADC out value err", ESP_ERR_INVALID_ARG); - ADC_CHECK(channel < ADC2_CHANNEL_MAX, "ADC Channel Err", ESP_ERR_INVALID_ARG); - ADC_CHECK(width_bit < ADC_WIDTH_MAX, "unsupported bit width", ESP_ERR_INVALID_ARG); + ESP_RETURN_ON_FALSE(raw_out != NULL, ESP_ERR_INVALID_ARG, ADC_TAG, "ADC out value err"); + ESP_RETURN_ON_FALSE(channel < ADC2_CHANNEL_MAX, ESP_ERR_INVALID_ARG, ADC_TAG, "ADC Channel Err"); + ESP_RETURN_ON_FALSE(width_bit < ADC_WIDTH_MAX, ESP_ERR_INVALID_ARG, ADC_TAG, "unsupported bit width"); #if CONFIG_IDF_TARGET_ESP32 if ((uint32_t)width_bit == (uint32_t)ADC_BITWIDTH_DEFAULT) { bitwidth = SOC_ADC_RTC_MAX_BITWIDTH; From 50a8d8412e726bf42f7e19d805c701b453602bc1 Mon Sep 17 00:00:00 2001 From: Armando Date: Fri, 26 Aug 2022 11:28:01 +0800 Subject: [PATCH 2/2] esp_adc: remove wno flag --- components/esp_adc/CMakeLists.txt | 1 - components/esp_adc/adc_cali_curve_fitting.c | 4 ++-- components/esp_adc/adc_oneshot.c | 6 +++--- components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c | 4 ++-- components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c | 2 +- components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c | 2 +- components/esp_adc/deprecated/esp_adc_cal_common_legacy.c | 3 ++- components/esp_adc/esp32s2/adc_cali_line_fitting.c | 2 +- components/esp_adc/test_apps/adc/main/CMakeLists.txt | 1 - components/esp_adc/test_apps/adc/main/test_adc.c | 4 ++-- .../esp_adc/test_apps/adc/main/test_adc_driver_iram.c | 2 +- 11 files changed, 15 insertions(+), 16 deletions(-) diff --git a/components/esp_adc/CMakeLists.txt b/components/esp_adc/CMakeLists.txt index 48939d92ac..35d5a68737 100644 --- a/components/esp_adc/CMakeLists.txt +++ b/components/esp_adc/CMakeLists.txt @@ -31,4 +31,3 @@ idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes} PRIV_REQUIRES driver efuse LDFRAGMENTS linker.lf) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/esp_adc/adc_cali_curve_fitting.c b/components/esp_adc/adc_cali_curve_fitting.c index 9b80e47b2c..1d575c1464 100644 --- a/components/esp_adc/adc_cali_curve_fitting.c +++ b/components/esp_adc/adc_cali_curve_fitting.c @@ -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_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) @@ -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]; 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; diff --git a/components/esp_adc/adc_oneshot.c b/components/esp_adc/adc_oneshot.c index 681166bf07..f88e5a1bf7 100644 --- a/components/esp_adc/adc_oneshot.c +++ b/components/esp_adc/adc_oneshot.c @@ -107,7 +107,7 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a 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; 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"); 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); s_ctx.units[handle->unit_id] = NULL; _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); adc_power_release(); diff --git a/components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c b/components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c index b6374113a6..e35e00dfbc 100644 --- a/components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c +++ b/components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c @@ -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) { - 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_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); - 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 chars->adc_num = adc_num; diff --git a/components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c b/components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c index eeeb61c7f6..dd007d10a6 100644 --- a/components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c +++ b/components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c @@ -178,7 +178,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num, assert(res); res = calculate_characterization_coefficients(&efuse_parsed_data, chars); 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 chars->adc_num = adc_num; diff --git a/components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c b/components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c index b9e11e6c23..1f98689ec3 100644 --- a/components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c +++ b/components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c @@ -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_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, diff --git a/components/esp_adc/deprecated/esp_adc_cal_common_legacy.c b/components/esp_adc/deprecated/esp_adc_cal_common_legacy.c index 83b889275e..a990466394 100644 --- a/components/esp_adc/deprecated/esp_adc_cal_common_legacy.c +++ b/components/esp_adc/deprecated/esp_adc_cal_common_legacy.c @@ -6,6 +6,7 @@ #include #include +#include "inttypes.h" #include "sdkconfig.h" #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]; 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; diff --git a/components/esp_adc/esp32s2/adc_cali_line_fitting.c b/components/esp_adc/esp32s2/adc_cali_line_fitting.c index 93f509020a..9826b73860 100644 --- a/components/esp_adc/esp32s2/adc_cali_line_fitting.c +++ b/components/esp_adc/esp32s2/adc_cali_line_fitting.c @@ -114,7 +114,7 @@ esp_err_t adc_cali_create_scheme_line_fitting(const adc_cali_line_fitting_config assert(success); success = calculate_characterization_coefficients(&efuse_parsed_data, chars); 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->atten = config->atten; diff --git a/components/esp_adc/test_apps/adc/main/CMakeLists.txt b/components/esp_adc/test_apps/adc/main/CMakeLists.txt index e599f6328a..85bbc4bb8e 100644 --- a/components/esp_adc/test_apps/adc/main/CMakeLists.txt +++ b/components/esp_adc/test_apps/adc/main/CMakeLists.txt @@ -9,4 +9,3 @@ set(srcs "test_app_main.c" # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} WHOLE_ARCHIVE) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/esp_adc/test_apps/adc/main/test_adc.c b/components/esp_adc/test_apps/adc/main/test_adc.c index 31fcd2d849..99b2d69aaa 100644 --- a/components/esp_adc/test_apps/adc/main/test_adc.c +++ b/components/esp_adc/test_apps/adc/main/test_adc.c @@ -217,11 +217,11 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel) //Compare 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) { 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 diff --git a/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c b/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c index 74469d7323..e1d7949a68 100644 --- a/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c +++ b/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c @@ -222,7 +222,7 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]") uint32_t overhead_us = 50; #endif 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 test_adc_set_io_level(ADC_UNIT_1, ADC1_TEST_CHAN0, 0);