Various fixes for matrix _RIGHT handling (#16292)

* Various fixes for matrix _RIGHT handling

* clang
master
Joel Challis 2022-02-11 19:01:16 +00:00 committed by GitHub
parent 2d4a69cfc6
commit 39bec3bfa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -47,13 +47,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif #endif
#ifdef DIRECT_PINS #ifdef DIRECT_PINS
static SPLIT_MUTABLE pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; static SPLIT_MUTABLE pin_t direct_pins[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS;
#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) #elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
# ifdef MATRIX_ROW_PINS # ifdef MATRIX_ROW_PINS
static SPLIT_MUTABLE_ROW pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static SPLIT_MUTABLE_ROW pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS;
# endif // MATRIX_ROW_PINS # endif // MATRIX_ROW_PINS
# ifdef MATRIX_COL_PINS # ifdef MATRIX_COL_PINS
static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
# endif // MATRIX_COL_PINS # endif // MATRIX_COL_PINS
#endif #endif
@ -102,7 +102,7 @@ static inline uint8_t readMatrixPin(pin_t pin) {
#ifdef DIRECT_PINS #ifdef DIRECT_PINS
__attribute__((weak)) void matrix_init_pins(void) { __attribute__((weak)) void matrix_init_pins(void) {
for (int row = 0; row < MATRIX_ROWS; row++) { for (int row = 0; row < ROWS_PER_HAND; row++) {
for (int col = 0; col < MATRIX_COLS; col++) { for (int col = 0; col < MATRIX_COLS; col++) {
pin_t pin = direct_pins[row][col]; pin_t pin = direct_pins[row][col];
if (pin != NO_PIN) { if (pin != NO_PIN) {
@ -270,16 +270,16 @@ void matrix_init(void) {
// Set pinout for right half if pinout for that half is defined // Set pinout for right half if pinout for that half is defined
if (!isLeftHand) { if (!isLeftHand) {
# ifdef DIRECT_PINS_RIGHT # ifdef DIRECT_PINS_RIGHT
const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT; const pin_t direct_pins_right[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS_RIGHT;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
for (uint8_t j = 0; j < MATRIX_COLS; j++) { for (uint8_t j = 0; j < MATRIX_COLS; j++) {
direct_pins[i][j] = direct_pins_right[i][j]; direct_pins[i][j] = direct_pins_right[i][j];
} }
} }
# endif # endif
# ifdef MATRIX_ROW_PINS_RIGHT # ifdef MATRIX_ROW_PINS_RIGHT
const pin_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT; const pin_t row_pins_right[ROWS_PER_HAND] = MATRIX_ROW_PINS_RIGHT;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
row_pins[i] = row_pins_right[i]; row_pins[i] = row_pins_right[i];
} }
# endif # endif