]> git.donarmstrong.com Git - qmk_firmware.git/commit
improve ergodox ez performance
authorSeebs <seebs@seebs.net>
Sat, 18 Nov 2017 22:11:26 +0000 (16:11 -0600)
committerJack Humbert <jack.humb@gmail.com>
Sun, 26 Nov 2017 07:07:06 +0000 (02:07 -0500)
commit7fbe6c35944a140cc3b089884350844dddf301e6
tree83d006ab2e198e6e141f2ac5d9b5d1fdbfec5cbd
parent55f3cd37af7b83c12fd8a83f0a1000fea1d89d41
improve ergodox ez performance

With these changes, the ergodox ez goes from 315 scans per second
when no keys are pressed (~3.17ms/scan) to 447 (~2.24ms/scan).

The changes to the pin read are just condensing the logic, and
replacing a lot of conditional operations with a single bitwise
inversion.

The change to row scanning is more significant, and merits
explanation. In general, you can only scan one row of a keyboard
at a time, because if you scan two rows, you no longer know
which row is pulling a given column down. But in the Ergodox
design, this isn't the case; the left hand is controlled by an
I2C-based GPIO expander, and the columns and rows are *completely
separate* electrically from the columns and rows on the right-hand
side.

So simply reading rows in parallel offers two significant
improvements. One is that we no longer need the 30us delay after
each right-hand row, because we're spending more than 30us
communicating with the left hand over i2c. Another is that we're
no longer wastefully sending i2c messages to the left hand
to unselect rows when no rows had actually been selected in the
first place. These delays were, between them, coming out to
nearly 30% of the time spent in each scan.

Signed-off-by: seebs <seebs@seebs.net>
keyboards/ergodox_ez/config.h
keyboards/ergodox_ez/matrix.c