arduino / arduino/ArduinoCore-avr

Add a function returning currently used analogRead resolution

Open
#563 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I'm surprised there is no function in Arduino suite that returns ADC's resolution (in bits), or maximal value that cane be read from `analogRead()`.

Having such function will allow writing a more cross-platform code that uses ADC.
For ATMega328 such function might be hard-coded to 10bit or 1023.
Other cores will return other hard-coded values or currently used ADC's resolution based on controller registers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the core for the existing analogRead() implementation and related ADC configuration. Determine where a resolution or maximum-value function belongs and how the AVR core should report its value; done means the new API returns the currently used ADC resolution or equivalent maximum for supported AVR boards.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.