MultiButton icon indicating copy to clipboard operation
MultiButton copied to clipboard

Button driver for embedded system

Results 34 MultiButton issues
Sort by recently updated
recently updated
newest added

问题描述: 1. 当按键按以下顺序按下时: 短按 -> 长按,`handle->state` 的值 `0 -> 1 -> 2 -> 0 -> 1`,会多触发一次 `EVENT_CB(PRESS_DOWN);` 事件回调,实际不需要,`handle->state` 的正确状态应该为 `0 -> 1 -> 2 -> 1`

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 {...

`unit8_t`->`uint8_t` #43

您好,请问一下长按连发只会触发一次是什么原因,其他情况都试过没有问题 ```c button_init(&button1, read_button_GPIO, GPIO_PIN_RESET, btn1_id); static PressEvent btn1_event_val; button_start(&button1); while (1) { /*轮询读取键值模式*/ if (btn1_event_val != get_button_event(&button1)) { btn1_event_val = get_button_event(&button1); switch (btn1_event_val) { case SINGLE_CLICK: HAL_GPIO_TogglePin(LED_B_GPIO_Port, LED_B_Pin); break;...

馃摗 [1] Polled Event: Press Down | Pressed: Yes 馃摗 [2] Polled Event: Press Up | Pressed: No 馃摗 [3] Polled Event: Single Click 鉁?| Pressed: No 馃摗 [4] Polled...

``` C case BTN_STATE_REPEAT: if (handle->button_level != handle->active_level) { // Button released handle->event = (uint8_t)BTN_PRESS_UP; EVENT_CB(BTN_PRESS_UP); if (handle->ticks < SHORT_TICKS) { handle->ticks = 0; handle->state = BTN_STATE_RELEASE; // Continue waiting...

当注册BTN_PRESS_REPEAT事件回调函数时,在如下状态机时实际触发的是BTN_PRESS_DOWN

![Image](https://github.com/user-attachments/assets/dfe0d3af-23c9-4cf1-84d8-02ded48c1000) 兄弟,你能否实现easybutton里面的组合按键,长按1秒,长按2秒,长按3秒,长按N秒功能? 这个作者实现的easybutton已经完美解决了所有嵌入式当中用到的各种按键场景,比如2个或多个组合按键功能,你懂得, 就像电脑上的FN+F1, Shift+Delet按键等等!你的库不支持组合按键,你能否实现?还有你的MultiButton长按只能实现一种, 只有触发长按后才能执行一种,这样不管长按1秒,2秒,3秒,你的MultiButton库都只会当成1秒处理,很多时候像智能手表上只有一个实体用户按键,我需要长按1秒实现A功能,长按2秒实现B功能,长按3秒实现C功能,长按N秒实现N功能,可以无限的,你能修复MultiButton的这些bug吗???