Skip to content

Commit da68b6f

Browse files
author
Brian Baltz
committed
ATLEDGE-516 Stop callback when setting duty cycle to 0
Signed-off-by: Brian Baltz <[email protected]>
1 parent ef62ce6 commit da68b6f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/CurieTimerOne/CurieTimer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ int CurieTimer::pwmStart(unsigned int outputPin, double dutyPercentage, unsigned
163163
pinMode(pwmPin, OUTPUT);
164164

165165
if(dutyPercentage == 0.0) {
166+
// If PWM is already running, reset the timer and set pin to LOW
167+
kill();
166168
digitalWrite(pwmPin, LOW);
167169
return SUCCESS;
168170
}

0 commit comments

Comments
 (0)