]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/split_common/matrix.c
Added encoder support to split common code (#5477)
[qmk_firmware.git] / quantum / split_common / matrix.c
index c3d2857ed50bfd9b8894817f88e76b77d305f60c..eb110bd23adeceec56b2adea151c670bfd534595 100644 (file)
@@ -25,11 +25,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "matrix.h"
 #include "split_util.h"
 #include "config.h"
-#include "split_flags.h"
 #include "quantum.h"
 #include "debounce.h"
 #include "transport.h"
 
+#ifdef ENCODER_ENABLE
+  #include "encoder.h"
+#endif
+
 #if (MATRIX_COLS <= 8)
 #  define print_matrix_header() print("\nr/c 01234567\n")
 #  define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
@@ -143,8 +146,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
 #elif (DIODE_DIRECTION == COL2ROW)
 
 static void select_row(uint8_t row) {
-  writePinLow(row_pins[row]);
   setPinOutput(row_pins[row]);
+  writePinLow(row_pins[row]);
 }
 
 static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
@@ -188,8 +191,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
 #elif (DIODE_DIRECTION == ROW2COL)
 
 static void select_col(uint8_t col) {
-  writePinLow(col_pins[col]);
   setPinOutput(col_pins[col]);
+  writePinLow(col_pins[col]);
 }
 
 static void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); }
@@ -321,6 +324,9 @@ uint8_t matrix_scan(void) {
     matrix_scan_quantum();
   } else {
     transport_slave(matrix + thisHand);
+#ifdef ENCODER_ENABLE
+    encoder_read();
+#endif
     matrix_slave_scan_user();
   }