mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
esp_adc: move adc common hw related code into esp_hw_support
This commit is contained in:
committed by
Armando (Dou Yiwen)
parent
9a7a1fe61f
commit
5e6a16380a
@@ -20,10 +20,11 @@
|
||||
#include "freertos/ringbuf.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_private/adc_private.h"
|
||||
#include "esp_private/adc_lock.h"
|
||||
#include "esp_private/adc_share_hw_ctrl.h"
|
||||
#include "hal/adc_types.h"
|
||||
#include "hal/adc_hal.h"
|
||||
#include "hal/dma_types.h"
|
||||
#include "hal/adc_hal_common.h"
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/adc_types_legacy.h"
|
||||
@@ -588,3 +589,23 @@ static void check_adc_continuous_driver_conflict(void)
|
||||
}
|
||||
ESP_EARLY_LOGW(ADC_TAG, "legacy driver is deprecated, please migrate to `esp_adc/adc_continuous.h`");
|
||||
}
|
||||
|
||||
#if SOC_ADC_CALIBRATION_V1_SUPPORTED
|
||||
/*---------------------------------------------------------------
|
||||
ADC Hardware Calibration
|
||||
---------------------------------------------------------------*/
|
||||
static __attribute__((constructor)) void adc_hw_calibration(void)
|
||||
{
|
||||
//Calculate all ICode
|
||||
for (int i = 0; i < SOC_ADC_PERIPH_NUM; i++) {
|
||||
adc_hal_calibration_init(i);
|
||||
for (int j = 0; j < SOC_ADC_ATTEN_NUM; j++) {
|
||||
/**
|
||||
* This may get wrong when attenuations are NOT consecutive on some chips,
|
||||
* update this when bringing up the calibration on that chip
|
||||
*/
|
||||
adc_calc_hw_calibration_code(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //#if SOC_ADC_CALIBRATION_V1_SUPPORTED
|
||||
|
||||
Reference in New Issue
Block a user