X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/735f9134948b8079d76dddafec6e84e8d160445a..1ab16aec62e20065faba56c469ddf75830860162:/core/pwm/pwm.c?ds=sidebyside diff --git a/core/pwm/pwm.c b/core/pwm/pwm.c index 7f1e2e5..a27b666 100644 --- a/core/pwm/pwm.c +++ b/core/pwm/pwm.c @@ -178,7 +178,7 @@ int pwmSetDutyCycle(uint32_t percentage) } /* Set Duty Cycle (MR0) */ - TMR_TMR16B1MR0 = ((pwmPulseWidth * (100 - (pwmDutyCycle = percentage))) / 100) + 1; + TMR_TMR16B1MR0 = (pwmPulseWidth * (100 - (pwmDutyCycle = percentage))) / 100; return 0; } @@ -246,7 +246,7 @@ int pwmSetFrequencyInMicroseconds(uint16_t us) TMR_TMR16B1MR3 = (pwmPulseWidth = ticks - 1); /* Adjust Duty Cycle (MR0) */ - TMR_TMR16B1MR0 = ((pwmPulseWidth * (100 - pwmDutyCycle)) / 100) + 1; + TMR_TMR16B1MR0 = (pwmPulseWidth * (100 - pwmDutyCycle)) / 100; return 0; }