Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LPC824] Fixed PwmOut SCT Bugs #1585

Merged
merged 2 commits into from Mar 4, 2016
Merged

[LPC824] Fixed PwmOut SCT Bugs #1585

merged 2 commits into from Mar 4, 2016

Conversation

toyowata
Copy link
Contributor

@toyowata toyowata commented Mar 3, 2016

Bug fixes related to issue #1510:

  • Fixed period & pulse-width off-by-one errors
  • Fixed 0% and 100% duty cycle output

I have tested this with manual test and MBED_5: PWM test:

Initialize PWM on pin D9 with duty cycle: 0.75
{{success}}
{{end}}

* Fixed period & pulse-width off-by-one errors
* Fixed 0% and 100% duty cycle output
obj->pwm->MATCHREL[(obj->pwm_ch * 2) + 1] = (uint32_t)((float)us * (float)v);
obj->pwm->MATCHREL[(obj->pwm_ch * 2) + 0] = (uint32_t)us - 1;
if (us > 0) {
obj->pwm->MATCHREL[(obj->pwm_ch * 2) + 1] = (uint32_t)((float)us * (float)v) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be beneficial to add comments why us > 0 , what it handles, or lines like below obj->pwm->CTRL |= (1 << 2) | (1 << 3); ? I without the reference manual have no clue what is going on. From the commit message, off by one errors are probably for lines 158 and 159, and then if (value != 1.0f) is probably for 100 percent error (also from the commit message).

@toyowata
Copy link
Contributor Author

toyowata commented Mar 4, 2016

Thank you for your comment. I added more comments in the code. Can you review?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 4, 2016

Thank you for your comment. I added more comments in the code. Can you review?

+1 , we should understand the intention better now.

0xc0170 added a commit that referenced this pull request Mar 4, 2016
[LPC824] Fixed PwmOut SCT Bugs
@0xc0170 0xc0170 merged commit 1020d7c into ARMmbed:master Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants