File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ void yield(void);
68
68
#define INTERNAL INTERNAL1V1
69
69
#elif defined(__AVR_ATtiny25__ ) || defined(__AVR_ATtiny45__ ) || defined(__AVR_ATtiny85__ )
70
70
#define DEFAULT 0
71
- #define EXTERNAL 1
72
- #define INTERNAL1V1 2
71
+ #define EXTERNAL 4
72
+ #define INTERNAL1V1 8
73
73
#define INTERNAL INTERNAL1V1
74
- #define INTERNAL2V56 6
75
- #define INTERNAL2V56_EXTCAP 7
74
+ #define INTERNAL2V56 9
75
+ #define INTERNAL2V56_EXTCAP 13
76
76
#else
77
77
#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__ )
78
78
#define INTERNAL1V1 2
Original file line number Diff line number Diff line change @@ -64,7 +64,11 @@ int analogRead(uint8_t pin)
64
64
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
65
65
// to 0 (the default).
66
66
#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
68
72
#endif
69
73
70
74
// without a delay, we seem to read from the wrong channel
You can’t perform that action at this time.
0 commit comments