diff options
| author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
| commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
| tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /quantum/matrix_common.c | |
| parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
Format code according to conventions (#16322)
Diffstat (limited to 'quantum/matrix_common.c')
| -rw-r--r-- | quantum/matrix_common.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c index d67aaf508c..1497ceae71 100644 --- a/quantum/matrix_common.c +++ b/quantum/matrix_common.c | |||
| @@ -33,9 +33,13 @@ extern const matrix_row_t matrix_mask[]; | |||
| 33 | 33 | ||
| 34 | // user-defined overridable functions | 34 | // user-defined overridable functions |
| 35 | 35 | ||
| 36 | __attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } | 36 | __attribute__((weak)) void matrix_init_kb(void) { |
| 37 | matrix_init_user(); | ||
| 38 | } | ||
| 37 | 39 | ||
| 38 | __attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } | 40 | __attribute__((weak)) void matrix_scan_kb(void) { |
| 41 | matrix_scan_user(); | ||
| 42 | } | ||
| 39 | 43 | ||
| 40 | __attribute__((weak)) void matrix_init_user(void) {} | 44 | __attribute__((weak)) void matrix_init_user(void) {} |
| 41 | 45 | ||
| @@ -43,11 +47,17 @@ __attribute__((weak)) void matrix_scan_user(void) {} | |||
| 43 | 47 | ||
| 44 | // helper functions | 48 | // helper functions |
| 45 | 49 | ||
| 46 | inline uint8_t matrix_rows(void) { return MATRIX_ROWS; } | 50 | inline uint8_t matrix_rows(void) { |
| 51 | return MATRIX_ROWS; | ||
| 52 | } | ||
| 47 | 53 | ||
| 48 | inline uint8_t matrix_cols(void) { return MATRIX_COLS; } | 54 | inline uint8_t matrix_cols(void) { |
| 55 | return MATRIX_COLS; | ||
| 56 | } | ||
| 49 | 57 | ||
| 50 | inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); } | 58 | inline bool matrix_is_on(uint8_t row, uint8_t col) { |
| 59 | return (matrix[row] & ((matrix_row_t)1 << col)); | ||
| 60 | } | ||
| 51 | 61 | ||
| 52 | inline matrix_row_t matrix_get_row(uint8_t row) { | 62 | inline matrix_row_t matrix_get_row(uint8_t row) { |
| 53 | // Matrix mask lets you disable switches in the returned matrix data. For example, if you have a | 63 | // Matrix mask lets you disable switches in the returned matrix data. For example, if you have a |
| @@ -124,16 +134,26 @@ bool matrix_post_scan(void) { | |||
| 124 | #endif | 134 | #endif |
| 125 | 135 | ||
| 126 | /* `matrix_io_delay ()` exists for backwards compatibility. From now on, use matrix_output_unselect_delay(). */ | 136 | /* `matrix_io_delay ()` exists for backwards compatibility. From now on, use matrix_output_unselect_delay(). */ |
| 127 | __attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } | 137 | __attribute__((weak)) void matrix_io_delay(void) { |
| 128 | __attribute__((weak)) void matrix_output_select_delay(void) { waitInputPinDelay(); } | 138 | wait_us(MATRIX_IO_DELAY); |
| 129 | __attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { matrix_io_delay(); } | 139 | } |
| 140 | __attribute__((weak)) void matrix_output_select_delay(void) { | ||
| 141 | waitInputPinDelay(); | ||
| 142 | } | ||
| 143 | __attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { | ||
| 144 | matrix_io_delay(); | ||
| 145 | } | ||
| 130 | 146 | ||
| 131 | // CUSTOM MATRIX 'LITE' | 147 | // CUSTOM MATRIX 'LITE' |
| 132 | __attribute__((weak)) void matrix_init_custom(void) {} | 148 | __attribute__((weak)) void matrix_init_custom(void) {} |
| 133 | __attribute__((weak)) bool matrix_scan_custom(matrix_row_t current_matrix[]) { return true; } | 149 | __attribute__((weak)) bool matrix_scan_custom(matrix_row_t current_matrix[]) { |
| 150 | return true; | ||
| 151 | } | ||
| 134 | 152 | ||
| 135 | #ifdef SPLIT_KEYBOARD | 153 | #ifdef SPLIT_KEYBOARD |
| 136 | __attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } | 154 | __attribute__((weak)) void matrix_slave_scan_kb(void) { |
| 155 | matrix_slave_scan_user(); | ||
| 156 | } | ||
| 137 | __attribute__((weak)) void matrix_slave_scan_user(void) {} | 157 | __attribute__((weak)) void matrix_slave_scan_user(void) {} |
| 138 | #endif | 158 | #endif |
| 139 | 159 | ||
| @@ -170,4 +190,6 @@ __attribute__((weak)) uint8_t matrix_scan(void) { | |||
| 170 | return changed; | 190 | return changed; |
| 171 | } | 191 | } |
| 172 | 192 | ||
| 173 | __attribute__((weak)) bool peek_matrix(uint8_t row_index, uint8_t col_index, bool raw) { return 0 != ((raw ? raw_matrix[row_index] : matrix[row_index]) & (MATRIX_ROW_SHIFTER << col_index)); } | 193 | __attribute__((weak)) bool peek_matrix(uint8_t row_index, uint8_t col_index, bool raw) { |
| 194 | return 0 != ((raw ? raw_matrix[row_index] : matrix[row_index]) & (MATRIX_ROW_SHIFTER << col_index)); | ||
| 195 | } | ||
