aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-01 02:04:59 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-01 02:04:59 -0400
commit33a2fff2fc60ea0e6938d72c81812b2afb3bfb0e (patch)
treed1516ac69baf8d26f77f672151785f43a65f93d6 /wirish
parentc134c8b1e1df0b06d21aa98e385e0255107319a0 (diff)
downloadlibrambutan-33a2fff2fc60ea0e6938d72c81812b2afb3bfb0e.tar.gz
librambutan-33a2fff2fc60ea0e6938d72c81812b2afb3bfb0e.zip
Bring back analogRead().
Yay, it just worked! Still, while we're here, touch up the make-up on wirish_analog.cpp. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'wirish')
-rw-r--r--wirish/rules.mk2
-rw-r--r--wirish/wirish_analog.cpp11
2 files changed, 7 insertions, 6 deletions
diff --git a/wirish/rules.mk b/wirish/rules.mk
index 4084448..deb3906 100644
--- a/wirish/rules.mk
+++ b/wirish/rules.mk
@@ -24,6 +24,7 @@ cppSRCS_$(d) := boards.cpp
cppSRCS_$(d) += cxxabi-compat.cpp
cppSRCS_$(d) += HardwareSerial.cpp
cppSRCS_$(d) += Print.cpp
+cppSRCS_$(d) += wirish_analog.cpp
cppSRCS_$(d) += wirish_digital.cpp
cppSRCS_$(d) += wirish_math.cpp
cppSRCS_$(d) += wirish_shift.cpp
@@ -35,7 +36,6 @@ cppSRCS_$(d) += $(WIRISH_BOARD_PATH)/board.cpp
# HardwareSPI.cpp
# HardwareTimer.cpp
# usb_serial.cpp
-# wirish_analog.cpp
# pwm.cpp
# ext_interrupts.cpp
diff --git a/wirish/wirish_analog.cpp b/wirish/wirish_analog.cpp
index 7a12156..91ca0e2 100644
--- a/wirish/wirish_analog.cpp
+++ b/wirish/wirish_analog.cpp
@@ -2,6 +2,7 @@
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
+ * Copyright (c) 2011, 2012 LeafLabs, LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -25,17 +26,17 @@
*****************************************************************************/
/**
- * @brief Arduino-compatible ADC implementation.
+ * @file wirish/wirish_analog.cpp
+ * @brief Wiring-style analogRead() implementation.
*/
#include <wirish/io.h>
-
#include <libmaple/adc.h>
-
#include <wirish/boards.h>
-/* Assumes that the ADC has been initialized and that the pin is set
- * to INPUT_ANALOG */
+/* Unlike Wiring and Arduino, this assumes that the pin's mode is set
+ * to INPUT_ANALOG. That's faster, but it does require some extra work
+ * on the user's part. Not too much, we think ;). */
uint16 analogRead(uint8 pin) {
const adc_dev *dev = PIN_MAP[pin].adc_device;
if (dev == NULL) {