diff options
author | Danny <nooges@users.noreply.github.com> | 2018-09-09 22:42:46 -0400 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-09-09 19:42:46 -0700 |
commit | 3dbdfbd99a9efd12275abdcdcf2abe843e300f6b (patch) | |
tree | d86173d92e2203d2df5c2c2bf8d3e33fdfa11079 /quantum/split_common/matrix.c | |
parent | 38c916a3686bfd1af762a1de4ccdaf7eb1123f2e (diff) | |
download | qmk_firmware-3dbdfbd99a9efd12275abdcdcf2abe843e300f6b.tar.gz qmk_firmware-3dbdfbd99a9efd12275abdcdcf2abe843e300f6b.zip |
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/split_common/matrix.c')
-rw-r--r-- | quantum/split_common/matrix.c | 19 |
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]; | |||
71 | 71 | ||
72 | static uint8_t error_count = 0; | 72 | static uint8_t error_count = 0; |
73 | 73 | ||
74 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | 74 | static uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
75 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | 75 | static uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
76 | 76 | ||
77 | /* matrix state(1:on, 0:off) */ | 77 | /* matrix state(1:on, 0:off) */ |
78 | static matrix_row_t matrix[MATRIX_ROWS]; | 78 | static matrix_row_t matrix[MATRIX_ROWS]; |
@@ -137,6 +137,21 @@ void matrix_init(void) | |||
137 | debug_enable = true; | 137 | debug_enable = true; |
138 | debug_matrix = true; | 138 | debug_matrix = true; |
139 | debug_mouse = true; | 139 | debug_mouse = true; |
140 | |||
141 | // Set pinout for right half if pinout for that half is defined | ||
142 | if (!isLeftHand) { | ||
143 | #ifdef MATRIX_ROW_PINS_RIGHT | ||
144 | const uint8_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT; | ||
145 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) | ||
146 | row_pins[i] = row_pins_right[i]; | ||
147 | #endif | ||
148 | #ifdef MATRIX_COL_PINS_RIGHT | ||
149 | const uint8_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT; | ||
150 | for (uint8_t i = 0; i < MATRIX_COLS; i++) | ||
151 | col_pins[i] = col_pins_right[i]; | ||
152 | #endif | ||
153 | } | ||
154 | |||
140 | // initialize row and col | 155 | // initialize row and col |
141 | #if (DIODE_DIRECTION == COL2ROW) | 156 | #if (DIODE_DIRECTION == COL2ROW) |
142 | unselect_rows(); | 157 | unselect_rows(); |