aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_analog.cpp
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/wirish_analog.cpp
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/wirish_analog.cpp')
-rw-r--r--wirish/wirish_analog.cpp11
1 files changed, 6 insertions, 5 deletions
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) {