From 806c330371e4acce3e46ec4bb7a0d34e5ea7b11f Mon Sep 17 00:00:00 2001 From: Claudio Indellicati <c.indellicati@arduino.cc> Date: Wed, 6 May 2015 18:45:55 +0200 Subject: [PATCH] Fixed register synchronization in 'analogReadResolution()'. --- cores/arduino/wiring_analog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index ec911de6..369356dd 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -57,7 +57,6 @@ static void syncTCC(Tcc* TCCx) { void analogReadResolution( int res ) { _readResolution = res ; - syncADC(); if (res > 10) { ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_12BIT_Val; @@ -73,6 +72,7 @@ void analogReadResolution( int res ) ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_8BIT_Val; _ADCResolution = 8; } + syncADC(); } void analogWriteResolution( int res ) -- GitLab