From 055e940f0653ab057f3b95053f1be44c44799664 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 18 Jan 2020 15:01:17 +1100 Subject: [Keyboard] Wasdat matrix cleanup (#7909) * Wasdat matrix cleanup * Use _custom functions * More deduping, and signature fix --- keyboards/maartenwut/wasdat/matrix.c | 246 ++++++++--------------------------- keyboards/maartenwut/wasdat/rules.mk | 2 +- 2 files changed, 54 insertions(+), 194 deletions(-) (limited to 'keyboards') diff --git a/keyboards/maartenwut/wasdat/matrix.c b/keyboards/maartenwut/wasdat/matrix.c index 04d2219713..6dd79b5330 100644 --- a/keyboards/maartenwut/wasdat/matrix.c +++ b/keyboards/maartenwut/wasdat/matrix.c @@ -17,34 +17,11 @@ along with this program. If not, see . #include #include #include "wait.h" -#include "print.h" -#include "debug.h" #include "util.h" #include "matrix.h" #include "debounce.h" #include "quantum.h" -#if (MATRIX_COLS <= 8) -# define print_matrix_header() print("\nr/c 01234567\n") -# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop(matrix[i]) -# define ROW_SHIFTER ((uint8_t)1) -#elif (MATRIX_COLS <= 16) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop16(matrix[i]) -# define ROW_SHIFTER ((uint16_t)1) -#elif (MATRIX_COLS <= 32) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop32(matrix[i]) -# define ROW_SHIFTER ((uint32_t)1) -#endif - -#ifdef MATRIX_MASKED - extern const matrix_row_t matrix_mask[]; -#endif - #ifdef DIRECT_PINS static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; #elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) @@ -52,150 +29,58 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; //static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; #endif -/* matrix state(1:on, 0:off) */ -static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values -static matrix_row_t matrix[MATRIX_ROWS]; //debounced values - -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} - -__attribute__ ((weak)) -void matrix_init_kb(void) { - matrix_init_user(); -} - -__attribute__ ((weak)) -void matrix_scan_kb(void) { - matrix_scan_user(); -} - -__attribute__ ((weak)) -void matrix_init_user(void) { -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { -} - -inline -uint8_t matrix_rows(void) { - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) { - return MATRIX_COLS; -} - -//Deprecated. -bool matrix_is_modified(void) -{ - if (debounce_active()) return false; - return true; -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1<