/* This function is used to initial pwm(capture mode)  */
int tls_pwm_cap_init(u8 channel, u16 clkdiv, bool inverse_en, enum tls_pwm_cap_int_type int_type)
/* This function is used to initial pwm(capture mode)  */
int tls_pwm_cap_init(u8 channel, u16 clkdiv, bool inverse_en, enum tls_pwm_cap_int_type int_type)
{
    if (channel != 0 && channel != 4)
        return WM_FAILED;
    tls_pwm_freq_config(channel, clkdiv, 0xFF);
    tls_pwm_capture_inverse_cmd(channel, inverse_en);
    tls_pwm_capture_mode_config(channel);
    tls_pwm_cnt_type_config(channel, WM_PWM_CNT_TYPE_EDGE_ALLGN_CAP);
    if(channel == 0)
        tls_pwm_output_en_cmd(channel, WM_PWM_OUT_EN_STATE_TRI);
    tls_pwm_loop_mode_config(channel, WM_PWM_LOOP_TYPE_LOOP);
    tls_pwm_capture_irq_type_config(channel, int_type);
    return WM_SUCCESS;
}