Skip to content

Commit

Permalink
Requested changes to not change code for non ATtinyX5s
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Sep 7, 2016
1 parent 5d15f09 commit a2a17a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions hardware/arduino/avr/cores/arduino/Arduino.h
Expand Up @@ -68,11 +68,11 @@ void yield(void);
#define INTERNAL INTERNAL1V1
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
#define DEFAULT 0
#define EXTERNAL 1
#define INTERNAL1V1 2
#define EXTERNAL 4
#define INTERNAL1V1 8
#define INTERNAL INTERNAL1V1
#define INTERNAL2V56 6
#define INTERNAL2V56_EXTCAP 7
#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
Expand Down
6 changes: 5 additions & 1 deletion hardware/arduino/avr/cores/arduino/wiring_analog.c
Expand Up @@ -64,7 +64,11 @@ int analogRead(uint8_t pin)
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
// to 0 (the default).
#if defined(ADMUX)
ADMUX = ((analog_reference & 0x3) << 6) | ((analog_reference & 0x4) ? 0x10 : 0) | (pin & 0x07);
#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
Expand Down

0 comments on commit a2a17a0

Please sign in to comment.