keychron_qmk_firmware/quantum/debounce
Purdea Andrei b8c3f4c60b
quantum/debounce: Added sym_pk debounce algorithm (#8587)
* quantum/debounce: Added sym_pk debounce algorithm

* Apply suggestions from code review

Co-Authored-By: Ryan <fauxpark@gmail.com>

* quantum/debounce/sym_pk: delete comments and rename functions following code review

* quantum/debounce/sym_pk: Modifications for code readability according to code review

* quantum/debounce/sym_pk: Modifications for code readability according to code review (2)

* quantum/debounce/sym_pk: code review: cleaner code

Co-Authored-By: Nick Brassel <nick@tzarc.org>

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2020-04-11 21:29:48 +10:00
..
eager_pk.c quantum/debounce: Added sym_pk debounce algorithm (#8587) 2020-04-11 21:29:48 +10:00
eager_pr.c format code according to conventions [skip ci] 2020-04-11 00:48:16 +00:00
readme.md Eager Per Row Debouncing added (added to Ergodox) (#5498) 2019-04-03 14:45:55 -07:00
sym_g.c clang-format changes 2019-08-30 15:01:52 -07:00
sym_pk.c quantum/debounce: Added sym_pk debounce algorithm (#8587) 2020-04-11 21:29:48 +10:00

Debounce algorithms belong in this folder. Here are a few ideas

  1. Global vs Per-Key vs Per-Row
  • Global - one timer for all keys. Any key change state affects global timer
  • Per key - one timer per key
  • Per row - one timer per row
  1. Eager vs symmetric vs asymmetric
  • Eager - any key change is reported immediately. All further inputs for DEBOUNCE ms are ignored.
  • Symmetric - wait for no changes for DEBOUNCE ms before reporting change
  • Asymmetric - wait for different times depending on key-down/key-up. E.g. Eager key-down, DEBOUNCE ms key up.
  1. Timestamp vs cycles
  • old old old code waits n cycles, decreasing count by one each matrix_scan
  • newer code stores the millisecond the change occurred, and does subraction to figure out time elapsed.
  • Timestamps are superior, i don't think cycles will ever be used again once upgraded.

The default algorithm is symmetric and global. Here are a few that could be implemented:

sym_g.c sym_pk.c sym_pr.c sym_pr_cycles.c eager_g.c eager_pk.c eager_pr.c //could be used in ergo-dox!