From 1e9b1992df0505aa56937a5986b373bdbc351fb1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin <benjamin.valentin@ml-pa.com> Date: Fri, 1 Dec 2023 19:45:54 +0100 Subject: [PATCH 1/2] cpu/sam0_common: fix adc_continuous_sample() --- cpu/sam0_common/periph/adc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cpu/sam0_common/periph/adc.c b/cpu/sam0_common/periph/adc.c index 71764dba72e4..61a54e494524 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) From cd79dfb5a877915e142804b1d2a06a4e15955fce Mon Sep 17 00:00:00 2001 From: Benjamin Valentin <benjamin.valentin@ml-pa.com> Date: Fri, 1 Dec 2023 19:46:27 +0100 Subject: [PATCH 2/2] core/mutex: include cpu.h This is needed for core_mutex_debug --- core/mutex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/mutex.c b/core/mutex.c index 53dd916a936c..6fd891d49f52 100644 --- a/core/mutex.c +++ b/core/mutex.c @@ -24,6 +24,7 @@ #include <inttypes.h> #include <stdio.h> +#include "cpu.h" #include "mutex.h" #include "thread.h" #include "sched.h"