@@ -61,6 +61,16 @@ typedef uint32_t mfbd_btn_index_t;
61
61
/* set MFBD_MULTICLICK_STATE_AUTO_RESET to 1 will auto set multiclick state to 0 when reach to max multicick state. */
62
62
#define MFBD_MULTICLICK_STATE_AUTO_RESET 1
63
63
64
+ /* set MFBD_MBTN_CONTINUE_LONG_COUNT to 1 will continue count to change state to long after when multiclick state is not 0. */
65
+ #define MFBD_MBTN_CONTINUE_LONG_COUNT 0
66
+
67
+ /*
68
+ * @Note:
69
+ * MFBD_MBTN_MULTICLICK_LONG_EVT only valid when MFBD_MBTN_CONTINUE_LONG_COUNT is not 0.
70
+ * When MFBD_MBTN_MULTICLICK_LONG_EVT is 1, it will still report long code and repeat downcodes after multiclick.
71
+ */
72
+ #define MFBD_MBTN_MULTICLICK_LONG_EVT 0
73
+
64
74
```
65
75
66
76
` mfbd_btn_code_t ` :按键键值的类型。
@@ -92,6 +102,10 @@ typedef uint32_t mfbd_btn_index_t;
92
102
93
103
` MFBD_MULTICLICK_STATE_AUTO_RESET ` :当mbtn达到最大连击次数时,连击次数是否自动返回未连击状态。为` 1 ` ,则自动返回0状态,下次连击则返回按键连击0按键码,为` 0 ` ,则必须等带连击释放时间达到后,才会自动返回0状态,下次连击则返回按键连击最高状态按键码。
94
104
105
+ ` MFBD_MBTN_CONTINUE_LONG_COUNT ` :当mbtn触发连击后,是否继续进行长按检测,为` 1 ` ,则会继续检测长按状态,为` 0 ` ,则不会继续检测。
106
+
107
+ ` MFBD_MBTN_MULTICLICK_LONG_EVT ` :本宏只在` MFBD_MBTN_CONTINUE_LONG_COUNT ` 为` 1 ` 时生效。为` 1 ` ,则会继续上报多击长按后继续上报按键值,长按上报长按键值后,继续计数在重复事件发生后,会上报本次连击的按键值;为` 0 ` ,则不会上报按键值,只会改变按键状态,而且mbtn的重复事件被禁用。
108
+
95
109
## MFBD按键事件
96
110
97
111
### 单击事件
@@ -112,6 +126,7 @@ typedef uint32_t mfbd_btn_index_t;
112
126
连击事件中,每次按键按下后,都会上报指定次数的连击按键值。
113
127
其实连击事件是不应该由按键驱动层进行检测的,但是嵌入式环境资源紧张,不可以像电脑那样交给应用层处理。
114
128
** 注意:多次连击事件和长按事件是冲突的,当长按事件发生,不会进行多次连击的检测。当触发多次连击检测后,也不会进行长按事件的检测**
129
+ 在1.0.5版本后,可以通过配置宏` MFBD_MBTN_CONTINUE_LONG_COUNT ` 为1,和` MFBD_MBTN_MULTICLICK_LONG_EVT ` 为1,可以实现连击和长按的共存。
115
130
116
131
## MFBD按键组结构体
117
132
@@ -322,6 +337,8 @@ mfbd_btn_code_t MFBD_DOWN_CODES_DEF(mbtn)[4] = {0x1501, 0x1511, 0x1521, 0x1531};
322
337
323
338
在读取按键状态的函数中,如果按键按下了,应当返回`MFBD_BTN_STATE_DOWN`,否则返回`MFBD_BTN_STATE_UP`。
324
339
340
+ 针对在矩阵键盘中鬼键,还有另一个状态`MFBD_BTN_STATE_SKIP`,当函数返回`MFBD_BTN_STATE_SKIP`后,MFBD会直接跳过对该按键的检测。
341
+
325
342
```c
326
343
unsigned char bsp_btn_check(mfbd_btn_index_t btn_index)
327
344
{
@@ -501,19 +518,19 @@ GUN gcc工程需要在工程的ld文件中找到`rodata`的初始化链接代码
501
518
/* this is for tbtn in test_btns. * /
502
519
. = ALIGN(4);
503
520
PROVIDE(test_btns_tbtn_start = .);
504
- KEEP(* (test_btns_tbtn* ))
521
+ KEEP (* (SORT( test_btns_tbtn* ) ))
505
522
PROVIDE(test_btns_tbtn_end = .);
506
523
507
524
/* this is for nbtn in test_btns. * /
508
525
. = ALIGN(4);
509
526
PROVIDE(test_btns_nbtn_start = .);
510
- KEEP(* (test_btns_nbtn* ))
527
+ KEEP (* (SORT( test_btns_nbtn* ) ))
511
528
PROVIDE(test_btns_nbtn_end = .);
512
529
513
530
/* this is for mbtn in test_btns. */
514
531
. = ALIGN(4);
515
532
PROVIDE (test_btns_mbtn_start = .);
516
- KEEP(* (test_btns_mbtn* ))
533
+ KEEP (* (SORT( test_btns_mbtn* ) ))
517
534
PROVIDE(test_btns_mbtn_end = .);
518
535
519
536
*(.rodata)
0 commit comments