What is the preferred way to stop doing analogWrite (PWM) on a pin in Energia?
For instance how should I change a pin to digitalWrite, or change it to input, or to just prepare to stop using the pin?
In particular, how do you stop the timer (which is used to generate the PWM)?
Studying the code for analogWrite, digitalWrite and pinMode I do not see where PWM timers are ever stopped once they are started. (I looked at the code on MSP430, Stellaris, and CC3200). To confirm my impression, I ran a little test on an MSP430. While I can change mode to output and/or do a digitalWrite to change the pin after doing an analogWrite, it appears that the timer just keeps ticking away, even though it is no longer controlling the pin.
(I haven't tested this on the other platforms or tested whether changing the pin to input stops the timer.)
Is there some glitch where the timers have to be left running once started?
Why would one care if the timer keeps running?
It uses power (or is this an insignificant amount of power, even on an MSP430 or CC3200 running on a battery).
It might make bookkeeping a little easier if unused timers were stopped. (e.g. easier to tell which ones could safely be used for other purposes).
Thanks.