aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_analog.c
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-08-31 17:17:57 -0400
committerbnewbold <bnewbold@robocracy.org>2010-08-31 17:17:57 -0400
commite03d58f4dab4176514924baa3a1ff430bf5819b8 (patch)
treeb5c8269c34ab3bb4da0f7c52dea7049966753fb3 /wirish/wirish_analog.c
parent01c38f5567bf624413d901c2b287e63cdccd03a6 (diff)
downloadlibrambutan-e03d58f4dab4176514924baa3a1ff430bf5819b8.tar.gz
librambutan-e03d58f4dab4176514924baa3a1ff430bf5819b8.zip
Further wirish portability progress
Sort of ugly changes. Compiles but untested.
Diffstat (limited to 'wirish/wirish_analog.c')
-rw-r--r--wirish/wirish_analog.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wirish/wirish_analog.c b/wirish/wirish_analog.c
index 2a8d662..1b911bc 100644
--- a/wirish/wirish_analog.c
+++ b/wirish/wirish_analog.c
@@ -33,8 +33,9 @@
/* 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);
}