ADC module lacks simple useful #defines #1512

Open
opened 2023-09-15 02:21:55 -05:00 by Kucmasz · 1 comment
Kucmasz commented 2023-09-15 02:21:55 -05:00 (Migrated from github.com)

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.

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.
vkottler commented 2023-10-29 15:51:55 -05:00 (Migrated from github.com)

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
> 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
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1512
No description provided.