You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.3 KiB

  1. # Debounce algorithm
  2. QMK supports multiple debounce algorithms through its debounce API.
  3. The underlying debounce algorithm is determined by which matrix.c file you are using.
  4. The logic for which debounce method called is below. It checks various defines that you have set in rules.mk
  5. ```
  6. DEBOUNCE_TYPE?= sym_g
  7. VALID_DEBOUNCE_TYPES := sym_g eager_pk custom
  8. ifeq ($(filter $(DEBOUNCE_TYPE),$(VALID_DEBOUNCE_TYPES)),)
  9. $(error DEBOUNCE_TYPE="$(DEBOUNCE_TYPE)" is not a valid debounce algorithm)
  10. endif
  11. ifeq ($(strip $(DEBOUNCE_TYPE)), sym_g)
  12. QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_sym_g.c
  13. else ifeq ($(strip $(DEBOUNCE_TYPE)), eager_pk)
  14. QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_eager_pk.c
  15. endif
  16. ```
  17. # Debounce selection
  18. | DEBOUNCE_ALGO | Description | What to do |
  19. | ------------- | --------------------------------------------------- | ----------------------------- |
  20. | Not defined | You are using the included matrix.c and debounce.c | Nothing. Debounce_sym_g will be compiled, and used if necessary |
  21. | custom | Use your own debounce.c | ```SRC += debounce.c``` add your own debounce.c and implement necessary functions |
  22. | sym_g / eager_pk | You are using the included matrix.c and debounce.c | Use an alternative debounce algorithm |
  23. **Regarding split keyboards**:
  24. The debounce code is compatible with split keyboards.
  25. # Use your own debouncing code
  26. * Set ```DEBOUNCE_TYPE = custom ```.
  27. * Add ```SRC += debounce.c```
  28. * Add your own ```debounce.c```. Look at included ```debounce_sym_g.c```s for sample implementations.
  29. * Debouncing occurs after every raw matrix scan.
  30. * Use num_rows rather than MATRIX_ROWS, so that split keyboards are supported correctly.
  31. # Changing between included debouncing methods
  32. You can either use your own code, by including your own debounce.c, or switch to another included one.
  33. Included debounce methods are:
  34. * 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
  35. * 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.