Skip to content

Commit 6c33c5d

Browse files
committed
Fixed analogWriteResolution() behaviour for PWM pins
1 parent caf00d4 commit 6c33c5d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cores/arduino/wiring_analog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,13 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue )
260260
break ;
261261
}
262262

263+
ulValue = mapResolution(ulValue, _writeResolution, 8);
264+
263265
// Set PORT
264266
if ( isTC )
265267
{
266268
// -- Configure TC
269+
267270
// DISABLE TCx
268271
TCx->COUNT8.CTRLA.reg &=~(TC_CTRLA_ENABLE);
269272
// Set Timer counter Mode to 8 bits

0 commit comments

Comments
 (0)