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.
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.