杰理-手表-马达振动一次
调用 ui_moto_run(2); //振动一次
moto_once_run();
static u16 moto_time_once = 0;
#define RUN_TIME_10MS 1 //100ms 参数2:振动一次的时间长度
static void moto_play_once(void *mode)
{
static u8 count_100ms = 0;
if(count_100ms >= RUN_TIME_10MS )
{
mcpwm_set_duty(moto_pwm_p_data.pwm_ch_num, TCFG_MOTO_PWM_NULL * 100);
ui_moto_in_sleep();
count_100ms = 0;
if(moto_time_once != 0)
sys_timer_del(moto_time_once);
moto_time_once = 0;
}
else
{
count_100ms++;
}
}
void moto_once_run(void)
{
if (get_ui_sys_param(MotoMode) == TCFG_MOTO_PWM_H) {
ui_moto_out_sleep();
mcpwm_set_duty(moto_pwm_p_data.pwm_ch_num, TCFG_MOTO_PWM_H * 100);
} else if (get_ui_sys_param(MotoMode) == TCFG_MOTO_PWM_L) {
ui_moto_out_sleep();
mcpwm_set_duty(moto_pwm_p_data.pwm_ch_num, TCFG_MOTO_PWM_L * 100);
}
if (moto_time_once == 0) {
moto_time_once = sys_timer_add(NULL, moto_play_once, 100);
}
}