diff options
Diffstat (limited to 'quantum/matrix.c')
| -rw-r--r-- | quantum/matrix.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c index 34d6af2e6..9298661ad 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
| @@ -47,7 +47,7 @@ static inline void setPinInputHigh_atomic(pin_t pin) { | |||
| 47 | 47 | ||
| 48 | #ifdef DIRECT_PINS | 48 | #ifdef DIRECT_PINS |
| 49 | 49 | ||
| 50 | static void init_pins(void) { | 50 | __attribute__((weak)) void matrix_init_pins(void) { |
| 51 | for (int row = 0; row < MATRIX_ROWS; row++) { | 51 | for (int row = 0; row < MATRIX_ROWS; row++) { |
| 52 | for (int col = 0; col < MATRIX_COLS; col++) { | 52 | for (int col = 0; col < MATRIX_COLS; col++) { |
| 53 | pin_t pin = direct_pins[row][col]; | 53 | pin_t pin = direct_pins[row][col]; |
| @@ -58,7 +58,7 @@ static void init_pins(void) { | |||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { | 61 | __attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { |
| 62 | // Start with a clear matrix row | 62 | // Start with a clear matrix row |
| 63 | matrix_row_t current_row_value = 0; | 63 | matrix_row_t current_row_value = 0; |
| 64 | 64 | ||
| @@ -90,14 +90,14 @@ static void unselect_rows(void) { | |||
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | static void init_pins(void) { | 93 | __attribute__((weak)) void matrix_init_pins(void) { |
| 94 | unselect_rows(); | 94 | unselect_rows(); |
| 95 | for (uint8_t x = 0; x < MATRIX_COLS; x++) { | 95 | for (uint8_t x = 0; x < MATRIX_COLS; x++) { |
| 96 | setPinInputHigh_atomic(col_pins[x]); | 96 | setPinInputHigh_atomic(col_pins[x]); |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { | 100 | __attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { |
| 101 | // Start with a clear matrix row | 101 | // Start with a clear matrix row |
| 102 | matrix_row_t current_row_value = 0; | 102 | matrix_row_t current_row_value = 0; |
| 103 | 103 | ||
| @@ -138,14 +138,14 @@ static void unselect_cols(void) { | |||
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static void init_pins(void) { | 141 | __attribute__((weak)) void matrix_init_pins(void) { |
| 142 | unselect_cols(); | 142 | unselect_cols(); |
| 143 | for (uint8_t x = 0; x < MATRIX_ROWS; x++) { | 143 | for (uint8_t x = 0; x < MATRIX_ROWS; x++) { |
| 144 | setPinInputHigh_atomic(row_pins[x]); | 144 | setPinInputHigh_atomic(row_pins[x]); |
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { | 148 | __attribute__((weak)) bool matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { |
| 149 | bool matrix_changed = false; | 149 | bool matrix_changed = false; |
| 150 | 150 | ||
| 151 | // Select col | 151 | // Select col |
| @@ -190,7 +190,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) | |||
| 190 | 190 | ||
| 191 | void matrix_init(void) { | 191 | void matrix_init(void) { |
| 192 | // initialize key pins | 192 | // initialize key pins |
| 193 | init_pins(); | 193 | matrix_init_pins(); |
| 194 | 194 | ||
| 195 | // initialize matrix state: all keys off | 195 | // initialize matrix state: all keys off |
| 196 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 196 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| @@ -209,12 +209,12 @@ uint8_t matrix_scan(void) { | |||
| 209 | #if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) | 209 | #if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) |
| 210 | // Set row, read cols | 210 | // Set row, read cols |
| 211 | for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { | 211 | for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { |
| 212 | changed |= read_cols_on_row(raw_matrix, current_row); | 212 | changed |= matrix_read_cols_on_row(raw_matrix, current_row); |
| 213 | } | 213 | } |
| 214 | #elif (DIODE_DIRECTION == ROW2COL) | 214 | #elif (DIODE_DIRECTION == ROW2COL) |
| 215 | // Set col, read rows | 215 | // Set col, read rows |
| 216 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | 216 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { |
| 217 | changed |= read_rows_on_col(raw_matrix, current_col); | 217 | changed |= matrix_read_rows_on_col(raw_matrix, current_col); |
| 218 | } | 218 | } |
| 219 | #endif | 219 | #endif |
| 220 | 220 | ||
