@@ -89,6 +89,12 @@ void Wippersnapper_AnalogIO::setADCResolution(int resolution) {
89
89
#elif defined(ARDUINO_ARCH_ESP32)
90
90
scaleAnalogRead = true ;
91
91
_nativeResolution = 13 ;
92
+ #elif defined(ARDUINO_ARCH_RP2040)
93
+ scaleAnalogRead = true ;
94
+ _nativeResolution = 10 ;
95
+ #else
96
+ scaleAnalogRead = true ;
97
+ _nativeResolution = 10 ;
92
98
#endif
93
99
94
100
_adcResolution = resolution;
@@ -101,7 +107,11 @@ void Wippersnapper_AnalogIO::setADCResolution(int resolution) {
101
107
The scaled analog resolution, in bits.
102
108
*/
103
109
/* **********************************************************************************/
104
- int Wippersnapper_AnalogIO::getADCresolution () { return _adcResolution; }
110
+ int Wippersnapper_AnalogIO::getADCresolution () {
111
+ WS_DEBUG_PRINT (" Returning ADC resolution: " );
112
+ WS_DEBUG_PRINTLN (_adcResolution);
113
+ return _adcResolution;
114
+ }
105
115
106
116
/* **********************************************************************************/
107
117
/* !
@@ -110,7 +120,11 @@ int Wippersnapper_AnalogIO::getADCresolution() { return _adcResolution; }
110
120
The native analog resolution, in bits.
111
121
*/
112
122
/* **********************************************************************************/
113
- int Wippersnapper_AnalogIO::getNativeResolution () { return _nativeResolution; }
123
+ int Wippersnapper_AnalogIO::getNativeResolution () {
124
+ WS_DEBUG_PRINT (" Returning native ADC resolution: " );
125
+ WS_DEBUG_PRINTLN (_nativeResolution);
126
+ return _nativeResolution;
127
+ }
114
128
115
129
/* **********************************************************************************/
116
130
/* !
@@ -205,9 +219,13 @@ void Wippersnapper_AnalogIO::deinitAnalogPin(
205
219
uint16_t Wippersnapper_AnalogIO::getPinValue (int pin) {
206
220
// get pin value
207
221
uint16_t value = analogRead (pin);
208
-
222
+ WS_DEBUG_PRINT (" Analog Pin (#" );
223
+ WS_DEBUG_PRINT (pin);
224
+ WS_DEBUG_PRINT (" ) read: " );
225
+ WS_DEBUG_PRINTLN (value);
209
226
// scale by the ADC resolution manually if not implemented by BSP
210
227
if (scaleAnalogRead) {
228
+ WS_DEBUG_PRINTLN (" Scaling analog read value..." );
211
229
if (getADCresolution () > getNativeResolution ()) {
212
230
value = value << (getADCresolution () - getNativeResolution ());
213
231
} else {
0 commit comments