Skip to content

Commit 34b81c2

Browse files
authored
Merge pull request arduino#70 from adafruit/dm-hallowing-pwm
fix pwm for m0
2 parents c629896 + 0c9bb34 commit 34b81c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/arduino/wiring_analog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,11 @@ void analogWrite(uint32_t pin, uint32_t value)
368368
if (pin == PIN_A0) { // Only 1 DAC on A0 (PA02)
369369
#endif
370370

371-
value = mapResolution(value, _writeResolution, _dacResolution);
372-
373371
#if defined(__SAMD51__)
374372

373+
value = mapResolution(value, _writeResolution, _dacResolution);
374+
375+
375376
uint8_t channel = (pin == PIN_A0 ? 0 : 1);
376377

377378
pinPeripheral(pin, PIO_ANALOG);
@@ -557,7 +558,6 @@ void analogWrite(uint32_t pin, uint32_t value)
557558

558559
if (!tcEnabled[tcNum]) {
559560
tcEnabled[tcNum] = true;
560-
value = mapResolution(value, _writeResolution, 16);
561561
uint16_t GCLK_CLKCTRL_IDs[] = {
562562
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC0
563563
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC1

0 commit comments

Comments
 (0)