first pass at implementing PWM functions