- mcp23018_status = ergodox_left_leds_update();
-#endif // LEFT_LEDS
- for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
- select_row(i);
- // and select on left hand
- select_row(i + MATRIX_ROWS_PER_SIDE);
- // we don't need a 30us delay anymore, because selecting a
- // left-hand row requires more than 30us for i2c.
- matrix_row_t mask = debounce_mask(i);
- matrix_row_t cols = (read_cols(i) & mask) | (matrix[i] & ~mask);
- debounce_report(cols ^ matrix[i], i);
- matrix[i] = cols;
- // grab cols from right hand
- mask = debounce_mask(i + MATRIX_ROWS_PER_SIDE);
- cols = (read_cols(i + MATRIX_ROWS_PER_SIDE) & mask) | (matrix[i + MATRIX_ROWS_PER_SIDE] & ~mask);
- debounce_report(cols ^ matrix[i + MATRIX_ROWS_PER_SIDE], i + MATRIX_ROWS_PER_SIDE);
- matrix[i + MATRIX_ROWS_PER_SIDE] = cols;
- unselect_rows();
- }
+ mcp23018_status = ergodox_left_leds_update();
+#endif // LEFT_LEDS
+ bool changed = false;
+ for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
+ // select rows from left and right hands
+ uint8_t left_index = i;
+ uint8_t right_index = i + MATRIX_ROWS_PER_SIDE;
+ select_row(left_index);
+ select_row(right_index);
+
+ // we don't need a 30us delay anymore, because selecting a
+ // left-hand row requires more than 30us for i2c.
+
+ changed |= store_raw_matrix_row(left_index);
+ changed |= store_raw_matrix_row(right_index);