[bug] Updates the power API to correct a frequency update related bug.#156
Open
luizvilla wants to merge 1 commit into
Open
[bug] Updates the power API to correct a frequency update related bug.#156luizvilla wants to merge 1 commit into
luizvilla wants to merge 1 commit into
Conversation
When frequency is updated, the duty cycle is not. This means that when updating the duty cycle the period is not refreshed and the values passed to the spin API were wrong.
Member
Author
|
All files necessary for flashing are here. I have not tested with other examples. |
Ayoub-Farah
approved these changes
Jul 6, 2026
Ayoub-Farah
left a comment
Member
There was a problem hiding this comment.
Functionally, this is okay, but it would be useful to add in the doxygen comments that setFrequency() must not be called with a frequency lower than the value returned by getFrequencyMin(), and that this minimum frequency is initialized from the Device Tree min-frequency property.
Ayoub-Farah
requested changes
Jul 6, 2026
| void PowerAPI::setFrequency(uint32_t frequency) | ||
| { | ||
| spin.pwm.setFrequency(frequency); | ||
| timer_frequency = frequency; |
Member
There was a problem hiding this comment.
spin.pwm.setFrequency can clamp the minimal frequency value, but timerFrequency is getting the original frequency input.
There is a need to clamp it to timer_frequency_min if frequency is inferior to that value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
When frequency is updated, the duty cycle is not.
This means that when updating the duty cycle the period is not refreshed and the values passed to the spin API were wrong.
Correction
I've created a setFrenquency, getFrequency and getFrenquecyMin so that the user can manipulate the frequency with better ease.
Tests
I've built and tested it with the test code that will be attached on the next message.