Skip to content

Commit 12ea607

Browse files
authored
Merge pull request #610 from adafruit/analogIO-scaling-picow
Fix up analogIO for PicoW and unknown architectures
2 parents e8e4f35 + 9198bee commit 12ea607

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/analogIO/Wippersnapper_AnalogIO.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void Wippersnapper_AnalogIO::setADCResolution(int resolution) {
8989
#elif defined(ARDUINO_ARCH_ESP32)
9090
scaleAnalogRead = true;
9191
_nativeResolution = 13;
92+
#elif defined(ARDUINO_ARCH_RP2040)
93+
scaleAnalogRead = true;
94+
_nativeResolution = 10;
95+
#else
96+
scaleAnalogRead = true;
97+
_nativeResolution = 10;
9298
#endif
9399

94100
_adcResolution = resolution;
@@ -205,7 +211,6 @@ void Wippersnapper_AnalogIO::deinitAnalogPin(
205211
uint16_t Wippersnapper_AnalogIO::getPinValue(int pin) {
206212
// get pin value
207213
uint16_t value = analogRead(pin);
208-
209214
// scale by the ADC resolution manually if not implemented by BSP
210215
if (scaleAnalogRead) {
211216
if (getADCresolution() > getNativeResolution()) {

0 commit comments

Comments
 (0)