Added validation to make sure a pin can be reused as pwm, after it has been used and the duty cycle is bigger than the period.