pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

ADC module lacks simple useful #defines

Open Kucmasz opened this issue 2 years ago • 1 comments

It would be pretty useful to have a defines for ADC module that state

  • max reading in bits
  • reference voltage

for actual reading conversion in applications. Also a simple macro for converting a GPIO pin to ADC channel could be implemented easily.

Kucmasz avatar Sep 15 '23 07:09 Kucmasz

reference voltage

@Kucmasz this depends on hardware external to the RP2040 (ADC_AVDD). The datasheet plainly states that the ADC is 12-bit.

In practice there are often voltage dividers and other signal conditioning circuitry that would go from some application signal to the ADC input, so it doesn't seem that useful to have #define macros for this because:

  1. #define is horrible
  2. everything ADC related in firmware is application specific

vkottler avatar Oct 29 '23 20:10 vkottler