Adding functions for pwm.