arduino / ArduinoCore-avr

The Official Arduino AVR core
https://www.arduino.cc
1.24k stars 1.05k forks source link

Add a function returning currently used analogRead resolution #563

Open abetis opened 5 months ago

abetis commented 5 months ago

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.

Ferdinaelectro commented 1 month ago

I would like to participate in this project. I am interested in this project, can I have details on the procedure to follow?