/* param base Ctimer peripheral base address param pwmPeriodChannel Specify the channel to control the PWM period param matchChannel Match pin to be used to output the PWM signal param dutyCyclePercent New PWM pulse width; the value should be between 0 to 100  */
void CTIMER_UpdatePwmDutycycle(CTIMER_Type *base, const ctimer_match_t pwmPeriodChannel, ctimer_match_t matchChannel, uint8_t dutyCyclePercent)
/* param base Ctimer peripheral base address param pwmPeriodChannel Specify the channel to control the PWM period param matchChannel Match pin to be used to output the PWM signal param dutyCyclePercent New PWM pulse width; the value should be between 0 to 100  */
void CTIMER_UpdatePwmDutycycle(CTIMER_Type *base, const ctimer_match_t pwmPeriodChannel, ctimer_match_t matchChannel, uint8_t dutyCyclePercent)
{
    uint32_t pulsePeriod = 0, period;
    period = base->MR[pwmPeriodChannel];
    if (dutyCyclePercent == 0U)
    {
        pulsePeriod = period + 1U;
    }
    else
    {
        pulsePeriod = (period * (100U - (uint32_t)dutyCyclePercent)) / 100U;
    }
    base->MR[matchChannel] = pulsePeriod;
}