arduino / arduino/ArduinoCore-sam

adc_set_resolution bug

Open Beginner friendly
#129 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Description

in `adc.c`:
```c
void adc_set_resolution(Adc *p_adc,const enum adc_resolution_t resolution)
{
p_adc->ADC_MR |= (resolution << 4) & ADC_MR_LOWRES;
}
```

is incorrect. The RHS always evaluates to 0 since the valid values of `enum adc_resolution_t` as seen in `adc.h` are 0 (`ADC_12_BITS`), or 16 (`ADC_10_BITS`)

Contributor guide

No contributing guide indexed for this repository

Research direction

Read adc.c at adc_set_resolution and check the enum values in adc.h first. Verify the resolution bits are updated according to the valid ADC_12_BITS and ADC_10_BITS values, then confirm the function no longer leaves the relevant setting unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.