aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-08-23 15:59:24 +0200
committerCristian Maglie <c.maglie@bug.st>2013-08-23 15:59:24 +0200
commit540743129b2badb813b703208d121ff14553c147 (patch)
tree6fadb4ebce68e1f0cb298a282be135c23fd156ed /cores/arduino
parent073b3ac9d4ae93ac0bb3a91afc65ae9d8f1d5d59 (diff)
parent67c84855c2f3ce99b091a756bb2ca1a016260659 (diff)
Merge branch 'ide-1.5.x' into dev-ide-1.5.x-discovery
Conflicts: app/src/processing/app/Preferences.java app/src/processing/app/debug/Uploader.java
Diffstat (limited to 'cores/arduino')
-rw-r--r--cores/arduino/WString.cpp1
-rw-r--r--cores/arduino/WString.h1
-rw-r--r--cores/arduino/wiring_analog.c16
3 files changed, 8 insertions, 10 deletions
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index db79da4..e462bee 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -134,7 +134,6 @@ inline void String::init(void)
buffer = NULL;
capacity = 0;
len = 0;
- flags = 0;
}
void String::invalidate(void)
diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h
index b3b9f14..f801f63 100644
--- a/cores/arduino/WString.h
+++ b/cores/arduino/WString.h
@@ -191,7 +191,6 @@ protected:
char *buffer; // the actual char array
unsigned int capacity; // the array length minus one (for the '\0')
unsigned int len; // the String length (not counting the '\0')
- unsigned char flags; // unused, for future features
protected:
void init(void);
void invalidate(void);
diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c
index 7ed0e4e..8feead9 100644
--- a/cores/arduino/wiring_analog.c
+++ b/cores/arduino/wiring_analog.c
@@ -41,22 +41,22 @@ int analogRead(uint8_t pin)
{
uint8_t low, high;
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+#if defined(analogPinToChannel)
+#if defined(__AVR_ATmega32U4__)
+ if (pin >= 18) pin -= 18; // allow for channel or pin numbers
+#endif
+ pin = analogPinToChannel(pin);
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega32U4__)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
-#elif defined(analogPinToChannel) && (defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__))
- pin = analogPinToChannel(pin);
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif
-
-#if defined(__AVR_ATmega32U4__)
- pin = analogPinToChannel(pin);
- ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5);
-#elif defined(ADCSRB) && defined(MUX5)
+
+#if defined(ADCSRB) && defined(MUX5)
// the MUX5 bit of ADCSRB selects whether we're reading from channels
// 0 to 7 (MUX5 low) or 8 to 15 (MUX5 high).
ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5);