summaryrefslogtreecommitdiffstats
path: root/keyboards/ergodox_ez/config.h
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2017-11-18 16:11:26 -0600
committerJack Humbert <jack.humb@gmail.com>2017-11-26 02:07:06 -0500
commit7fbe6c35944a140cc3b089884350844dddf301e6 (patch)
tree83d006ab2e198e6e141f2ac5d9b5d1fdbfec5cbd /keyboards/ergodox_ez/config.h
parent55f3cd37af7b83c12fd8a83f0a1000fea1d89d41 (diff)
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>
Diffstat (limited to 'keyboards/ergodox_ez/config.h')
-rw-r--r--keyboards/ergodox_ez/config.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h
index bf3ebceb11..cbe615c09b 100644
--- a/keyboards/ergodox_ez/config.h
+++ b/keyboards/ergodox_ez/config.h
@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* key matrix size */
#define MATRIX_ROWS 14
+#define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2)
#define MATRIX_COLS 6
#define MOUSEKEY_INTERVAL 20
@@ -80,7 +81,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBW 1
-/* Set 0 if debouncing isn't needed */
+/* "debounce" is measured in keyboard scans. Some users reported
+ * needing values as high as 15, which was at the time around 50ms.
+ * If you don't define it here, the matrix code will default to
+ * 5, which is now closer to 10ms, but still plenty according to
+ * manufacturer specs.
+ *
+ * Default is quite high, because of reports with some production
+ * runs seeming to need it. This may change when configuration for
+ * this is more directly exposed.
+ */
#define DEBOUNCE 15
#define PREVENT_STUCK_MODIFIERS