PWM module - effects of pwm.setup on pwm running status

classic Classic list List threaded Threaded
1 message Options
scdr scdr
Reply | Threaded
Open this post in threaded view

PWM module - effects of pwm.setup on pwm running status

Should pwm.setup leave a running pwm running, should it stop the pwm, or should this be left as platform defined behaviour?

From the example code I think that it might make sense to specify that pwm.setup leaves a pwm running if it was running, or stopped if it was stopped.
(I am not so sure about desirability of changing the frequency, but it is handy to be able to change the duty cycle on the fly, without having to issue a new start command.)

The eLua documentation does not specify what (if any) effect a call to pwm.setup should have on whether a pwm is running or not.
Similarly the platform documentation is silent on this point.

The example code for pwm
seems to assume that changes made by pwm.setup do not require a fresh pwm.start (i.e. that pwm.setup leaves the pwm running if it was running).

However the implementation of platform_pwm_setup on the lm3s calls a Stellarisware function PWMGenConfigure, which says that it leaves the pwm disabled.  To further complicate the picture, I am not sure if the library code actually does what the library documentation says in this case.  (i.e. in some versions of the library it may stop the pwm, and in other versions it may not).  Once I know what effect pwm.setup should have on whether the pwm is running or not, I can fix the lm3s implementation of pwm.setup.  But thought I should check with the community what the behaviour should be.

The function documentation should be updated to reflect whatever behaviour is decided upon.

Thank you.
eLua-dev mailing list
[hidden email]