File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
hardware/arduino/avr/cores/arduino Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ void yield(void);
6868 #define INTERNAL INTERNAL1V1
6969#elif defined(__AVR_ATtiny25__ ) || defined(__AVR_ATtiny45__ ) || defined(__AVR_ATtiny85__ )
7070 #define DEFAULT 0
71- #define EXTERNAL 1
72- #define INTERNAL1V1 2
71+ #define EXTERNAL 4
72+ #define INTERNAL1V1 8
7373 #define INTERNAL INTERNAL1V1
74- #define INTERNAL2V56 6
75- #define INTERNAL2V56_EXTCAP 7
74+ #define INTERNAL2V56 9
75+ #define INTERNAL2V56_EXTCAP 13
7676#else
7777#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__ )
7878#define INTERNAL1V1 2
Original file line number Diff line number Diff line change @@ -64,7 +64,11 @@ int analogRead(uint8_t pin)
6464 // channel (low 4 bits). this also sets ADLAR (left-adjust result)
6565 // to 0 (the default).
6666#if defined(ADMUX )
67- ADMUX = ((analog_reference & 0x3 ) << 6 ) | ((analog_reference & 0x4 ) ? 0x10 : 0 ) | (pin & 0x07 );
67+ #if defined(__AVR_ATtiny25__ ) || defined(__AVR_ATtiny45__ ) || defined(__AVR_ATtiny85__ )
68+ ADMUX = (analog_reference << 4 ) | (pin & 0x07 );
69+ #else
70+ ADMUX = (analog_reference << 6 ) | (pin & 0x07 );
71+ #endif
6872#endif
6973
7074 // without a delay, we seem to read from the wrong channel
You can’t perform that action at this time.
0 commit comments