Phyduino Board Support - Design decisions - 003

analogRead() covers external ADC channels transparently

ADR 003

Decision

analogRead(A0..A5) works on every header analog pin. Pins with no RP2040 GPIO behind them (Phyduino Pico A3–A5 → MAX11635) are routed by the core to the variant hook variantAnalogRead().

Extended 2026-10-18: the analog acquisition functions (analogReadAveraging(), analogReadMillivolts(), analogReadDifferentialMillivolts(), analogReadMultiple(), analogReadBurst() / analogStartBurst()) work the same way on every analog pin. The core handles RP2040 ADC pins; variant pins go through the variantAnalog*() hooks declared in Arduino.h, which on the Phyduino Pico call the max11635 driver.

Why

Students and the standard Arduino examples expect analogRead(A3) to just work. The same hook will serve the Phyduino Pico2, where all of A0–A5 go through an external ADS7038.

Cost

Full-scale voltage differs between pins (3.3 V vs 2.048 V on the Pico), which is documented in docs/boards/phyduino_pico.html. The driver must live in the variant (not a library) because the core calls it. Every variant must define all eight variantAnalog*() hooks, even with no external ADC (they then return 0 / false).