Skip to content

Commit 806c330

Browse files
Claudio Indellicaticmaglie
authored andcommitted
Fixed register synchronization in 'analogReadResolution()'.
1 parent 3912d9d commit 806c330

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/wiring_analog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014 Arduino. All right reserved.
2+
Copyright (c) 2014 Arduino LLC. All right reserved.
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Lesser General Public
@@ -57,7 +57,6 @@ static void syncTCC(Tcc* TCCx) {
5757
void analogReadResolution( int res )
5858
{
5959
_readResolution = res ;
60-
syncADC();
6160
if (res > 10)
6261
{
6362
ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_12BIT_Val;
@@ -73,6 +72,7 @@ void analogReadResolution( int res )
7372
ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_8BIT_Val;
7473
_ADCResolution = 8;
7574
}
75+
syncADC();
7676
}
7777

7878
void analogWriteResolution( int res )

0 commit comments

Comments
 (0)