]> git.donarmstrong.com Git - qmk_firmware.git/blob - docs/feature_debounce_type.md
[Keymap] Add missing tap dance action and fix RGB hues in personal keymaps (#6312)
[qmk_firmware.git] / docs / feature_debounce_type.md
1 # Debounce algorithm
2
3 QMK supports multiple debounce algorithms through its debounce API.
4
5 The logic for which debounce method called is below. It checks various defines that you have set in rules.mk
6
7 ```
8 DEBOUNCE_DIR:= $(QUANTUM_DIR)/debounce
9 DEBOUNCE_TYPE?= sym_g
10 ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
11     QUANTUM_SRC += $(DEBOUNCE_DIR)/$(strip $(DEBOUNCE_TYPE)).c
12 endif
13 ```
14
15 # Debounce selection
16
17 | DEBOUNCE_TYPE    | Description                                          | What else is needed           |
18 | -------------    | ---------------------------------------------------  | ----------------------------- |
19 | Not defined      | Use the default algorithm, currently sym_g           | Nothing                       |
20 | custom           | Use your own debounce.c                              | ```SRC += debounce.c``` add your own debounce.c and implement necessary functions |
21 | anything_else    | Use another algorithm from quantum/debounce/*        | Nothing                       |
22
23 **Regarding split keyboards**:
24 The debounce code is compatible with split keyboards.
25
26 # Use your own debouncing code
27 * Set ```DEBOUNCE_TYPE = custom ```.
28 * Add ```SRC += debounce.c```
29 * Add your own ```debounce.c```. Look at current implementations in ```quantum/debounce``` for examples.
30 * Debouncing occurs after every raw matrix scan.
31 * Use num_rows rather than MATRIX_ROWS, so that split keyboards are supported correctly.
32
33 # Changing between included debouncing methods
34 You can either use your own code, by including your own debounce.c, or switch to another included one.
35 Included debounce methods are:
36 * eager_pr - debouncing per row. On any state change, response is immediate, followed by locking the row ```DEBOUNCE_DELAY``` milliseconds of no further input for that row. 
37 For use in keyboards where refreshing ```NUM_KEYS``` 8-bit counters is computationally expensive / low scan rate, and fingers usually only hit one row at a time. This could be
38 appropriate for the ErgoDox models; the matrix is rotated 90°, and hence its "rows" are really columns, and each finger only hits a single "row" at a time in normal use.
39 * eager_pk - debouncing per key. On any state change, response is immediate, followed by ```DEBOUNCE_DELAY``` milliseconds of no further input for that key
40 * 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.
41
42