Skip to content

Commit

Permalink
Merge pull request #20134 from benpicco/cpu/sam0_common-adc_continuou…
Browse files Browse the repository at this point in the history
…s-fix

cpu/sam0_common: fix adc_continuous_sample()
  • Loading branch information
benpicco authored Dec 1, 2023
2 parents ac409eb + cd79dfb commit 182700f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions core/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <inttypes.h>
#include <stdio.h>

#include "cpu.h"
#include "mutex.h"
#include "thread.h"
#include "sched.h"
Expand Down
8 changes: 2 additions & 6 deletions cpu/sam0_common/periph/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 182700f

Please sign in to comment.