forked from mirror/qmk_firmware
Migrate ROW_SHIFTER to core MATRIX_ROW_SHIFTER (#25977)
This commit is contained in:
@@ -76,8 +76,6 @@ uint8_t expander_status;
|
||||
uint8_t expander_input_pin_mask;
|
||||
bool i2c_initialized = false;
|
||||
|
||||
#define ROW_SHIFTER ((matrix_row_t)1)
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {}
|
||||
|
||||
@@ -284,7 +282,7 @@ uint8_t matrix_scan(void)
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & (ROW_SHIFTER << col));
|
||||
return (matrix[row] & (MATRIX_ROW_SHIFTER << col));
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -344,7 +342,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
if (! col_expanded[col_index]) {
|
||||
uint8_t pin = onboard_col_pins[col_index];
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,10 +430,10 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
|
||||
if (column_state & (1 << current_row)) {
|
||||
// key closed; set state bit in matrix
|
||||
current_matrix[current_row] |= (ROW_SHIFTER << current_col);
|
||||
current_matrix[current_row] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
// key open; clear state bit in matrix
|
||||
current_matrix[current_row] &= ~(ROW_SHIFTER << current_col);
|
||||
current_matrix[current_row] &= ~(MATRIX_ROW_SHIFTER << current_col);
|
||||
}
|
||||
|
||||
// Determine whether the matrix changed state
|
||||
|
||||
@@ -31,15 +31,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#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))
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
@@ -150,7 +147,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
uint8_t pin_state = gpio_read_pin(dat_pin);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
|
||||
// Unselect row
|
||||
|
||||
@@ -43,15 +43,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#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))
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
#ifdef MATRIX_MASKED
|
||||
@@ -227,7 +224,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << tp_index);
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << tp_index);
|
||||
}
|
||||
return (last_row_value != current_matrix[current_row]);
|
||||
}
|
||||
@@ -245,7 +242,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
|
||||
// Unselect row
|
||||
|
||||
@@ -86,8 +86,6 @@ uint8_t expander_status;
|
||||
uint8_t expander_input_pin_mask;
|
||||
bool i2c_initialized = false;
|
||||
|
||||
#define ROW_SHIFTER ((matrix_row_t)1)
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {}
|
||||
|
||||
@@ -256,7 +254,7 @@ uint8_t matrix_scan(void)
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & (ROW_SHIFTER << col));
|
||||
return (matrix[row] & (MATRIX_ROW_SHIFTER << col));
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -314,7 +312,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
if (! col_expanded[col_index]) {
|
||||
uint8_t pin = onboard_col_pins[col_index];
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,10 +399,10 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
|
||||
if (column_state & (1 << current_row)) {
|
||||
// key closed; set state bit in matrix
|
||||
current_matrix[current_row] |= (ROW_SHIFTER << current_col);
|
||||
current_matrix[current_row] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
// key open; clear state bit in matrix
|
||||
current_matrix[current_row] &= ~(ROW_SHIFTER << current_col);
|
||||
current_matrix[current_row] &= ~(MATRIX_ROW_SHIFTER << current_col);
|
||||
}
|
||||
|
||||
// Determine whether the matrix changed state
|
||||
|
||||
Reference in New Issue
Block a user