We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
case SINGLE_PRESS: /1. 首先进入这里前handle->ticks_time_count 已经在multi_press中清零, 而能进入这里的前提是不进入3,如果不进入3,handle->ticks_time_count就必定小于SHORT_PRESS/ if(handle->button_level != handle->active_level) { handle->button_event = (uint8_t)SHORT_PRESS_UP; VITASYNC_EVENT_CB(SHORT_PRESS_UP); //2. 到这里的时候,由1可知handle->ticks_time_count 一定小于SHORT_PRESS(300ms),所以下面的else是冗余部分。 if(handle->ticks_time_count < SHORT_PRESS) { handle->ticks_time_count = 0; handle->button_state = MULTI_PRESS_COUNT; } else { handle->button_state = SHORT_PRESS_DOWN; } //3.如果按键按下时间大于连按间隔时间(程序里面设置是300ms),就进入这里 } else if(handle->ticks_time_count > SHORT_PRESS) { handle->button_state = SHORT_PRESS_UP; } break;
/至于multi press中的single事件回调, 实际上可以通过连续抬起事件去触发, 在回调函数中用switch处理即可。/
The text was updated successfully, but these errors were encountered:
No branches or pull requests
case SINGLE_PRESS:
/1. 首先进入这里前handle->ticks_time_count 已经在multi_press中清零, 而能进入这里的前提是不进入3,如果不进入3,handle->ticks_time_count就必定小于SHORT_PRESS/
if(handle->button_level != handle->active_level) {
handle->button_event = (uint8_t)SHORT_PRESS_UP;
VITASYNC_EVENT_CB(SHORT_PRESS_UP);
//2. 到这里的时候,由1可知handle->ticks_time_count 一定小于SHORT_PRESS(300ms),所以下面的else是冗余部分。
if(handle->ticks_time_count < SHORT_PRESS) {
handle->ticks_time_count = 0;
handle->button_state = MULTI_PRESS_COUNT;
} else {
handle->button_state = SHORT_PRESS_DOWN;
}
//3.如果按键按下时间大于连按间隔时间(程序里面设置是300ms),就进入这里
} else if(handle->ticks_time_count > SHORT_PRESS) {
handle->button_state = SHORT_PRESS_UP;
}
break;
/至于multi press中的single事件回调, 实际上可以通过连续抬起事件去触发, 在回调函数中用switch处理即可。/
The text was updated successfully, but these errors were encountered: