From 1a280c0d5b66fecd0ef719ed7e31ad685522c2f5 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig Date: Sat, 27 Aug 2016 11:48:04 +0200 Subject: Add all analog references supported by the ATtinyX5 series --- cores/arduino/wiring_analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cores/arduino/wiring_analog.c') diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 1a4701a..c545e6d 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -64,7 +64,7 @@ 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 << 6) | (pin & 0x07); + ADMUX = ((analog_reference & 0x3) << 6) | ((analog_reference & 0x4) ? 0x10 : 0) | (pin & 0x07); #endif // without a delay, we seem to read from the wrong channel -- cgit v1.2.3-18-g5258