diff --git a/core/mutex.c b/core/mutex.c index 53dd916a93..6fd891d49f 100644 --- a/core/mutex.c +++ b/core/mutex.c @@ -24,6 +24,7 @@ #include #include +#include "cpu.h" #include "mutex.h" #include "thread.h" #include "sched.h" diff --git a/cpu/sam0_common/periph/adc.c b/cpu/sam0_common/periph/adc.c index 71764dba72..61a54e4945 100644 --- a/cpu/sam0_common/periph/adc.c +++ b/cpu/sam0_common/periph/adc.c @@ -389,14 +389,10 @@ void adc_continuous_begin(adc_res_t res) int32_t adc_continuous_sample(adc_t line) { - int val; assert(line < ADC_NUMOF); + assert(mutex_trylock(&_lock) == 0); - mutex_lock(&_lock); - val = _sample(line) << _shift; - mutex_unlock(&_lock); - - return val; + return _sample(line) << _shift; } void adc_continuous_stop(void)