diff options
| author | Alex Ong <alex.ong@unsw.edu.au> | 2018-08-29 10:45:53 +1000 |
|---|---|---|
| committer | Alex Ong <alex.ong@unsw.edu.au> | 2018-08-29 10:45:53 +1000 |
| commit | 4db27a2c7614c0aa5a0b46d8e1f5c5cc8216fd1c (patch) | |
| tree | 31e32520c7e86c82a7c105f435181ea66aed6133 | |
| parent | 3cf7f7322c24e3cab21d402f1a859b60df857603 (diff) | |
| download | qmk_firmware-4db27a2c7614c0aa5a0b46d8e1f5c5cc8216fd1c.tar.gz qmk_firmware-4db27a2c7614c0aa5a0b46d8e1f5c5cc8216fd1c.zip | |
Changed order of rules in TMK. Documented feature.
| -rw-r--r-- | docs/feature_debounce_algo.md | 51 | ||||
| -rw-r--r-- | tmk_core/common.mk | 6 |
2 files changed, 54 insertions, 3 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 | |||
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 72b2d3cc8..85f903fda 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
| @@ -42,9 +42,7 @@ ifeq ($(PLATFORM),TEST) | |||
| 42 | endif | 42 | endif |
| 43 | 43 | ||
| 44 | # Debounce Modules. If implemented in matrix.c, don't use these. | 44 | # Debounce Modules. If implemented in matrix.c, don't use these. |
| 45 | ifeq ($(strip $(CUSTOM_MATRIX)), yes) | 45 | ifeq ($(strip $(SPLIT_KEYBOARD)), yes) |
| 46 | # Do nothing. Custom matrix code. | ||
| 47 | else ifeq ($(strip $(SPLIT_KEYBOARD)), yes) | ||
| 48 | # Do nothing, debouncing is inside matrix.c inside split_common | 46 | # Do nothing, debouncing is inside matrix.c inside split_common |
| 49 | else ifeq ($(strip $(DEBOUNCE_ALGO)), manual) | 47 | else ifeq ($(strip $(DEBOUNCE_ALGO)), manual) |
| 50 | # Do nothing. do your debouncing in matrix.c | 48 | # Do nothing. do your debouncing in matrix.c |
| @@ -52,6 +50,8 @@ else ifeq ($(strip $(DEBOUNCE_ALGO)), sym_g) | |||
| 52 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c | 50 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c |
| 53 | else ifeq ($(strip $(DEBOUNCE_ALGO)), eager_pk) | 51 | else ifeq ($(strip $(DEBOUNCE_ALGO)), eager_pk) |
| 54 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_eager_pk.c | 52 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_eager_pk.c |
| 53 | else ifeq ($(strip $(CUSTOM_MATRIX)), yes) | ||
| 54 | # Do nothing. Custom matrix code. | ||
| 55 | else # default algorithm | 55 | else # default algorithm |
| 56 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c | 56 | TMK_COMMON_SRC += $(DEBOUNCE)/debounce_sym_g.c |
| 57 | endif | 57 | endif |
