From 33a2fff2fc60ea0e6938d72c81812b2afb3bfb0e Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 1 Jun 2012 02:04:59 -0400 Subject: 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 --- wirish/rules.mk | 2 +- wirish/wirish_analog.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'wirish') 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 - #include - #include -/* 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) { -- cgit v1.2.3