libraries/WM_Libraries/Platform/Drivers/pwm/wm_pwm.c
int tls_pwm_stoptime_by_period_config(u8 channel, u8 pnum)
{
    u32 temp = 0;
    
    if(channel > (PWM_CHANNEL_MAX_NUM - 1))
		return WM_FAILED;

    if (4 == channel)
    {
        temp = tls_reg_read32(HR_PWM_CH4_REG1) & ~0x000000FF;
        temp |= pnum;
        tls_reg_write32(HR_PWM_CH4_REG1, temp);
    }
    else
    {
        temp = tls_reg_read32(HR_PWM_PNUM) & ~(0xFF << channel * 8);
        temp |= (pnum << (channel * 8));
        tls_reg_write32(HR_PWM_PNUM, temp);
        
    }

    return WM_SUCCESS;
}
/**
 * @brief          This function is used to set the number of period to be generated
 *
 * @param[in]      channel    pwm channel NO.,range form 0 to 4
 * @param[in]      pnum       the number of period to be generated,range from 0 to 255
 *
 * @retval         WM_SUCCESS success
 * @retval         WM_FAILED  failed
 *
 * @note           None
 */
@brief          This function is used to set the number of period to be generated
@param[in]      channel    pwm channel NO.,range form 0 to 4
@param[in]      pnum       the number of period to be generated,range from 0 to 255



@note           None
@brief This function is used to set the number of period to be generated @param [ in ] channel pwm channel NO . range form 0 to 4 @param [ in ] pnum the number of period to be generated range from 0 to 255 @note None
int tls_pwm_stoptime_by_period_config(u8 channel, u8 pnum)
{
    u32 temp = 0;
    if(channel > (PWM_CHANNEL_MAX_NUM - 1))
		return WM_FAILED;
    if (4 == channel)
    {
        temp = tls_reg_read32(HR_PWM_CH4_REG1) & ~0x000000FF;
        temp |= pnum;
        tls_reg_write32(HR_PWM_CH4_REG1, temp);
    }
    else
    {
        temp = tls_reg_read32(HR_PWM_PNUM) & ~(0xFF << channel * 8);
        temp |= (pnum << (channel * 8));
        tls_reg_write32(HR_PWM_PNUM, temp);
    }
    return WM_SUCCESS;
}
int tls_pwm_stoptime_by_period_config ( u8 channel , u8 pnum ) { u32 temp = 0 ; if ( channel > ( PWM_CHANNEL_MAX_NUM - 1 ) ) return WM_FAILED ; if ( 4 == channel ) { temp = tls_reg_read32 ( HR_PWM_CH4_REG1 ) & ~ 0x000000FF ; temp |= pnum ; tls_reg_write32 ( HR_PWM_CH4_REG1 , temp ) ; } else { temp = tls_reg_read32 ( HR_PWM_PNUM ) & ~ ( 0xFF << channel * 8 ) ; temp |= ( pnum << ( channel * 8 ) ) ; tls_reg_write32 ( HR_PWM_PNUM , temp ) ; } return WM_SUCCESS ; }
@brief          This function is used to set the number of period to be generated
 @param[in]      channel    pwm channel NO.,range form 0 to 4
 @param[in]      pnum       the number of period to be generated,range from 0 to 255
@brief This function is used to set the number of period to be generated @param [ in ] channel pwm channel NO . range form 0 to 4 @param [ in ] pnum the number of period to be generated range from 0 to 255