drivers: adc: sam0: Fix adc_reference implementation
The current sam0 adc driver not implement correctly the adc_reference enum values. This try homonize adc input referece by tracking VDDANA at ADC_REF_VDD_1. The ADC_REF_VDD_1_2 were fixed with correct INTVCCx channel selection. Fixes #45443 Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
parent
9d5bd09980
commit
5b7734c926
2 changed files with 23 additions and 11 deletions
|
@ -133,7 +133,6 @@ static int adc_sam0_channel_setup(const struct device *dev,
|
|||
adc->SAMPCTRL.reg = sampctrl;
|
||||
wait_synchronization(adc);
|
||||
|
||||
|
||||
uint8_t refctrl;
|
||||
|
||||
switch (channel_cfg->reference) {
|
||||
|
@ -142,14 +141,14 @@ static int adc_sam0_channel_setup(const struct device *dev,
|
|||
/* Enable the internal bandgap reference */
|
||||
ADC_BGEN = 1;
|
||||
break;
|
||||
case ADC_REF_VDD_1_2:
|
||||
refctrl = ADC_REFCTRL_REFSEL_VDD_1_2 | ADC_REFCTRL_REFCOMP;
|
||||
break;
|
||||
#ifdef ADC_REFCTRL_REFSEL_VDD_1
|
||||
case ADC_REF_VDD_1:
|
||||
refctrl = ADC_REFCTRL_REFSEL_VDD_1 | ADC_REFCTRL_REFCOMP;
|
||||
break;
|
||||
#endif
|
||||
case ADC_REF_VDD_1_2:
|
||||
refctrl = ADC_REFCTRL_REFSEL_VDD_1_2 | ADC_REFCTRL_REFCOMP;
|
||||
break;
|
||||
case ADC_REF_EXTERNAL0:
|
||||
refctrl = ADC_REFCTRL_REFSEL_AREFA;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue