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