mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
Merge pull request #12828 from bergzand/pr/sam0/adc_api
sam0/periph_adc: Fix API to return `-1` on unsupported resolution
This commit is contained in:
commit
53994bdfeb
@ -82,12 +82,13 @@ static int _adc_configure(adc_res_t res)
|
||||
/* Individual comparison necessary because ADC Resolution Bits are not
|
||||
* numerically in order and 16Bit (averaging - not currently supported)
|
||||
* falls between 12bit and 10bit. See datasheet for details */
|
||||
assert((res == ADC_RES_8BIT) || (res == ADC_RES_10BIT) ||
|
||||
(res == ADC_RES_12BIT));
|
||||
if (!((res == ADC_RES_8BIT) || (res == ADC_RES_10BIT) ||
|
||||
(res == ADC_RES_12BIT))){
|
||||
return -1;
|
||||
}
|
||||
_adc_poweroff();
|
||||
if (ADC->CTRLA.reg & ADC_CTRLA_SWRST ||
|
||||
ADC->CTRLA.reg & ADC_CTRLA_ENABLE ) {
|
||||
_done();
|
||||
DEBUG("adc: not ready\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user