aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/feature_debounce_algo.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/feature_debounce_algo.md b/docs/feature_debounce_algo.md
new file mode 100644
index 000000000..2c694cdfb
--- /dev/null
+++ b/docs/feature_debounce_algo.md
@@ -0,0 +1,53 @@
1# Debounce algorithm
2
3QMK supports multiple debounce algorithms through its debounce API.
4
5The underlying debounce algorithm is determined by which matrix.c file you are using.
6
7The logic for which debounce method called is below. It checks various defines that you have set in rules.mk
8
9```
10ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
11 # Do nothing, debouncing is inside matrix.c inside split_common
12else ifeq ($(strip $(DEBOUNCE_ALGO)), manual)
13 # Do nothing. do your debouncing in matrix.c
14else ifeq ($(strip $(DEBOUNCE_ALGO)), sym_g)
15 TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c
16else ifeq ($(strip $(DEBOUNCE_ALGO)), eager_pk)
17 TMK_COMMON_SRC += $(DEBOUNCE)/debounce_eager_pk.c
18else ifeq ($(strip $(CUSTOM_MATRIX)), yes)
19 # Do nothing. Custom matrix code.
20else # default algorithm
21 TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c
22endif
23```
24
25# Debounce selection
26The following is for keyboards where ```SPLIT_KEYBOARD``` is **not** defined as ```YES```
27
28| DEBOUNCE_ALGO | CUSTOM_MATRIX | Description | What to do |
29| ------------- | -------------| --------------------------------------------------- | ----------------------------- |
30| Not defined | Not defined | You are using the included matrix.c and debounce.c | Nothing. Debounce_sym_g used. |
31| manual | Not defined | You are using the included matrix.c but your own debounce.c | ```SRC += debounce.c``` add your own debounce.c and implement necessary functions |
32| sym_g / eager_pk | Not defined | You are using the included matrix.c and debounce.c | Nothing. Chosen debounce method used. |
33| Not defined | YES | You have your own matrix.c, and your own debounce | Write the fully debounced matrix into matrix.c's matrix |
34| manual | YES | Same as above | same as above |
35| sym_g/ eager_pk | YES | You are using your own matrix.c, but included debounce | Write the raw matrix values into matrix.c's matrix |
36
37**Note**:
38If ```SPLIT_KEYBOARD = YES``` is defined, the algorithm inside split_common will be used.
39A future pull request will fix this to use the debounce.c code.
40
41# Use your own debouncing code
42* Set ```DEBOUNCE_ALGO = manual```.
43* Add ```SRC += debounce.c```
44* Add your own ```debounce.c```. Look at included debounce.c's for sample implementations.
45* Debouncing occurs after every raw matrix scan.
46
47# Changing between included debouncing methods
48You can either use your own code, by including your own debounce.c, or switch to another included one.
49Included debounce methods are:
50* debounce_eager_pk - debouncing per key. On any state change, response is immediate, followed by ```DEBOUNCE_DELAY``` millseconds of no further input for that key
51* debounce_sym_g - debouncing per keyboard. On any state change, a global timer is set. When ```DEBOUNCE_DELAY``` milliseconds of no changes has occured, all input changes are pushed.
52
53