Get ADC resolution

Is there a method to determine the current ADC resolution setting: 10, 12, etc ? I don’t want to change it with analogReadResolution().

Thanks.

Try to enable pull up on an unused pin, and read the pin's A/D value.
You will know the resolution depending on it's A/D value.
Leo..

Thank you.

It's for library code, so I want to be able to reliably read the resolution at run time to get the proper max ADC value for calculations.

I think most processors that use that syntax default to 10-bit.
See this page.
Leo..

Which Arduino, and which library?

The ADC of a regular Arduino (Uno, Nano, Mega) has 10 bit resolution. This command appears to be exclusive for the Arduino Due, Zero and MKR Family.

MAC73:
Thank you.

It's for library code, so I want to be able to reliably read the resolution at run time to get the proper max ADC value for calculations.

If your library doesn't use analogRead() itself, its not your libraries problem, make the caller pass the scaling factor in explicitly. Separation of concerns.

I'm designing my own PCBs and currently using SAMDD21G and SAMDD21J. I just thought there might be a library function that would tell me the current ADC resolution. I prefer not to use hard coded values in my code.

Thanks.