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

![multi_button](https://user-images.githubusercontent.com/45490946/94422301-79dc7280-01b9-11eb-8dfc-898b96b5afe1.png) 这是我整理的 MultiButton 状态图,分享给大家,一定程度上能帮助学习源码。 黄色框框里的注释是用户关注的事件,即会调用事件对应的回调函数。 黄色框框上方的注释是状态机实际切换状态的事件。

使用时发现,在双击(或更多次连续点击)后,无法正常触发长按事件。

源码写得精彩!拜读并仔细分析了一下,有个问题想请教。按键去抖需要3次按键值(间隔5ms)相同才能确认,但是在状态机处理中,感觉没有完全用去抖处理后的按键值进行判断处理,而是用上次保存或去抖处理后的按键值进行处理,这样对一些需要延时判断的按键动作判断会不会有影响?能否加一个按键去抖有效标志做辅助判断,一旦去抖完毕,此标志有效,后续状态机只有在标志有效情况下才取按键值进行处理,处理完后标志置为无效。不知我的理解是否正确?请指点,谢谢!

开发环境如下:uvision V4.10 ![image](https://user-images.githubusercontent.com/54672535/75739134-0d8eb300-5d3f-11ea-8e82-0266c6dfbd04.png) 按键初始化函数需要修改下: ![image](https://user-images.githubusercontent.com/54672535/75739221-49297d00-5d3f-11ea-9441-53b85d2ffc42.png) 猜测是编译器有问题。

case 2: if (handle->button_level == handle->active_level) { handle->event = (uint8_t)PRESS_DOWN; EVENT_CB(PRESS_DOWN); handle->repeat++; handle->event = (uint8_t)PRESS_REPEAT;//为什么不加这句,不加回调出去不就错了事件类型。 EVENT_CB(PRESS_REPEAT); handle->ticks = 0; handle->state = 3; } else if (handle->ticks > SHORT_TICKS) { if...

```C unit8_t btn1_id = 0; struct Button btn1; uint8_t read_button_GPIO(uint8_t button_id) { // you can share the GPIO read function with multiple Buttons switch(button_id) { case btn1_id: return HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);...

# Summary This pull request introduces a CodeQL workflow to enhance the security analysis of this repository. # What is CodeQL CodeQL is a static analysis tool that helps identify...