diff options
Diffstat (limited to 'tmk_core/common/matrix.h')
-rw-r--r-- | tmk_core/common/matrix.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index e5665bf40..7624d5137 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h | |||
@@ -20,29 +20,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
20 | #include <stdint.h> | 20 | #include <stdint.h> |
21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | 22 | ||
23 | |||
24 | #if (MATRIX_COLS <= 8) | 23 | #if (MATRIX_COLS <= 8) |
25 | typedef uint8_t matrix_row_t; | 24 | typedef uint8_t matrix_row_t; |
26 | #elif (MATRIX_COLS <= 16) | 25 | #elif (MATRIX_COLS <= 16) |
27 | typedef uint16_t matrix_row_t; | 26 | typedef uint16_t matrix_row_t; |
28 | #elif (MATRIX_COLS <= 32) | 27 | #elif (MATRIX_COLS <= 32) |
29 | typedef uint32_t matrix_row_t; | 28 | typedef uint32_t matrix_row_t; |
30 | #else | 29 | #else |
31 | #error "MATRIX_COLS: invalid value" | 30 | # error "MATRIX_COLS: invalid value" |
32 | #endif | 31 | #endif |
33 | 32 | ||
34 | #if (MATRIX_ROWS <= 8) | 33 | #if (MATRIX_ROWS <= 8) |
35 | typedef uint8_t matrix_col_t; | 34 | typedef uint8_t matrix_col_t; |
36 | #elif (MATRIX_ROWS <= 16) | 35 | #elif (MATRIX_ROWS <= 16) |
37 | typedef uint16_t matrix_col_t; | 36 | typedef uint16_t matrix_col_t; |
38 | #elif (MATRIX_ROWS <= 32) | 37 | #elif (MATRIX_ROWS <= 32) |
39 | typedef uint32_t matrix_col_t; | 38 | typedef uint32_t matrix_col_t; |
40 | #else | 39 | #else |
41 | #error "MATRIX_ROWS: invalid value" | 40 | # error "MATRIX_ROWS: invalid value" |
42 | #endif | 41 | #endif |
43 | 42 | ||
44 | #define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col)) | 43 | #define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1 << col)) |
45 | |||
46 | 44 | ||
47 | #ifdef __cplusplus | 45 | #ifdef __cplusplus |
48 | extern "C" { | 46 | extern "C" { |
@@ -59,7 +57,7 @@ void matrix_init(void); | |||
59 | /* scan all key states on matrix */ | 57 | /* scan all key states on matrix */ |
60 | uint8_t matrix_scan(void); | 58 | uint8_t matrix_scan(void); |
61 | /* whether modified from previous scan. used after matrix_scan. */ | 59 | /* whether modified from previous scan. used after matrix_scan. */ |
62 | bool matrix_is_modified(void) __attribute__ ((deprecated)); | 60 | bool matrix_is_modified(void) __attribute__((deprecated)); |
63 | /* whether a switch is on */ | 61 | /* whether a switch is on */ |
64 | bool matrix_is_on(uint8_t row, uint8_t col); | 62 | bool matrix_is_on(uint8_t row, uint8_t col); |
65 | /* matrix state on row */ | 63 | /* matrix state on row */ |
@@ -67,7 +65,6 @@ matrix_row_t matrix_get_row(uint8_t row); | |||
67 | /* print matrix for debug */ | 65 | /* print matrix for debug */ |
68 | void matrix_print(void); | 66 | void matrix_print(void); |
69 | 67 | ||
70 | |||
71 | /* power control */ | 68 | /* power control */ |
72 | void matrix_power_up(void); | 69 | void matrix_power_up(void); |
73 | void matrix_power_down(void); | 70 | void matrix_power_down(void); |
@@ -83,8 +80,8 @@ void matrix_init_user(void); | |||
83 | void matrix_scan_user(void); | 80 | void matrix_scan_user(void); |
84 | 81 | ||
85 | #ifdef I2C_SPLIT | 82 | #ifdef I2C_SPLIT |
86 | void slave_matrix_init(void); | 83 | void slave_matrix_init(void); |
87 | uint8_t slave_matrix_scan(void); | 84 | uint8_t slave_matrix_scan(void); |
88 | #endif | 85 | #endif |
89 | 86 | ||
90 | #ifdef __cplusplus | 87 | #ifdef __cplusplus |