aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/matrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/matrix.h')
-rw-r--r--tmk_core/common/matrix.h27
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)
25typedef uint8_t matrix_row_t; 24typedef uint8_t matrix_row_t;
26#elif (MATRIX_COLS <= 16) 25#elif (MATRIX_COLS <= 16)
27typedef uint16_t matrix_row_t; 26typedef uint16_t matrix_row_t;
28#elif (MATRIX_COLS <= 32) 27#elif (MATRIX_COLS <= 32)
29typedef uint32_t matrix_row_t; 28typedef 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)
35typedef uint8_t matrix_col_t; 34typedef uint8_t matrix_col_t;
36#elif (MATRIX_ROWS <= 16) 35#elif (MATRIX_ROWS <= 16)
37typedef uint16_t matrix_col_t; 36typedef uint16_t matrix_col_t;
38#elif (MATRIX_ROWS <= 32) 37#elif (MATRIX_ROWS <= 32)
39typedef uint32_t matrix_col_t; 38typedef 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
48extern "C" { 46extern "C" {
@@ -59,7 +57,7 @@ void matrix_init(void);
59/* scan all key states on matrix */ 57/* scan all key states on matrix */
60uint8_t matrix_scan(void); 58uint8_t matrix_scan(void);
61/* whether modified from previous scan. used after matrix_scan. */ 59/* whether modified from previous scan. used after matrix_scan. */
62bool matrix_is_modified(void) __attribute__ ((deprecated)); 60bool matrix_is_modified(void) __attribute__((deprecated));
63/* whether a switch is on */ 61/* whether a switch is on */
64bool matrix_is_on(uint8_t row, uint8_t col); 62bool 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 */
68void matrix_print(void); 66void matrix_print(void);
69 67
70
71/* power control */ 68/* power control */
72void matrix_power_up(void); 69void matrix_power_up(void);
73void matrix_power_down(void); 70void matrix_power_down(void);
@@ -83,8 +80,8 @@ void matrix_init_user(void);
83void matrix_scan_user(void); 80void matrix_scan_user(void);
84 81
85#ifdef I2C_SPLIT 82#ifdef I2C_SPLIT
86 void slave_matrix_init(void); 83void slave_matrix_init(void);
87 uint8_t slave_matrix_scan(void); 84uint8_t slave_matrix_scan(void);
88#endif 85#endif
89 86
90#ifdef __cplusplus 87#ifdef __cplusplus