aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_analog.c
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/wirish_analog.c')
-rw-r--r--wirish/wirish_analog.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/wirish/wirish_analog.c b/wirish/wirish_analog.c
index f4c1204..1b911bc 100644
--- a/wirish/wirish_analog.c
+++ b/wirish/wirish_analog.c
@@ -30,13 +30,12 @@
#include "wirish.h"
#include "io.h"
-extern const PinMapping PIN_MAP[NR_MAPLE_PINS];
-
/* Assumes that the ADC has been initialized and
* that the pin is set to ANALOG_INPUT */
uint32 analogRead(uint8 pin) {
- if (pin >= NR_ANALOG_PINS)
+ if(PIN_MAP[pin].adc == ADC_INVALID) {
return 0;
+ }
return adc_read(PIN_MAP[pin].adc);
}