Skip to content

Commit c36f7c8

Browse files
authored
Merge pull request #9 from smartmx/dev-1.0.5
Dev 1.0.5
2 parents ec5a088 + 796d123 commit c36f7c8

File tree

6 files changed

+910
-492
lines changed

6 files changed

+910
-492
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ typedef uint32_t mfbd_btn_index_t;
6161
/* set MFBD_MULTICLICK_STATE_AUTO_RESET to 1 will auto set multiclick state to 0 when reach to max multicick state. */
6262
#define MFBD_MULTICLICK_STATE_AUTO_RESET 1
6363

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+
6474
```
6575

6676
`mfbd_btn_code_t`:按键键值的类型。
@@ -92,6 +102,10 @@ typedef uint32_t mfbd_btn_index_t;
92102

93103
`MFBD_MULTICLICK_STATE_AUTO_RESET`:当mbtn达到最大连击次数时,连击次数是否自动返回未连击状态。为`1`,则自动返回0状态,下次连击则返回按键连击0按键码,为`0`,则必须等带连击释放时间达到后,才会自动返回0状态,下次连击则返回按键连击最高状态按键码。
94104

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+
95109
## MFBD按键事件
96110

97111
### 单击事件
@@ -112,6 +126,7 @@ typedef uint32_t mfbd_btn_index_t;
112126
连击事件中,每次按键按下后,都会上报指定次数的连击按键值。
113127
其实连击事件是不应该由按键驱动层进行检测的,但是嵌入式环境资源紧张,不可以像电脑那样交给应用层处理。
114128
**注意:多次连击事件和长按事件是冲突的,当长按事件发生,不会进行多次连击的检测。当触发多次连击检测后,也不会进行长按事件的检测**
129+
在1.0.5版本后,可以通过配置宏`MFBD_MBTN_CONTINUE_LONG_COUNT`为1,和`MFBD_MBTN_MULTICLICK_LONG_EVT`为1,可以实现连击和长按的共存。
115130

116131
## MFBD按键组结构体
117132

@@ -322,6 +337,8 @@ mfbd_btn_code_t MFBD_DOWN_CODES_DEF(mbtn)[4] = {0x1501, 0x1511, 0x1521, 0x1531};
322337
323338
在读取按键状态的函数中,如果按键按下了,应当返回`MFBD_BTN_STATE_DOWN`,否则返回`MFBD_BTN_STATE_UP`。
324339
340+
针对在矩阵键盘中鬼键,还有另一个状态`MFBD_BTN_STATE_SKIP`,当函数返回`MFBD_BTN_STATE_SKIP`后,MFBD会直接跳过对该按键的检测。
341+
325342
```c
326343
unsigned char bsp_btn_check(mfbd_btn_index_t btn_index)
327344
{
@@ -501,19 +518,19 @@ GUN gcc工程需要在工程的ld文件中找到`rodata`的初始化链接代码
501518
/* this is for tbtn in test_btns. */
502519
. = ALIGN(4);
503520
PROVIDE(test_btns_tbtn_start = .);
504-
KEEP(*(test_btns_tbtn*))
521+
KEEP (*(SORT(test_btns_tbtn*)))
505522
PROVIDE(test_btns_tbtn_end = .);
506523

507524
/* this is for nbtn in test_btns. */
508525
. = ALIGN(4);
509526
PROVIDE(test_btns_nbtn_start = .);
510-
KEEP(*(test_btns_nbtn*))
527+
KEEP (*(SORT(test_btns_nbtn*)))
511528
PROVIDE(test_btns_nbtn_end = .);
512529

513530
/* this is for mbtn in test_btns. */
514531
. = ALIGN(4);
515532
PROVIDE(test_btns_mbtn_start = .);
516-
KEEP(*(test_btns_mbtn*))
533+
KEEP (*(SORT(test_btns_mbtn*)))
517534
PROVIDE(test_btns_mbtn_end = .);
518535

519536
*(.rodata)

0 commit comments

Comments
 (0)