Skip to content

Commit

Permalink
Add support for a different pinout on Split boards (qmk#3869)
Browse files Browse the repository at this point in the history
* Add support for a different pinout for the right half of a split keyboard (number of cols/rows still has to be the same)
  • Loading branch information
nooges authored and yamad committed Mar 21, 2019
1 parent 0fb8f37 commit c740de7
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions quantum/split_common/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c740de7

Please sign in to comment.