X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=keyboard%2Fhid_liber%2Fmatrix.c;h=adf6ac8c428573bfadb558a74a0683e7ffcff084;hb=f5f7a1793a27b18e87d0aa4692cd6ec94067978d;hp=2d939ef63ba6b08072e9f19672471399bd308777;hpb=07dff3425ad849d4c50e437295f3ff6acce6d95e;p=tmk_firmware.git diff --git a/keyboard/hid_liber/matrix.c b/keyboard/hid_liber/matrix.c index 2d939ef..adf6ac8 100644 --- a/keyboard/hid_liber/matrix.c +++ b/keyboard/hid_liber/matrix.c @@ -24,10 +24,8 @@ static uint8_t debouncing = DEBOUNCE; // bit array of key state(1:on, 0:off) -static matrix_row_t *matrix; -static matrix_row_t *matrix_debounced; -static matrix_row_t _matrix0[MATRIX_ROWS]; -static matrix_row_t _matrix1[MATRIX_ROWS]; +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; #define _DDRA (uint8_t *const)&DDRA @@ -148,32 +146,25 @@ void matrix_init(void) setup_leds(); // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00; - for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00; - matrix = _matrix0; - matrix_debounced = _matrix1; + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } } uint8_t matrix_scan(void) { - if (!debouncing) { - uint8_t *tmp = matrix_debounced; - matrix_debounced = matrix; - matrix = tmp; - } - for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7 pull_column(col); // output hi on theline _delay_us(5); // without this wait it won't read stable value. for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17 - bool prev_bit = matrix[row] & (1<