aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_analog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/wirish_analog.cpp')
-rw-r--r--wirish/wirish_analog.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/wirish/wirish_analog.cpp b/wirish/wirish_analog.cpp
index 9e99aa5..8756caf 100644
--- a/wirish/wirish_analog.cpp
+++ b/wirish/wirish_analog.cpp
@@ -31,11 +31,12 @@
#include "io.h"
/* Assumes that the ADC has been initialized and that the pin is set
- * to ANALOG_INPUT */
-uint32 analogRead(uint8 pin) {
- if(PIN_MAP[pin].adc_channel == ADCx) {
+ * to INPUT_ANALOG */
+uint16 analogRead(uint8 pin) {
+ const adc_dev *dev = PIN_MAP[pin].adc_device;
+ if (dev == NULL) {
return 0;
}
- return adc_read(ADC1, PIN_MAP[pin].adc_channel);
+ return adc_read(dev, PIN_MAP[pin].adc_channel);
}