区分单击与双击

static u8 key_double_click_cnt = 0;
if (TASK_BT == task_ctl.work_sta) {
if (key_double_click_cnt > 0) { //双击超时计时.
key_double_click_cnt--;
}

if(1 == key_double_click_cnt) {
return DOUBLE_CLICK_KEY;
}

if(DOUBLE_CLICK_KEY == key_val) {
if(key_double_click_cnt) {
key_double_click_cnt = 0;
return DOUBLE_KEY_2CLICK; 
} else {
key_double_click_cnt = 400/5; 判断双击时间,
return NO_KEY;
}
}
}
return key_val;

posted @ 2019-09-03 10:05 残夜微殇 阅读(...) 评论(...) 编辑 收藏