Center aligned PWM missing implementation - TODO

What could be included in further releases, or for the forum.
Post Reply
JFClaeys
Posts: 11
Joined: Tue Feb 06, 2018 7:22 pm

Center aligned PWM missing implementation - TODO

Post by JFClaeys » Fri May 04, 2018 10:54 am

I am working on timer and hardwaretimer files in order to get center aligned PWM done.
Basic test support is already coded. At least for blue pill.
Given that the feature is declared as TODO, i though why not try to make it for everyone else.

Problem I have is about how to declare it. There are 4 settings of center aligned available: none, counter up, counter down and both counts.
If taking example on timer_mode TIMER_PWM , the mode_pwm function is hardcoding the output compare to TIMER_OC_MODE_PWM_1. Not giving the chance to set up mode TIMER_OC_MODE_PWM_2.
And thus, I wonder if the same should be done with center align, I.e. there is one setup decided and set hardcoded or if the possibility to allow flexibility is instead offered. Like, the center-aligned-up-and-down-count is what is decided.
Granted, the differences between modes may be too specialized for most users. But those few who require more could add support.
So basically... that is my dilemma.
Is it better to hard code or to give flexibility?
What is the philosophy of stm32duino?
What would you do? What are your thoughts?

Personnaly, i prefer flexibility, but it seems to go against the established way.

Thanks in advance

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Center aligned PWM missing implementation - TODO

Post by stevestrong » Fri May 04, 2018 11:51 am

Flexibility is good as long as it can be integrated in the existing system without too much burden.
Otherwise start with less flexibility which satisfies your application.

As noone else showed interest in this so far, you are the first and therefore you can decide how to implement it in the existing framework.
We had the case of input compare which was later extended according to later needs.

JFClaeys
Posts: 11
Joined: Tue Feb 06, 2018 7:22 pm

Re: Center aligned PWM missing implementation - TODO

Post by JFClaeys » Sat May 05, 2018 12:18 pm

Noted.
Thanks Steve.
Let the fun begins :D

Post Reply