Jelajahi Sumber

driver: adc: use SOC_ADC_PERIPH_NUM for array size

ADC_UNIT_MAX is no longer equal to the number of ADC units.
This makes the static s_adc_cali_param arrays larger than necessary.
Ivan Grokhotkov 4 tahun lalu
induk
melakukan
dbd3aa5bfc

+ 1 - 1
components/driver/adc_common.c

@@ -232,7 +232,7 @@ esp_err_t adc2_pad_get_io_num(adc2_channel_t channel, gpio_num_t *gpio_num)
  * adc_common.c is far too confusing. Before a refactor is applied to adc_common.c, will put definite code in driver/adc.c
  */
 
-static uint16_t s_adc_cali_param[ADC_UNIT_MAX][ADC_ATTEN_MAX] = {};
+static uint16_t s_adc_cali_param[SOC_ADC_PERIPH_NUM][ADC_ATTEN_MAX] = {};
 
 uint32_t adc_get_calibration_offset(adc_ll_num_t adc_n, adc_channel_t channel, adc_atten_t atten)
 {

+ 1 - 1
components/driver/esp32c3/adc.c

@@ -666,7 +666,7 @@ esp_err_t adc_digi_monitor_enable(adc_digi_monitor_idx_t idx, bool enable)
                     RTC controller setting
 ---------------------------------------------------------------*/
 
-static uint16_t s_adc_cali_param[ADC_UNIT_MAX][ADC_ATTEN_MAX] = {};
+static uint16_t s_adc_cali_param[SOC_ADC_PERIPH_NUM][ADC_ATTEN_MAX] = {};
 
 //NOTE: according to calibration version, different types of lock may be taken during the process:
 //  1. Semaphore when reading efuse

+ 1 - 1
components/driver/esp32h2/adc.c

@@ -663,7 +663,7 @@ esp_err_t adc_digi_monitor_enable(adc_digi_monitor_idx_t idx, bool enable)
                     RTC controller setting
 ---------------------------------------------------------------*/
 
-static uint16_t s_adc_cali_param[ADC_UNIT_MAX][ADC_ATTEN_MAX] = {};
+static uint16_t s_adc_cali_param[SOC_ADC_PERIPH_NUM][ADC_ATTEN_MAX] = {};
 
 //NOTE: according to calibration version, different types of lock may be taken during the process:
 //  1. Semaphore when reading efuse