adc: fixed the issue that ADC power is left on after the calibration is done

Also refactor the locks in the adc_common.c file.
This commit is contained in:
Michael (XIAO Xufeng)
2021-02-01 01:12:28 +08:00
parent 0700129c5a
commit 351ba5ff9e
6 changed files with 157 additions and 125 deletions

View File

@@ -464,10 +464,12 @@ uint32_t adc_get_calibration_offset(adc_ll_num_t adc_n, adc_channel_t channel, a
int tag = esp_efuse_rtc_table_get_tag(version, adc_n + 1, atten, RTCCALIB_V2_PARAM_VINIT);
dout = esp_efuse_rtc_table_get_parsed_efuse_value(tag, false);
} else {
const bool internal_gnd = true;
adc_power_acquire();
ADC_ENTER_CRITICAL();
const bool internal_gnd = true;
dout = adc_hal_self_calibration(adc_n, channel, atten, internal_gnd);
ADC_EXIT_CRITICAL();
adc_power_release();
}
ESP_LOGD(ADC_TAG, "Calib(V%d) ADC%d atten=%d: %04X", version, adc_n, atten, dout);
s_adc_cali_param[adc_n][atten] = (uint16_t)dout;