From aaa758f1d3f97dda39879f2b055ad2da9680adfe Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Mon, 23 May 2016 20:42:21 -0700 Subject: Optimize matrix scanning (#343) --- tmk_core/common/matrix.h | 61 +++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'tmk_core/common/matrix.h') diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index ad0871bfb..5f380aaab 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h @@ -14,59 +14,68 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ - #ifndef MATRIX_H #define MATRIX_H #include #include - -#if (MATRIX_COLS <= 8) -typedef uint8_t matrix_row_t; -#elif (MATRIX_COLS <= 16) -typedef uint16_t matrix_row_t; -#elif (MATRIX_COLS <= 32) -typedef uint32_t matrix_row_t; +#if MATRIX_COLS <= 8 +typedef uint8_t matrix_row_t; +#elif MATRIX_COLS <= 16 +typedef uint16_t matrix_row_t; +#elif MATRIX_COLS <= 32 +typedef uint32_t matrix_row_t; #else -#error "MATRIX_COLS: invalid value" +# error "There are too many columns." #endif -#define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<