diff options
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/Arduino.h | 16 | ||||
-rw-r--r-- | cores/arduino/wiring_analog.c | 4 |
2 files changed, 16 insertions, 4 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index f1da68d..09c1448 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -61,10 +61,18 @@ void yield(void); #define FALLING 2 #define RISING 3 -#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) -#define DEFAULT 0 -#define EXTERNAL 1 -#define INTERNAL 2 +#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) + #define DEFAULT 0 + #define EXTERNAL 1 + #define INTERNAL1V1 2 + #define INTERNAL INTERNAL1V1 +#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) + #define DEFAULT 0 + #define EXTERNAL 4 + #define INTERNAL1V1 8 + #define INTERNAL INTERNAL1V1 + #define INTERNAL2V56 9 + #define INTERNAL2V56_EXTCAP 13 #else #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) #define INTERNAL1V1 2 diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 1a4701a..967c2b9 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -64,8 +64,12 @@ int analogRead(uint8_t pin) // channel (low 4 bits). this also sets ADLAR (left-adjust result) // to 0 (the default). #if defined(ADMUX) +#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) + ADMUX = (analog_reference << 4) | (pin & 0x07); +#else ADMUX = (analog_reference << 6) | (pin & 0x07); #endif +#endif // without a delay, we seem to read from the wrong channel //delay(1); |