Browse Source

Merge pull request #7118 from photonthunder/sam0_adc_resolution

sam0/adc: assert resolution check fix
master
Thomas Eichinger 6 years ago committed by GitHub
parent
commit
2a2855631e
  1. 6
      cpu/sam0_common/periph/adc.c

6
cpu/sam0_common/periph/adc.c

@ -76,7 +76,11 @@ static void _adc_poweroff(void)
static int _adc_configure(adc_res_t res)
{
assert(res >= ADC_RES_8BIT && res <= ADC_RES_12BIT);
/* 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));
_adc_poweroff();
if (ADC_0_DEV->CTRLA.reg & ADC_CTRLA_SWRST ||
ADC_0_DEV->CTRLA.reg & ADC_CTRLA_ENABLE ) {

Loading…
Cancel
Save