|
|
@ -177,7 +177,6 @@ void HAL_adc_init() {
|
|
|
|
// Calculate ADC characteristics (i.e., gain and offset factors for each attenuation level)
|
|
|
|
// Calculate ADC characteristics (i.e., gain and offset factors for each attenuation level)
|
|
|
|
for (int i = 0; i < ADC_ATTEN_MAX; i++) {
|
|
|
|
for (int i = 0; i < ADC_ATTEN_MAX; i++) {
|
|
|
|
esp_adc_cal_characterize(ADC_UNIT_1, (adc_atten_t)i, ADC_WIDTH_BIT_12, V_REF, &characteristics[i]);
|
|
|
|
esp_adc_cal_characterize(ADC_UNIT_1, (adc_atten_t)i, ADC_WIDTH_BIT_12, V_REF, &characteristics[i]);
|
|
|
|
|
|
|
|
|
|
|
|
// Change attenuation 100mV below the calibrated threshold
|
|
|
|
// Change attenuation 100mV below the calibrated threshold
|
|
|
|
thresholds[i] = esp_adc_cal_raw_to_voltage(4095, &characteristics[i]);
|
|
|
|
thresholds[i] = esp_adc_cal_raw_to_voltage(4095, &characteristics[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|