Added missing 3 modes to pwm_op_inv, & split into functions