diff --git a/cpu/sam0_common/periph/adc.c b/cpu/sam0_common/periph/adc.c index db97790480..7760a2b935 100644 --- a/cpu/sam0_common/periph/adc.c +++ b/cpu/sam0_common/periph/adc.c @@ -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; }