aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/feature_debounce_type.md46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/feature_debounce_type.md b/docs/feature_debounce_type.md
new file mode 100644
index 000000000..82b3d7de1
--- /dev/null
+++ b/docs/feature_debounce_type.md
@@ -0,0 +1,46 @@
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```
10DEBOUNCE_TYPE?= sym_g
11VALID_DEBOUNCE_TYPES := sym_g eager_pk custom
12ifeq ($(filter $(DEBOUNCE_TYPE),$(VALID_DEBOUNCE_TYPES)),)
13 $(error DEBOUNCE_TYPE="$(DEBOUNCE_TYPE)" is not a valid debounce algorithm)
14endif
15ifeq ($(strip $(DEBOUNCE_TYPE)), sym_g)
16 QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_sym_g.c
17else ifeq ($(strip $(DEBOUNCE_TYPE)), eager_pk)
18 QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_eager_pk.c
19endif
20```
21
22# Debounce selection
23
24| DEBOUNCE_ALGO | Description | What to do |
25| ------------- | --------------------------------------------------- | ----------------------------- |
26| Not defined | You are using the included matrix.c and debounce.c | Nothing. Debounce_sym_g will be compiled, and used if necessary |
27| custom | Use your own debounce.c | ```SRC += debounce.c``` add your own debounce.c and implement necessary functions |
28| sym_g / eager_pk | You are using the included matrix.c and debounce.c | Use an alternative debounce algorithm |
29
30**Regarding split keyboards**:
31The debounce code is compatible with split keyboards.
32
33# Use your own debouncing code
34* Set ```DEBOUNCE_TYPE = custom ```.
35* Add ```SRC += debounce.c```
36* Add your own ```debounce.c```. Look at included ```debounce_sym_g.c```s for sample implementations.
37* Debouncing occurs after every raw matrix scan.
38* Use num_rows rather than MATRIX_ROWS, so that split keyboards are supported correctly.
39
40# Changing between included debouncing methods
41You can either use your own code, by including your own debounce.c, or switch to another included one.
42Included debounce methods are:
43* 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
44* 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.
45
46