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.
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.