/* Set the duty cycle of the specified channel.  */
void pwmout_write(pwmout_t *obj, float percent)
/* Set the duty cycle of the specified channel.  */
void pwmout_write(pwmout_t *obj, float percent)
{
	u32 ccrx;
	if (percent < (float)0.0) {
	    percent = 0.0;
	} 
	else if (percent > (float)1.0) {
	    percent = 1.0;
	}
	obj->pulse = (percent * obj->period);	ccrx = (u32)(obj->pulse  * 40 / (prescaler + 1)) & 0x0000ffff;
	RTIM_CCRxSet(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], ccrx, obj->pwm_idx & (~BIT_PWM_TIM_IDX_FLAG));
}