summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorDanny <nooges@users.noreply.github.com>2018-09-10 04:42:46 +0200
committerDrashna Jaelre <drashna@live.com>2018-09-10 04:42:46 +0200
commit3dbdfbd99a9efd12275abdcdcf2abe843e300f6b (patch)
treed86173d92e2203d2df5c2c2bf8d3e33fdfa11079 /quantum
parent38c916a3686bfd1af762a1de4ccdaf7eb1123f2e (diff)
downloadqmk_firmware-3dbdfbd99a9efd12275abdcdcf2abe843e300f6b.tar.gz
qmk_firmware-3dbdfbd99a9efd12275abdcdcf2abe843e300f6b.tar.xz
Add support for a different pinout on Split boards (#3869)
* Add support for a different pinout for the right half of a split keyboard (number of cols/rows still has to be the same)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/split_common/matrix.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c
index 4af90209f..3d2983f2e 100644
--- a/quantum/split_common/matrix.c
+++ b/quantum/split_common/matrix.c
@@ -71,8 +71,8 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static uint8_t error_count = 0;
-static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
-static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+static uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
@@ -137,6 +137,21 @@ void matrix_init(void)
debug_enable = true;
debug_matrix = true;
debug_mouse = true;
+
+ // Set pinout for right half if pinout for that half is defined
+ if (!isLeftHand) {
+#ifdef MATRIX_ROW_PINS_RIGHT
+ const uint8_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++)
+ row_pins[i] = row_pins_right[i];
+#endif
+#ifdef MATRIX_COL_PINS_RIGHT
+ const uint8_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT;
+ for (uint8_t i = 0; i < MATRIX_COLS; i++)
+ col_pins[i] = col_pins_right[i];
+#endif
+ }
+
// initialize row and col
#if (DIODE_DIRECTION == COL2ROW)
unselect_rows();