Skip to content

Commit

Permalink
Merge pull request #610 from adafruit/analogIO-scaling-picow
Browse files Browse the repository at this point in the history
Fix up analogIO for PicoW and unknown architectures
  • Loading branch information
tyeth authored Aug 14, 2024
2 parents e8e4f35 + 9198bee commit 12ea607
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/analogIO/Wippersnapper_AnalogIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ void Wippersnapper_AnalogIO::setADCResolution(int resolution) {
#elif defined(ARDUINO_ARCH_ESP32)
scaleAnalogRead = true;
_nativeResolution = 13;
#elif defined(ARDUINO_ARCH_RP2040)
scaleAnalogRead = true;
_nativeResolution = 10;
#else
scaleAnalogRead = true;
_nativeResolution = 10;
#endif

_adcResolution = resolution;
Expand Down Expand Up @@ -205,7 +211,6 @@ void Wippersnapper_AnalogIO::deinitAnalogPin(
uint16_t Wippersnapper_AnalogIO::getPinValue(int pin) {
// get pin value
uint16_t value = analogRead(pin);

// scale by the ADC resolution manually if not implemented by BSP
if (scaleAnalogRead) {
if (getADCresolution() > getNativeResolution()) {
Expand Down

0 comments on commit 12ea607

Please sign in to comment.