@@ -52,7 +52,7 @@ static int adc_ambiq_set_resolution(am_hal_adc_slot_prec_e *prec, uint8_t adc_re
52
52
case 12 :
53
53
* prec = AM_HAL_ADC_SLOT_12BIT ;
54
54
break ;
55
- #if ! defined(CONFIG_SOC_SERIES_APOLLO4X )
55
+ #if defined(CONFIG_SOC_SERIES_APOLLO3X )
56
56
case 14 :
57
57
* prec = AM_HAL_ADC_SLOT_14BIT ;
58
58
break ;
@@ -80,7 +80,7 @@ static int adc_ambiq_slot_config(const struct device *dev, const struct adc_sequ
80
80
ADCSlotConfig .eChannel = channel ;
81
81
ADCSlotConfig .bWindowCompare = false;
82
82
ADCSlotConfig .bEnabled = true;
83
- #if defined(CONFIG_SOC_SERIES_APOLLO4X )
83
+ #if ! defined(CONFIG_SOC_SERIES_APOLLO3X )
84
84
ADCSlotConfig .ui32TrkCyc = AM_HAL_ADC_MIN_TRKCYC ;
85
85
#endif
86
86
if (AM_HAL_STATUS_SUCCESS !=
@@ -101,8 +101,6 @@ static void adc_ambiq_isr(const struct device *dev)
101
101
102
102
/* Read the interrupt status. */
103
103
am_hal_adc_interrupt_status (data -> adcHandle , & ui32IntMask , true);
104
- /* Clear the ADC interrupt.*/
105
- am_hal_adc_interrupt_clear (data -> adcHandle , ui32IntMask );
106
104
107
105
/*
108
106
* 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)
119
117
am_hal_adc_disable (data -> adcHandle );
120
118
adc_context_on_sampling_done (& data -> ctx , dev );
121
119
}
120
+ /* Clear the ADC interrupt.*/
121
+ am_hal_adc_interrupt_clear (data -> adcHandle , ui32IntMask );
122
122
}
123
123
124
124
static 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)
280
280
281
281
/* Initialize the ADC and get the handle*/
282
282
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 )) {
284
284
ret = - ENODEV ;
285
- LOG_ERR ("Faile to initialize ADC, code:%d" , ret );
285
+ LOG_ERR ("Failed to initialize ADC, code:%d" , ret );
286
286
return ret ;
287
287
}
288
288
@@ -292,7 +292,7 @@ static int adc_ambiq_init(const struct device *dev)
292
292
/* Set up the ADC configuration parameters. These settings are reasonable
293
293
* for accurate measurements at a low sample rate.
294
294
*/
295
- #if ! defined(CONFIG_SOC_SERIES_APOLLO4X )
295
+ #if defined(CONFIG_SOC_SERIES_APOLLO3X )
296
296
ADCConfig .eClock = AM_HAL_ADC_CLKSEL_HFRC ;
297
297
ADCConfig .eReference = AM_HAL_ADC_REFSEL_INT_1P5 ;
298
298
#else
0 commit comments