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

Add method to allow the GPT Timer period not to be buffered. #131

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Sep 10, 2023

During code review of changes I made to the Servo library: arduino-libraries/Servo#116

@iabdalkader requested that I move all of the platform specific timer changes into the core instead of being in the hardware specific sub-directory of the Servo library.

This change adds a method to tell the GPT timer, that when I make a change to the pseriod (set_period(p) ) that I want the change to happen now and not be buffered.

And updated the set_period method to check for this and directly set the not buffered register with the new period.

During code review of changes I made to the Servo library:
arduino-libraries/Servo#116

@iabdalkader requested that I move all of the platform specific timer changes into the core instead of being in the hardware specific sub-directory of the Servo library.

This change adds a method to tell the GPT timer, that when I make a change to the pseriod (set_period(p) ) that I want the change to happen now and not be buffered.

And updated the set_period method to check for this and directly set the not buffered register with the new period.
KurtE added a commit to KurtE/Arduino_Servo that referenced this pull request Sep 10, 2023
I moved the code that disables the period buffer into a new member function.  I then checked for this in the set_period(p) call, which will either allow it to go to FSP code, or directly set the appropriate register with the new period.

arduino/ArduinoCore-renesas#131
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Sep 10, 2023
@@ -111,6 +112,8 @@ class FspTimer {
bool reset();
bool set_duty_cycle(uint32_t const duty_cycle_counts, TimerPWMChannel_t pwm_ch);
bool set_period(uint32_t p);
bool use_period_buffer(bool buffer_period);

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@@ -470,6 +476,37 @@ bool FspTimer::set_period(uint32_t p) {



/* -------------------------------------------------------------------------- */
bool FspTimer::use_period_buffer(bool buffer_period) {
Copy link
Contributor

@iabdalkader iabdalkader Sep 12, 2023

Choose a reason for hiding this comment

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

I think this should be called set_period_buffer just to match other functions.

Suggested change
bool FspTimer::use_period_buffer(bool buffer_period) {
bool FspTimer::set_period_buffer(bool period_buffer) {

KurtE and others added 2 commits September 12, 2023 05:08
Plus - changes then required to make things match up.

Note: in the header file, I personally believe there should be a blank line above every public API, plus a comment line or lines describing each
of the public APIs, such that they are picked up by context sensitive help.

But that is beyond scope of this PR
Fix typo

Co-authored-by: Ibrahim Abdelkader <[email protected]>
@facchinm facchinm merged commit 1231345 into arduino:main Sep 15, 2023
@KurtE KurtE deleted the fspTimer_noBuffer branch September 15, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants