@@ -52,7 +52,7 @@ static int adc_ambiq_set_resolution(am_hal_adc_slot_prec_e *prec, uint8_t adc_re
5252 case 12 :
5353 * prec = AM_HAL_ADC_SLOT_12BIT ;
5454 break ;
55- #if ! defined(CONFIG_SOC_SERIES_APOLLO4X )
55+ #if defined(CONFIG_SOC_SERIES_APOLLO3X )
5656 case 14 :
5757 * prec = AM_HAL_ADC_SLOT_14BIT ;
5858 break ;
@@ -80,7 +80,7 @@ static int adc_ambiq_slot_config(const struct device *dev, const struct adc_sequ
8080 ADCSlotConfig .eChannel = channel ;
8181 ADCSlotConfig .bWindowCompare = false;
8282 ADCSlotConfig .bEnabled = true;
83- #if defined(CONFIG_SOC_SERIES_APOLLO4X )
83+ #if ! defined(CONFIG_SOC_SERIES_APOLLO3X )
8484 ADCSlotConfig .ui32TrkCyc = AM_HAL_ADC_MIN_TRKCYC ;
8585#endif
8686 if (AM_HAL_STATUS_SUCCESS !=
@@ -101,8 +101,6 @@ static void adc_ambiq_isr(const struct device *dev)
101101
102102 /* Read the interrupt status. */
103103 am_hal_adc_interrupt_status (data -> adcHandle , & ui32IntMask , true);
104- /* Clear the ADC interrupt.*/
105- am_hal_adc_interrupt_clear (data -> adcHandle , ui32IntMask );
106104
107105 /*
108106 * If we got a conversion completion interrupt (which should be our only
@@ -119,6 +117,8 @@ static void adc_ambiq_isr(const struct device *dev)
119117 am_hal_adc_disable (data -> adcHandle );
120118 adc_context_on_sampling_done (& data -> ctx , dev );
121119 }
120+ /* Clear the ADC interrupt.*/
121+ am_hal_adc_interrupt_clear (data -> adcHandle , ui32IntMask );
122122}
123123
124124static int adc_ambiq_check_buffer_size (const struct adc_sequence * sequence , uint8_t active_channels )
@@ -280,9 +280,9 @@ static int adc_ambiq_init(const struct device *dev)
280280
281281 /* Initialize the ADC and get the handle*/
282282 if (AM_HAL_STATUS_SUCCESS !=
283- am_hal_adc_initialize (( cfg -> base - ADC_BASE ) / ( cfg -> size * 4 ) , & data -> adcHandle )) {
283+ am_hal_adc_initialize (0 , & data -> adcHandle )) {
284284 ret = - ENODEV ;
285- LOG_ERR ("Faile to initialize ADC, code:%d" , ret );
285+ LOG_ERR ("Failed to initialize ADC, code:%d" , ret );
286286 return ret ;
287287 }
288288
@@ -292,7 +292,7 @@ static int adc_ambiq_init(const struct device *dev)
292292 /* Set up the ADC configuration parameters. These settings are reasonable
293293 * for accurate measurements at a low sample rate.
294294 */
295- #if ! defined(CONFIG_SOC_SERIES_APOLLO4X )
295+ #if defined(CONFIG_SOC_SERIES_APOLLO3X )
296296 ADCConfig .eClock = AM_HAL_ADC_CLKSEL_HFRC ;
297297 ADCConfig .eReference = AM_HAL_ADC_REFSEL_INT_1P5 ;
298298#else
0 commit comments